Skip to content

Commit d09bcb5

Browse files
committed
Update scripts and CI config
1 parent ef783a3 commit d09bcb5

File tree

4 files changed

+38
-6
lines changed

4 files changed

+38
-6
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,10 @@ jobs:
7777
rustup toolchain remove 1.63 1.64 1.65
7878
cargo hack check --rust-version --workspace --locked
7979
cargo uninstall cargo-hack
80-
- uses: taiki-e/install-action@cargo-hack
81-
- uses: taiki-e/install-action@cargo-minimal-versions
80+
- uses: taiki-e/install-action@v2
81+
with:
82+
tool: cargo-hack,cargo-minimal-versions
83+
fallback: none
8284
- run: cargo hack build --workspace --no-private --feature-powerset --no-dev-deps
8385
- run: cargo minimal-versions build --workspace --no-private --detach-path-deps=skip-exact --all-features
8486
- run: cargo minimal-versions build --workspace --no-private --detach-path-deps=skip-exact --all-features --direct

.github/workflows/release.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,21 @@ jobs:
8484
- run: |
8585
IFS=$'\n\t'
8686
trap -- 's=$?; printf >&2 "%s\n" "${0##*/}:${LINENO}: \`${BASH_COMMAND}\` exit with ${s}"; exit ${s}' ERR
87+
retry() {
88+
for i in {1..10}; do
89+
if "$@"; then
90+
return 0
91+
else
92+
sleep "${i}"
93+
fi
94+
done
95+
"$@"
96+
}
8797
bail() {
8898
printf '::error::%s\n' "$*"
8999
exit 1
90100
}
91-
git fetch origin --tags &>/dev/null
101+
retry git fetch origin --tags &>/dev/null
92102
git checkout "${REF}"
93103
# Make sure the current revision is same as release step.
94104
rev=$(git rev-parse HEAD)

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ target
22
# There is binary in the workspace, but intentionally not committing lockfile.
33
# See https://github.com/taiki-e/cargo-llvm-cov/pull/152#issuecomment-1107055622 for more.
44
Cargo.lock
5+
mutants.out*
56

67
# For platform and editor specific settings, it is recommended to add to
78
# a global .gitignore file.

tools/tidy.sh

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -909,8 +909,21 @@ EOF
909909
JOB_DEFAULT_SHELL="${default_shell}"
910910
fi
911911
for step in $(jq -c '.steps[]' <<<"${job}"); do
912+
uses=''
913+
# https://github.com/vmactions: prepare, run
914+
# https://github.com/cross-platform-actions/action: run, shell
915+
# https://github.com/uraimo/run-on-arch-action: setup, install, run, shell
912916
prepare=''
913-
eval "$(jq -r 'if .run then @sh "RUN=\(.run) shell=\(.shell)" else @sh "RUN=\(.with.run) prepare=\(.with.prepare) shell=\(.with.shell)" end' <<<"${step}")"
917+
setup=''
918+
install=''
919+
eval "$(jq -r 'if .run then @sh "RUN=\(.run) shell=\(.shell)" else @sh "uses=\(.uses) FALLBACK=\(.with.fallback) RUN=\(.with.run) prepare=\(.with.prepare) setup=\(.with.setup) install=\(.with.install) shell=\(.with.shell)" end' <<<"${step}")"
920+
if [[ "${uses}" == */install-action@* ]]; then
921+
if [[ "${FALLBACK}" != 'none' ]]; then
922+
error "'fallback: none' must be set for install-action (${name}.steps[${n}])"
923+
fi
924+
_=$((n++))
925+
continue
926+
fi
914927
if [[ "${RUN}" == 'null' ]]; then
915928
_=$((n++))
916929
continue
@@ -924,8 +937,14 @@ EOF
924937
shell='sh'
925938
fi
926939
fi
927-
shellcheck_for_gha "${RUN}" "${shell}" "${workflow_path} ${name}.steps[${n}].run"
928-
shellcheck_for_gha "${prepare:-null}" 'sh' "${workflow_path} ${name}.steps[${n}].run"
940+
if [[ -z "${uses}" ]]; then
941+
shellcheck_for_gha "${RUN}" "${shell}" "${workflow_path} ${name}.steps[${n}].run"
942+
else
943+
shellcheck_for_gha "${RUN}" "${shell}" "${workflow_path} ${name}.steps[${n}].with.run"
944+
fi
945+
shellcheck_for_gha "${prepare:-null}" 'sh' "${workflow_path} ${name}.steps[${n}].with.prepare"
946+
shellcheck_for_gha "${setup:-null}" "${shell}" "${workflow_path} ${name}.steps[${n}].with.setup"
947+
shellcheck_for_gha "${install:-null}" "${shell}" "${workflow_path} ${name}.steps[${n}].with.install"
929948
_=$((n++))
930949
done
931950
done

0 commit comments

Comments
 (0)