Skip to content

Commit

Permalink
fix(plugins/docker): use node -p trick temporariy
Browse files Browse the repository at this point in the history
  • Loading branch information
dalisoft committed Jun 5, 2024
1 parent dc99f6f commit ac6d130
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
5 changes: 4 additions & 1 deletion plugins/docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ set -eu
# Docker buildx script was copied from
# https://docs.docker.com/build/cloud/ci
# and modified by @dalisoft for AMD64/ARM64 platforms
ARCH=$(uname -m | sed 's/aarch64/arm64/' | sed 's/x86_64/amd64/')

# TODO: This `node` trick for bypassing coverage bug in Bashcov
# See https://github.com/infertux/bashcov/issues/86
ARCH=$(node -p "process.arch.replace('aarch64', 'arm64').replace(/x86_64|x64/, 'amd64')")
OS=$(uname -s | tr '[:upper:]' '[:lower:]')

prepare() {
Expand Down
15 changes: 11 additions & 4 deletions tests/plugins/github-release.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,23 @@ test_plugin_gh_0_2_initial_message() {
assert_matches "v0.0.1" "$(GITHUB_TOKEN="FAKE_TOKEN" bash "$ROOT_DIR/release.sh" --plugins=git,github-release --quiet)"
assert_matches "v0.0.1" "$(git tag -l)"
}
test_plugin_gh_no_token_fail_message() {
test_plugin_gh_0_3_pre_release() {
git commit --quiet -m "fix: initial commit" --allow-empty --no-gpg-sign

assert_matches "v0.0.1" "$(git tag -l)"
assert_not_matches "v0.0.2" "$(git tag -l)"
assert_status_code 1 "$ROOT_DIR/release.sh --plugins=github-release --quiet"
GITHUB_TOKEN="FAKE_TOKEN" assert_status_code 0 "$ROOT_DIR/release.sh --plugins=git,github-release --quiet --pre-release"
assert_matches "v0.0.2" "$(git tag -l)"
assert_not_matches "v0.0.3" "$(git tag -l)"
}
test_plugin_z_check_gh() {
unset gh
unset fake_gh

assert_status_code 1 "$ROOT_DIR/release.sh --plugins=github-release --quiet"
}
test_plugin_gh_no_token_fail_message() {
git commit --quiet -m "fix: initial commit" --allow-empty --no-gpg-sign

assert_status_code 1 "$ROOT_DIR/release.sh --plugins=github-release --quiet"
assert_matches "v0.0.2" "$(git tag -l)"
assert_not_matches "v0.0.3" "$(git tag -l)"
}

0 comments on commit ac6d130

Please sign in to comment.