diff --git a/.github/.cspell/project-dictionary.txt b/.github/.cspell/project-dictionary.txt index 40510a10..4fe10761 100644 --- a/.github/.cspell/project-dictionary.txt +++ b/.github/.cspell/project-dictionary.txt @@ -26,4 +26,5 @@ shellcheck shfmt udeps wasmtime +watchexec xscale diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0300e2fe..a33791e2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,21 +29,21 @@ jobs: - ubuntu-20.04 - ubuntu-22.04 tool: - # cargo-watch is supported by cargo-binstall (through quickinstall) + # cargo-watch/watchexec-cli is supported by cargo-binstall (through quickinstall) # TODO: valgrind installation sometime hangs. - - cargo-hack,cargo-llvm-cov,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-udeps,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch,grcov + - cargo-hack,cargo-llvm-cov,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-udeps,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch,grcov,watchexec-cli include: # Note: Specifying the version of valgrind and cargo-binstall is not supported. - os: ubuntu-20.04 - tool: cargo-hack@0.5.24,cargo-llvm-cov@0.5.3,cargo-minimal-versions@0.1.8,cargo-no-dev-deps@0.1.0,parse-changelog@0.5.2,cargo-udeps@0.1.35,cargo-valgrind@2.1.0,cargo-deny@0.13.5,cross@0.2.4,dprint@0.34.1,just@1.9.0,nextest@0.9.11,protoc@3.21.12,shellcheck@0.9.0,shfmt@3.6.0,wasm-pack@0.10.3,wasmtime@4.0.0,mdbook@0.4.25,mdbook-linkcheck@0.7.7,cargo-watch@8.1.1,grcov@0.8.13 + tool: cargo-hack@0.5.24,cargo-llvm-cov@0.5.3,cargo-minimal-versions@0.1.8,cargo-no-dev-deps@0.1.0,parse-changelog@0.5.2,cargo-udeps@0.1.35,cargo-valgrind@2.1.0,cargo-deny@0.13.5,cross@0.2.4,dprint@0.34.1,just@1.9.0,nextest@0.9.11,protoc@3.21.12,shellcheck@0.9.0,shfmt@3.6.0,wasm-pack@0.10.3,wasmtime@4.0.0,mdbook@0.4.25,mdbook-linkcheck@0.7.7,cargo-watch@8.1.1,grcov@0.8.13,watchexec-cli@1.20.5 - os: ubuntu-20.04 - tool: cargo-hack@0.5,cargo-llvm-cov@0.5,cargo-minimal-versions@0.1,cargo-no-dev-deps@0.1,parse-changelog@0.5,cargo-udeps@0.1,cargo-valgrind@2.1,cargo-deny@0.13,cross@0.2,dprint@0.34,just@1.9,nextest@0.9,protoc@3.21,shellcheck@0.9,shfmt@3.5,wasm-pack@0.10,wasmtime@4.0,mdbook@0.4,mdbook-linkcheck@0.7,cargo-watch@8.1,grcov@0.8 + tool: cargo-hack@0.5,cargo-llvm-cov@0.5,cargo-minimal-versions@0.1,cargo-no-dev-deps@0.1,parse-changelog@0.5,cargo-udeps@0.1,cargo-valgrind@2.1,cargo-deny@0.13,cross@0.2,dprint@0.34,just@1.9,nextest@0.9,protoc@3.21,shellcheck@0.9,shfmt@3.5,wasm-pack@0.10,wasmtime@4.0,mdbook@0.4,mdbook-linkcheck@0.7,cargo-watch@8.1,grcov@0.8,watchexec-cli@1.20 - os: ubuntu-20.04 - tool: cargo-valgrind@2,just@1,protoc@3,shfmt@3,wasmtime@4,cargo-watch@8 + tool: cargo-valgrind@2,just@1,protoc@3,shfmt@3,wasmtime@4,cargo-watch@8,watchexec-cli@1 - os: macos-11 - tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-udeps,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch,grcov + tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-udeps,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch,grcov,watchexec-cli - os: windows-2019 - tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-udeps,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch,grcov + tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-udeps,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch,grcov,watchexec-cli runs-on: ${{ matrix.os }} timeout-minutes: 60 steps: @@ -77,20 +77,20 @@ jobs: - rockylinux:8-minimal # glibc 2.28 tool: # valgrind: installing snap to container is difficult... - - cargo-hack,cargo-llvm-cov,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-udeps,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch,grcov + - cargo-hack,cargo-llvm-cov,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-udeps,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch,grcov,watchexec-cli include: - container: ubuntu:22.04 # glibc 2.35 # cargo-udeps depends on openssl 1.1 - tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch,grcov + tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch,grcov,watchexec-cli - container: fedora:latest # glibc 2.36 (as of fedora 37) # cargo-udeps depends on openssl 1.1 - tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch,grcov + tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch,grcov,watchexec-cli - container: centos:7 # glibc 2.17 - # cargo-udeps,protoc,valgrind,wasmtime,mdbook-linkcheck,cargo-watch don't provide prebuilt binaries for musl host. - tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,shellcheck,shfmt,wasm-pack,mdbook,cargo-binstall,grcov + # cargo-udeps,protoc,valgrind,wasmtime,mdbook-linkcheck,cargo-watch don't provide prebuilt binaries for musl or old glibc host. + tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,shellcheck,shfmt,wasm-pack,mdbook,cargo-binstall,grcov,watchexec-cli - container: alpine:latest # musl 1.2.3 (as of alpine 3.17) # cargo-udeps,protoc,valgrind,wasmtime,mdbook-linkcheck,cargo-watch don't provide prebuilt binaries for musl host. - tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,shellcheck,shfmt,wasm-pack,mdbook,cargo-binstall,grcov + tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,shellcheck,shfmt,wasm-pack,mdbook,cargo-binstall,grcov,watchexec-cli runs-on: ubuntu-latest timeout-minutes: 60 container: ${{ matrix.container }} diff --git a/main.sh b/main.sh index db58056c..b0e229b5 100755 --- a/main.sh +++ b/main.sh @@ -241,22 +241,6 @@ install_cargo_binstall() { x cargo binstall -V fi } -cargo_binstall() { - local tool="$1" - local version="$2" - - info "install-action does not support ${tool}, fallback to cargo-binstall" - - install_cargo_binstall - - # By default, cargo-binstall enforce downloads over secure transports only. - # As a result, http will be disabled, and it will also set - # min tls version to be 1.2 - case "${version}" in - latest) cargo binstall --force --no-confirm "${tool}" ;; - *) cargo binstall --force --no-confirm --version "${version}" "${tool}" ;; - esac -} apt_update() { if type -P sudo &>/dev/null; then retry sudo apt-get -o Acquire::Retries=10 -qq update @@ -430,6 +414,7 @@ if ! type -P jq &>/dev/null || ! type -P curl &>/dev/null || ! type -P tar &>/de esac fi +unsupported_tools=() for tool in "${tools[@]}"; do if [[ "${tool}" == *"@"* ]]; then version="${tool#*@}" @@ -443,9 +428,9 @@ for tool in "${tools[@]}"; do else version="latest" fi - info "installing ${tool}@${version}" case "${tool}" in protoc) + info "installing ${tool}@${version}" read_manifest "protoc" "${version}" # Copying files to /usr/local/include requires sudo, so do not use it. bin_dir="${HOME}/.install-action/bin" @@ -480,6 +465,7 @@ for tool in "${tools[@]}"; do rm -rf "${tmp_dir}" ;; valgrind) + info "installing ${tool}@${version}" case "${version}" in latest) ;; *) warn "specifying the version of ${tool} is not supported yet by this action" ;; @@ -496,6 +482,7 @@ for tool in "${tools[@]}"; do snap_install valgrind --classic ;; cargo-binstall) + info "installing ${tool}@${version}" case "${version}" in latest) ;; *) warn "specifying the version of ${tool} is not supported by this action" ;; @@ -512,11 +499,15 @@ for tool in "${tools[@]}"; do # Use cargo-binstall fallback if tool is not available. if [[ ! -f "${manifest_dir}/${tool}.json" ]]; then - cargo_binstall "${tool}" "${version}" - echo + case "${version}" in + latest) unsupported_tools+=("${tool}") ;; + *) unsupported_tools+=("${tool}@${version}") ;; + esac continue fi + info "installing ${tool}@${version}" + # Pre-install case "${tool}" in shellcheck) @@ -543,3 +534,14 @@ for tool in "${tools[@]}"; do esac echo done + +if [[ ${#unsupported_tools[@]} -gt 0 ]]; then + IFS=$',' + info "install-action does not support ${unsupported_tools[*]}; fallback to cargo-binstall" + IFS=$'\n\t' + install_cargo_binstall + # By default, cargo-binstall enforce downloads over secure transports only. + # As a result, http will be disabled, and it will also set + # min tls version to be 1.2 + cargo binstall --force --no-confirm "${unsupported_tools[@]}" +fi