diff --git a/.github/actions/rust-cache/action.yml b/.github/actions/rust-cache/action.yml new file mode 100644 index 00000000000..b05ded8a38b --- /dev/null +++ b/.github/actions/rust-cache/action.yml @@ -0,0 +1,57 @@ +# spell-checker:ignore Swatinem sccache +name: Rust cache +description: Cache Rust dependencies and enable sccache. + +inputs: + key: + description: Cache namespace for compatible jobs and target layouts. + required: false + default: "" + workspaces: + description: Cargo workspaces. + required: false + default: ". -> target" + cache-targets: + description: Cache target directories. + required: false + default: "true" + save-if: + description: Save the cache. + required: false + default: "true" + sccache: + description: Enable sccache. + required: false + default: "true" + +runs: + using: composite + steps: + - name: Cache Rust + uses: Swatinem/rust-cache@v2 + with: + # The workflow supplies an explicit namespace so compatible jobs can + # share a cache without accidentally mixing target directory layouts. + shared-key: ${{ inputs.key }} + workspaces: ${{ inputs.workspaces }} + cache-targets: ${{ inputs.cache-targets }} + save-if: ${{ inputs.save-if == 'true' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} + + - name: Setup sccache + id: sccache-setup + if: inputs.sccache == 'true' + uses: mozilla-actions/sccache-action@v0.0.11 + with: + # sccache v0.17+ expands Rust response files on Windows and can exceed + # Windows' command-line limit. Keep the known-working version until + # https://github.com/mozilla/sccache/issues/2789 is fixed. + version: ${{ runner.os == 'Windows' && 'v0.16.0' || '' }} + continue-on-error: true + + - name: Export sccache + if: inputs.sccache == 'true' && steps.sccache-setup.outcome == 'success' + shell: bash + run: | + echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV" + echo "SCCACHE_GHA_ENABLED=true" >> "$GITHUB_ENV" + echo "SCCACHE_GHA_RW_MODE=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && 'READ_WRITE' || 'READ_ONLY' }}" >> "$GITHUB_ENV" diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 055c8b7dd6e..f2f5af69448 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -30,7 +30,7 @@ permissions: # End the current execution if there is a new changeset in the PR. concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + cancel-in-progress: ${{ github.ref_type != 'tag' && github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }} jobs: cargo-deny: @@ -48,6 +48,7 @@ jobs: runs-on: ${{ matrix.job.os }} strategy: fail-fast: false + max-parallel: 2 matrix: job: # note: `cargo-udeps` panics when processing stdbuf/libstdbuf ("uu_stdbuf_libstdbuf"); either b/c of the 'cpp' crate or 'libstdbuf' itself @@ -60,7 +61,10 @@ jobs: with: persist-credentials: false - uses: taiki-e/install-action@cargo-udeps - - uses: Swatinem/rust-cache@v2 + - uses: ./.github/actions/rust-cache + with: + key: deps-${{ matrix.job.os }}-${{ matrix.job.features }} + sccache: false - name: Initialize workflow variables id: vars shell: bash @@ -108,16 +112,9 @@ jobs: - uses: actions/checkout@v7.0.1 with: persist-credentials: false - - uses: Swatinem/rust-cache@v2 - - name: Run sccache-cache - id: sccache-setup - uses: mozilla-actions/sccache-action@v0.0.11 - continue-on-error: true - - name: Export sccache - if: steps.sccache-setup.outcome == 'success' - run: | - echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV - echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV + - uses: ./.github/actions/rust-cache + with: + key: docs-${{ matrix.job.os }}-${{ matrix.job.features }} - name: Install/setup prerequisites shell: bash run: | @@ -155,6 +152,7 @@ jobs: name: MinRustV # Minimum supported rust version (aka, MinSRV or MSRV) runs-on: ${{ matrix.job.os }} strategy: + max-parallel: 2 matrix: job: - { os: ubuntu-latest , features: feat_os_unix } @@ -169,16 +167,9 @@ jobs: toolchain: ${{ env.RUST_MIN_SRV }} components: rustfmt - uses: taiki-e/install-action@nextest - - uses: Swatinem/rust-cache@v2 - - name: Run sccache-cache - id: sccache-setup - uses: mozilla-actions/sccache-action@v0.0.11 - continue-on-error: true - - name: Export sccache - if: steps.sccache-setup.outcome == 'success' - run: | - echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV - echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV + - uses: ./.github/actions/rust-cache + with: + key: msrv-${{ matrix.job.features }} - name: Initialize workflow variables id: vars shell: bash @@ -250,12 +241,7 @@ jobs: deps: name: Dependencies - runs-on: ${{ matrix.job.os }} - strategy: - fail-fast: false - matrix: - job: - - { os: ubuntu-latest , features: feat_os_unix } + runs-on: ubuntu-latest steps: - uses: actions/checkout@v7.0.1 with: @@ -278,6 +264,7 @@ jobs: timeout-minutes: 90 strategy: fail-fast: false + max-parallel: 2 matrix: job: - { os: ubuntu-latest , name: feat_os_unix , features: feat_os_unix } @@ -291,16 +278,9 @@ jobs: persist-credentials: false - uses: dtolnay/rust-toolchain@stable - uses: taiki-e/install-action@nextest - - uses: Swatinem/rust-cache@v2 - - name: Run sccache-cache - id: sccache-setup - uses: mozilla-actions/sccache-action@v0.0.11 - continue-on-error: true - - name: Export sccache - if: steps.sccache-setup.outcome == 'success' - run: | - echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV - echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV + - uses: ./.github/actions/rust-cache + with: + key: stable-${{ matrix.job.os }}-${{ matrix.job.features }} - name: Test run: cargo nextest run --hide-progress-bar --profile ci --features ${{ matrix.job.features }} env: @@ -323,6 +303,7 @@ jobs: timeout-minutes: 90 strategy: fail-fast: false + max-parallel: 2 matrix: job: - { os: ubuntu-latest , features: feat_os_unix } @@ -334,16 +315,9 @@ jobs: persist-credentials: false - uses: dtolnay/rust-toolchain@nightly - uses: taiki-e/install-action@nextest - - uses: Swatinem/rust-cache@v2 - - name: Run sccache-cache - id: sccache-setup - uses: mozilla-actions/sccache-action@v0.0.11 - continue-on-error: true - - name: Export sccache - if: steps.sccache-setup.outcome == 'success' - run: | - echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV - echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV + - uses: ./.github/actions/rust-cache + with: + key: nightly-${{ matrix.job.os }}-${{ matrix.job.features }} - name: Test run: cargo nextest run --hide-progress-bar --profile ci --features ${{ matrix.job.features }} env: @@ -421,18 +395,11 @@ jobs: with: toolchain: ${{ env.RUST_MIN_SRV }} targets: ${{ matrix.job.target }} - - uses: Swatinem/rust-cache@v2 + - uses: ./.github/actions/rust-cache with: - key: "${{ matrix.job.os }}_${{ matrix.job.target }}" - - name: Run sccache-cache - id: sccache-setup - uses: mozilla-actions/sccache-action@v0.0.11 - continue-on-error: true - - name: Export sccache - if: steps.sccache-setup.outcome == 'success' - run: | - echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV - echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV + # These jobs pass --target explicitly, so keep their target/ + # cache separate from the implicit-host target/debug caches above. + key: build-${{ matrix.job.os }}-${{ matrix.job.target }}-${{ matrix.job.features }}-${{ matrix.job.default-features }}-${{ matrix.job.use-cross }} - name: Initialize workflow variables id: vars shell: bash @@ -751,16 +718,9 @@ jobs: - uses: taiki-e/install-action@v2 with: tool: nextest,grcov@0.8.24 - - uses: Swatinem/rust-cache@v2 - - name: Run sccache-cache - id: sccache-setup - uses: mozilla-actions/sccache-action@v0.0.11 - continue-on-error: true - - name: Export sccache - if: steps.sccache-setup.outcome == 'success' - run: | - echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV - echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV + - uses: ./.github/actions/rust-cache + with: + key: coverage-${{ matrix.job.os }}-${{ matrix.job.features }} # - name: Reattach HEAD ## may be needed for accurate code coverage info # run: git checkout ${{ github.head_ref }} @@ -874,16 +834,9 @@ jobs: with: persist-credentials: false - uses: taiki-e/install-action@nextest - - uses: Swatinem/rust-cache@v2 - - name: Run sccache-cache - id: sccache-setup - uses: mozilla-actions/sccache-action@v0.0.11 - continue-on-error: true - - name: Export sccache - if: steps.sccache-setup.outcome == 'success' - run: | - echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV - echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV + - uses: ./.github/actions/rust-cache + with: + key: openssl-${{ matrix.job.os }}-${{ matrix.job.features }} - name: Test checksum utilities with OpenSSL (system / dynamic) shell: bash env: @@ -903,16 +856,9 @@ jobs: with: persist-credentials: false - uses: taiki-e/install-action@nextest - - uses: Swatinem/rust-cache@v2 - - name: Run sccache-cache - id: sccache-setup - uses: mozilla-actions/sccache-action@v0.0.11 - continue-on-error: true - - name: Export sccache - if: steps.sccache-setup.outcome == 'success' - run: | - echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV - echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV + - uses: ./.github/actions/rust-cache + with: + key: no-diagnostics # The caret diagnostics (`feat_diagnostics`) are on by default; packagers # who want the smaller dependency tree build with them off, so that build # must stay green. The caret snapshot tests are gated on the feature and @@ -947,8 +893,9 @@ jobs: - name: Setup Lima uses: lima-vm/lima-actions/setup@v1 id: lima-actions-setup - - name: Cache ~/.cache/lima - uses: actions/cache@v6 + - name: Restore Lima cache + id: lima-cache + uses: actions/cache/restore@v6 with: path: ~/.cache/lima key: lima-${{ steps.lima-actions-setup.outputs.version }} @@ -968,6 +915,12 @@ jobs: lima bash -c "cd work && cargo test --features 'feat_selinux' --no-default-features" - name: Lint with SELinux run: lima bash -c "cd work && cargo clippy --all-targets --features 'feat_selinux' --no-default-features -- -D warnings" + - name: Save Lima cache + if: steps.lima-cache.outputs.cache-hit != 'true' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch) + uses: actions/cache/save@v6 + with: + path: ~/.cache/lima + key: lima-${{ steps.lima-actions-setup.outputs.version }} test_safe_traversal: name: Safe Traversal Security Check @@ -978,7 +931,10 @@ jobs: - uses: actions/checkout@v7.0.1 with: persist-credentials: false - - uses: Swatinem/rust-cache@v2 + - uses: ./.github/actions/rust-cache + with: + key: safe-traversal + sccache: false - name: Install strace and libselinux headers (needed to build chcon) run: sudo apt-get update && sudo apt-get install -y strace libselinux1-dev - name: Build utilities with safe traversal @@ -995,7 +951,10 @@ jobs: - uses: actions/checkout@v7.0.1 with: persist-credentials: false - - uses: Swatinem/rust-cache@v2 + - uses: ./.github/actions/rust-cache + with: + key: libc-interposition + sccache: false - name: Install fakeroot run: sudo apt-get update && sudo apt-get install -y fakeroot - name: Build utilities that must stay interposable @@ -1012,7 +971,10 @@ jobs: - uses: actions/checkout@v7.0.1 with: persist-credentials: false - - uses: Swatinem/rust-cache@v2 + - uses: ./.github/actions/rust-cache + with: + key: open-once + sccache: false - name: Install strace run: sudo apt-get update && sudo apt-get install -y strace - name: Build utilities for redundant open checks @@ -1029,7 +991,10 @@ jobs: - uses: actions/checkout@v7.0.1 with: persist-credentials: false - - uses: Swatinem/rust-cache@v2 + - uses: ./.github/actions/rust-cache + with: + key: toctou + sccache: false - name: Install strace run: sudo apt-get update && sudo apt-get install -y strace - name: Build utilities for TOCTOU checks diff --git a/.github/workflows/CheckScripts.yml b/.github/workflows/CheckScripts.yml index da5cf71f393..6803f2d753f 100644 --- a/.github/workflows/CheckScripts.yml +++ b/.github/workflows/CheckScripts.yml @@ -20,7 +20,7 @@ on: # End the current execution if there is a new changeset in the PR. concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + cancel-in-progress: ${{ github.ref_type != 'tag' && github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }} jobs: shell_check: diff --git a/.github/workflows/FixPR.yml b/.github/workflows/FixPR.yml index f767c75b061..7e7b89ab741 100644 --- a/.github/workflows/FixPR.yml +++ b/.github/workflows/FixPR.yml @@ -13,7 +13,7 @@ permissions: # End the current execution if there is a new changeset in the PR. concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + cancel-in-progress: ${{ github.ref_type != 'tag' && github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }} on: # * only trigger on pull request closed to specific branches @@ -28,11 +28,7 @@ jobs: # Refresh dependencies (ie, 'Cargo.lock') and show updated dependency tree if: github.event.pull_request.merged == true ## only for PR merges name: Update/dependencies - runs-on: ${{ matrix.job.os }} - strategy: - matrix: - job: - - { os: ubuntu-latest , features: feat_os_unix } + runs-on: ubuntu-latest steps: - uses: actions/checkout@v7.0.1 with: @@ -47,7 +43,10 @@ jobs: - uses: dtolnay/rust-toolchain@master with: toolchain: ${{ steps.vars.outputs.RUST_MIN_SRV }} - - uses: Swatinem/rust-cache@v2 + - uses: ./.github/actions/rust-cache + with: + key: fix-pr-msrv + sccache: false - name: Ensure updated 'Cargo.lock' shell: bash run: | @@ -75,7 +74,7 @@ jobs: echo "## dependency list" cargo fetch --locked --quiet --target $(rustc --print host-tuple) ## * using the 'stable' toolchain is necessary to avoid "unexpected '--filter-platform'" errors - cargo +stable tree --locked --no-dedupe -e=no-dev --prefix=none --features ${{ matrix.job.features }} | grep -vE "$PWD" | sort --unique + cargo +stable tree --locked --no-dedupe -e=no-dev --prefix=none --features feat_os_unix | grep -vE "$PWD" | sort --unique - name: Commit any changes (to '${{ env.BRANCH_TARGET }}') uses: EndBug/add-and-commit@v11 with: diff --git a/.github/workflows/GnuTests.yml b/.github/workflows/GnuTests.yml index 0c037688f5b..54695af2ce7 100644 --- a/.github/workflows/GnuTests.yml +++ b/.github/workflows/GnuTests.yml @@ -23,7 +23,7 @@ permissions: # End the current execution if there is a new changeset in the PR. concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + cancel-in-progress: ${{ github.ref_type != 'tag' && github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }} env: DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} @@ -48,9 +48,11 @@ jobs: with: path: 'uutils' persist-credentials: false - - uses: Swatinem/rust-cache@v2 + - uses: ./uutils/.github/actions/rust-cache with: workspaces: "./uutils -> target" + key: gnu-native + sccache: false - name: Checkout code (GNU coreutils) run: (mkdir -p gnu && cd gnu && bash ../uutils/util/fetch-gnu.sh) #### Build environment setup @@ -203,8 +205,9 @@ jobs: - name: Setup Lima uses: lima-vm/lima-actions/setup@v1 id: lima-actions-setup - - name: Cache ~/.cache/lima - uses: actions/cache@v6 + - name: Restore Lima cache + id: lima-cache + uses: actions/cache/restore@v6 with: path: ~/.cache/lima key: lima-${{ steps.lima-actions-setup.outputs.version }} @@ -296,6 +299,12 @@ jobs: path: | gnu/tests-selinux/*.log gnu/tests-selinux/*/*.log.gz + - name: Save Lima cache + if: steps.lima-cache.outputs.cache-hit != 'true' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch) + uses: actions/cache/save@v6 + with: + path: ~/.cache/lima + key: lima-${{ steps.lima-actions-setup.outputs.version }} qemu: name: Run GNU tests (SMACK/ROOTFS) @@ -306,9 +315,11 @@ jobs: with: path: 'uutils' persist-credentials: false - - uses: Swatinem/rust-cache@v2 + - uses: ./uutils/.github/actions/rust-cache with: workspaces: "./uutils -> target" + key: gnu-qemu + sccache: false - name: Checkout code (GNU coreutils) run: (mkdir -p gnu && cd gnu && bash ../uutils/util/fetch-gnu.sh) - name: Install dependencies diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 49f8c724649..a4c9ecc92f2 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -17,7 +17,7 @@ permissions: # End the current execution if there is a new changeset in the PR. concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + cancel-in-progress: ${{ github.ref_type != 'tag' && github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }} env: TERMUX: v0.118.0 @@ -141,7 +141,7 @@ jobs: script: | util/android-commands.sh init "${{ matrix.arch }}" "${{ matrix.api-level }}" "${{ env.TERMUX }}" - name: Save AVD cache - if: steps.avd-cache.outputs.cache-hit != 'true' + if: steps.avd-cache.outputs.cache-hit != 'true' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch) uses: actions/cache/save@v6 with: path: | @@ -161,9 +161,9 @@ jobs: uses: actions/cache/restore@v6 with: path: ~/__rust_cache__ - # The version vX at the end of the key is just a development version to avoid conflicts in - # the github cache during the development of this workflow key: ${{ matrix.arch }}_${{ matrix.target}}_${{ steps.read_rustc_hash.outputs.content }}_${{ hashFiles('**/Cargo.toml', '**/Cargo.lock') }}_v3 + restore-keys: | + ${{ matrix.arch }}_${{ matrix.target}}_${{ steps.read_rustc_hash.outputs.content }}_ - name: Collect information about runner resources if: always() continue-on-error: true @@ -199,7 +199,7 @@ jobs: free -mh df -Th - name: Save rust cache - if: steps.rust-cache.outputs.cache-hit != 'true' + if: steps.rust-cache.outputs.cache-hit != 'true' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch) uses: actions/cache/save@v6 with: path: ~/__rust_cache__ diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index 4a7b3a213a0..36e80ef87f7 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -11,6 +11,7 @@ on: - 'src/uucore_procs/**' - 'Cargo.toml' - 'Cargo.lock' + - '.github/actions/rust-cache/action.yml' push: branches: - main @@ -22,7 +23,7 @@ permissions: # End the current execution if there is a new changeset in the PR. concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + cancel-in-progress: ${{ github.ref_type != 'tag' && github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }} jobs: detects-benchmarks: @@ -66,15 +67,15 @@ jobs: benchmarks: needs: detects-benchmarks if: needs.detects-benchmarks.outputs.package != '[]' - name: Run ${{ matrix.type }} benchmarks for ${{ matrix.package }} (CodSpeed) + # GitHub appends matrix values to expanded jobs but leaves skipped job + # names unevaluated, so keep the base name free of matrix expressions. + name: Run CodSpeed benchmarks runs-on: ubuntu-latest timeout-minutes: 90 env: CARGO_INCREMENTAL: 0 strategy: - # Stagger the jobs: 70 concurrent runners hitting the GitHub cache API - # (rust-cache + sccache + CodSpeed) at once triggers HTTP 429s. - max-parallel: 12 + max-parallel: 8 matrix: type: [simulation, memory] package: ${{ fromJson(needs.detects-benchmarks.outputs.package) }} @@ -83,17 +84,9 @@ jobs: with: persist-credentials: false - - uses: Swatinem/rust-cache@v2 - - - name: Run sccache-cache - id: sccache-setup - uses: mozilla-actions/sccache-action@v0.0.11 - continue-on-error: true - - name: Export sccache - if: steps.sccache-setup.outcome == 'success' - run: | - echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV - echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV + - uses: ./.github/actions/rust-cache + with: + key: bench-${{ matrix.package }}-${{ matrix.type }} - name: Install locales shell: bash diff --git a/.github/workflows/check-toml.yml b/.github/workflows/check-toml.yml index 3f0d532c62c..01e99736607 100644 --- a/.github/workflows/check-toml.yml +++ b/.github/workflows/check-toml.yml @@ -17,7 +17,7 @@ permissions: # End the current execution if there is a new changeset in the PR. concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + cancel-in-progress: ${{ github.ref_type != 'tag' && github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }} jobs: check: diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index 78dd7aa91f6..26560da5ff3 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -20,18 +20,13 @@ permissions: # End the current execution if there is a new changeset in the PR. concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + cancel-in-progress: ${{ github.ref_type != 'tag' && github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }} jobs: style_format: name: Style/format - runs-on: ${{ matrix.job.os }} - strategy: - fail-fast: false - matrix: - job: - - { os: ubuntu-latest , features: feat_os_unix } + runs-on: ubuntu-latest steps: - uses: actions/checkout@v7.0.1 with: @@ -69,6 +64,7 @@ jobs: runs-on: ${{ matrix.job.os }} strategy: fail-fast: false + max-parallel: 4 matrix: job: - { os: ubuntu-latest , features: all , workspace: true } @@ -86,16 +82,9 @@ jobs: toolchain: stable components: clippy targets: ${{ matrix.job.target || '' }} - - uses: Swatinem/rust-cache@v2 - - name: Run sccache-cache - id: sccache-setup - uses: mozilla-actions/sccache-action@v0.0.11 - continue-on-error: true - - name: Export sccache - if: steps.sccache-setup.outcome == 'success' - run: | - echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV - echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV + - uses: ./.github/actions/rust-cache + with: + key: clippy-${{ matrix.job.os }}-${{ matrix.job.target || 'host' }}-${{ matrix.job.features }} - name: Initialize workflow variables id: vars shell: bash @@ -150,16 +139,12 @@ jobs: style_spellcheck: name: Style/spelling - runs-on: ${{ matrix.job.os }} + runs-on: ubuntu-latest env: # Spelling is enforced locally by the cspell pre-commit hook, where it is # cheap to fix. Here it is advisory: unknown words show up as annotations # on the diff instead of blocking the merge. STYLE_FAIL_ON_FAULT: false - strategy: - matrix: - job: - - { os: ubuntu-latest , features: feat_os_unix } steps: - uses: actions/checkout@v7.0.1 with: @@ -243,14 +228,12 @@ jobs: with: persist-credentials: false - - name: Cache Rust dependencies - uses: Swatinem/rust-cache@v2 - - name: Install prek run: pip install prek - - name: Cache prek environments - uses: actions/cache@v6 + - name: Restore prek environments + id: prek-cache + uses: actions/cache/restore@v6 with: path: ~/.cache/prek key: prek-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }} @@ -263,3 +246,10 @@ jobs: # hooks are already covered by the Style/format and Style/lint jobs. SKIP: cspell,rust-linting,rust-clippy,cargo-lock-check run: prek run --all-files --show-diff-on-failure + + - name: Save prek environments + if: steps.prek-cache.outputs.cache-hit != 'true' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch) + uses: actions/cache/save@v6 + with: + path: ~/.cache/prek + key: prek-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }} diff --git a/.github/workflows/copilot-code-review.yml b/.github/workflows/copilot-code-review.yml index f6c5fdb4966..251a744404d 100644 --- a/.github/workflows/copilot-code-review.yml +++ b/.github/workflows/copilot-code-review.yml @@ -1,4 +1,3 @@ -# spell-checker:ignore Swatinem name: Copilot Code Review # Declares the runner used by Copilot code review. Without this file, the @@ -8,6 +7,7 @@ on: pull_request: paths: - .github/workflows/copilot-code-review.yml + - .github/actions/rust-cache/action.yml permissions: contents: read @@ -20,4 +20,7 @@ jobs: - uses: actions/checkout@v7.0.1 with: persist-credentials: false - - uses: Swatinem/rust-cache@v2 + - uses: ./.github/actions/rust-cache + with: + key: copilot + sccache: false diff --git a/.github/workflows/devcontainer.yml b/.github/workflows/devcontainer.yml index 4c95a7f4389..fac3ad69491 100644 --- a/.github/workflows/devcontainer.yml +++ b/.github/workflows/devcontainer.yml @@ -14,7 +14,7 @@ permissions: # End the current execution if there is a new changeset in the PR. concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + cancel-in-progress: ${{ github.ref_type != 'tag' && github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }} jobs: test: diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 10f1c98aff3..fdba5d43ae0 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -8,6 +8,7 @@ on: - 'src/bin/uudoc.rs' - 'src/uu/*/locales/en-US.ftl' - 'Cargo.toml' + - '.github/actions/rust-cache/action.yml' - '.github/workflows/documentation.yml' push: branches: @@ -16,6 +17,7 @@ on: - 'src/bin/uudoc.rs' - 'src/uu/*/locales/en-US.ftl' - 'Cargo.toml' + - '.github/actions/rust-cache/action.yml' permissions: contents: read @@ -23,7 +25,7 @@ permissions: # End the current execution if there is a new changeset in the PR. concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + cancel-in-progress: ${{ github.ref_type != 'tag' && github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }} jobs: check-doc: @@ -36,6 +38,10 @@ jobs: with: persist-credentials: false + - uses: ./.github/actions/rust-cache + with: + key: documentation + - name: Install/setup prerequisites shell: bash run: sudo apt-get -y update ; sudo apt-get -y install libselinux1-dev libsystemd-dev libacl1-dev libattr1-dev libcap-dev diff --git a/.github/workflows/freebsd.yml b/.github/workflows/freebsd.yml index c4b0f234de1..f00d7ae8e2f 100644 --- a/.github/workflows/freebsd.yml +++ b/.github/workflows/freebsd.yml @@ -18,7 +18,7 @@ permissions: # End the current execution if there is a new changeset in the PR. concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + cancel-in-progress: ${{ github.ref_type != 'tag' && github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }} jobs: style: @@ -43,6 +43,7 @@ jobs: run: | echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV + echo "SCCACHE_GHA_RW_MODE=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && 'READ_WRITE' || 'READ_ONLY' }}" >> $GITHUB_ENV - uses: mlugg/setup-zig@v2.2.1 - uses: taiki-e/install-action@cargo-zigbuild - name: cargo clippy diff --git a/.github/workflows/fuzzing.yml b/.github/workflows/fuzzing.yml index 3d9f1b4c854..7e871ae7a58 100644 --- a/.github/workflows/fuzzing.yml +++ b/.github/workflows/fuzzing.yml @@ -16,6 +16,7 @@ on: - 'src/uucore_procs/**' - 'Cargo.toml' - 'Cargo.lock' + - '.github/actions/rust-cache/action.yml' - '.github/workflows/fuzzing.yml' push: branches: @@ -28,7 +29,7 @@ permissions: # End the current execution if there is a new changeset in the PR. concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + cancel-in-progress: ${{ github.ref_type != 'tag' && github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }} jobs: detect: @@ -119,9 +120,11 @@ jobs: - uses: actions/checkout@v7.0.1 with: persist-credentials: false - - uses: Swatinem/rust-cache@v2 + - uses: ./.github/actions/rust-cache with: workspaces: "fuzz -> target" + key: fuzz-examples + sccache: false - name: fetch gnu-coreutils .deb run: | curl -fsSL --retry 2 -o coreutils.deb ${GNU_COREUTILS_DEB_URL} @@ -166,9 +169,11 @@ jobs: uses: taiki-e/install-action@v2 with: tool: cargo-fuzz - - uses: Swatinem/rust-cache@v2 + - uses: ./.github/actions/rust-cache with: workspaces: "fuzz -> target" + key: fuzz-build + sccache: false - name: Emulate a nightly toolchain run: | echo "RUSTC_BOOTSTRAP=1" >> "${GITHUB_ENV}" @@ -188,7 +193,7 @@ jobs: strategy: fail-fast: false # Stagger the jobs: all the targets at once hammer the GitHub cache API. - max-parallel: 10 + max-parallel: 6 matrix: target: ${{ fromJson(needs.detect.outputs.targets) }} @@ -209,9 +214,12 @@ jobs: uses: taiki-e/install-action@v2 with: tool: cargo-fuzz - - uses: Swatinem/rust-cache@v2 + - uses: ./.github/actions/rust-cache with: workspaces: "fuzz -> target" + key: fuzz-build + save-if: false + sccache: false - name: Emulate a nightly toolchain run: | echo "RUSTC_BOOTSTRAP=1" >> "${GITHUB_ENV}" diff --git a/.github/workflows/l10n.yml b/.github/workflows/l10n.yml index e5bdb91ca4b..7dccd3ac54f 100644 --- a/.github/workflows/l10n.yml +++ b/.github/workflows/l10n.yml @@ -19,7 +19,7 @@ permissions: # End the current execution if there is a new changeset in the PR. concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + cancel-in-progress: ${{ github.ref_type != 'tag' && github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }} jobs: @@ -28,6 +28,7 @@ jobs: runs-on: ${{ matrix.job.os }} strategy: fail-fast: false + max-parallel: 2 matrix: job: - { os: ubuntu-latest , features: "feat_os_unix" } @@ -38,16 +39,9 @@ jobs: with: persist-credentials: false - uses: taiki-e/install-action@nextest - - uses: Swatinem/rust-cache@v2 - - name: Run sccache-cache - id: sccache-setup - uses: mozilla-actions/sccache-action@v0.0.11 - continue-on-error: true - - name: Export sccache - if: steps.sccache-setup.outcome == 'success' - run: | - echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV - echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV + - uses: ./.github/actions/rust-cache + with: + key: l10n-${{ github.job }}-${{ matrix.job.os }}-${{ matrix.job.features }} - name: Install/setup prerequisites shell: bash run: | @@ -134,16 +128,9 @@ jobs: - uses: actions/checkout@v7.0.1 with: persist-credentials: false - - uses: Swatinem/rust-cache@v2 - - name: Run sccache-cache - id: sccache-setup - uses: mozilla-actions/sccache-action@v0.0.11 - continue-on-error: true - - name: Export sccache - if: steps.sccache-setup.outcome == 'success' - run: | - echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV - echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV + - uses: ./.github/actions/rust-cache + with: + key: l10n-${{ github.job }} - name: Install/setup prerequisites shell: bash run: | @@ -297,16 +284,9 @@ jobs: - uses: actions/checkout@v7.0.1 with: persist-credentials: false - - uses: Swatinem/rust-cache@v2 - - name: Run sccache-cache - id: sccache-setup - uses: mozilla-actions/sccache-action@v0.0.11 - continue-on-error: true - - name: Export sccache - if: steps.sccache-setup.outcome == 'success' - run: | - echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV - echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV + - uses: ./.github/actions/rust-cache + with: + key: l10n-${{ github.job }} - name: Install/setup prerequisites shell: bash run: | @@ -400,6 +380,7 @@ jobs: runs-on: ${{ matrix.job.os }} strategy: fail-fast: false + max-parallel: 2 matrix: job: - { os: ubuntu-latest , features: "feat_os_unix" } @@ -408,16 +389,9 @@ jobs: - uses: actions/checkout@v7.0.1 with: persist-credentials: false - - uses: Swatinem/rust-cache@v2 - - name: Run sccache-cache - id: sccache-setup - uses: mozilla-actions/sccache-action@v0.0.11 - continue-on-error: true - - name: Export sccache - if: steps.sccache-setup.outcome == 'success' - run: | - echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV - echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV + - uses: ./.github/actions/rust-cache + with: + key: l10n-${{ github.job }}-${{ matrix.job.os }}-${{ matrix.job.features }} - name: Install/setup prerequisites shell: bash run: | @@ -550,6 +524,7 @@ jobs: runs-on: ${{ matrix.job.os }} strategy: fail-fast: false + max-parallel: 2 matrix: job: - { os: ubuntu-latest , features: "feat_os_unix" } @@ -558,16 +533,9 @@ jobs: - uses: actions/checkout@v7.0.1 with: persist-credentials: false - - uses: Swatinem/rust-cache@v2 - - name: Run sccache-cache - id: sccache-setup - uses: mozilla-actions/sccache-action@v0.0.11 - continue-on-error: true - - name: Export sccache - if: steps.sccache-setup.outcome == 'success' - run: | - echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV - echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV + - uses: ./.github/actions/rust-cache + with: + key: l10n-${{ github.job }}-${{ matrix.job.os }}-${{ matrix.job.features }} - name: Install/setup prerequisites shell: bash run: | @@ -889,16 +857,9 @@ jobs: - uses: actions/checkout@v7.0.1 with: persist-credentials: false - - uses: Swatinem/rust-cache@v2 - - name: Run sccache-cache - id: sccache-setup - uses: mozilla-actions/sccache-action@v0.0.11 - continue-on-error: true - - name: Export sccache - if: steps.sccache-setup.outcome == 'success' - run: | - echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV - echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV + - uses: ./.github/actions/rust-cache + with: + key: l10n-${{ github.job }} - name: Install/setup prerequisites shell: bash run: | @@ -1121,16 +1082,9 @@ jobs: - uses: actions/checkout@v7.0.1 with: persist-credentials: false - - uses: Swatinem/rust-cache@v2 - - name: Run sccache-cache - id: sccache-setup - uses: mozilla-actions/sccache-action@v0.0.11 - continue-on-error: true - - name: Export sccache - if: steps.sccache-setup.outcome == 'success' - run: | - echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV - echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV + - uses: ./.github/actions/rust-cache + with: + key: l10n-${{ github.job }} - name: Install/setup prerequisites shell: bash run: | @@ -1147,10 +1101,10 @@ jobs: - uses: actions/checkout@v7.0.1 with: persist-credentials: false - - uses: Swatinem/rust-cache@v2 + - uses: ./.github/actions/rust-cache with: - # Use different cache key for each build to avoid conflicts key: cat-locale-embedding + sccache: false - name: Install prerequisites run: sudo apt-get -y update && sudo apt-get -y install libselinux1-dev - name: Build cat with targeted locale embedding @@ -1178,10 +1132,10 @@ jobs: - uses: actions/checkout@v7.0.1 with: persist-credentials: false - - uses: Swatinem/rust-cache@v2 + - uses: ./.github/actions/rust-cache with: - # Use different cache key for each build to avoid conflicts key: ls-locale-embedding + sccache: false - name: Install prerequisites run: sudo apt-get -y update && sudo apt-get -y install libselinux1-dev - name: Build ls with targeted locale embedding @@ -1209,10 +1163,10 @@ jobs: - uses: actions/checkout@v7.0.1 with: persist-credentials: false - - uses: Swatinem/rust-cache@v2 + - uses: ./.github/actions/rust-cache with: - # Use different cache key for each build to avoid conflicts key: multicall-locale-embedding + sccache: false - name: Install prerequisites run: sudo apt-get -y update && sudo apt-get -y install libselinux1-dev - name: Build multicall binary with all locales @@ -1242,18 +1196,9 @@ jobs: - uses: actions/checkout@v7.0.1 with: persist-credentials: false - - uses: Swatinem/rust-cache@v2 + - uses: ./.github/actions/rust-cache with: key: cargo-install-locale-embedding - - name: Run sccache-cache - id: sccache-setup - uses: mozilla-actions/sccache-action@v0.0.11 - continue-on-error: true - - name: Export sccache - if: steps.sccache-setup.outcome == 'success' - run: | - echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV - echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV - name: Install prerequisites run: | sudo apt-get -y update diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml index 753601bbb45..b1dba0283e0 100644 --- a/.github/workflows/make.yml +++ b/.github/workflows/make.yml @@ -28,7 +28,7 @@ permissions: # End the current execution if there is a new changeset in the PR. concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + cancel-in-progress: ${{ github.ref_type != 'tag' && github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }} jobs: build_makefile: @@ -38,28 +38,16 @@ jobs: RUSTFLAGS: "-C force-unwind-tables=no -C strip=symbols -Clink-arg=-z -Clink-arg=pack-relative-relocs" permissions: contents: write # Publish individual binaries - runs-on: ${{ matrix.job.os }} - strategy: - fail-fast: false - matrix: - job: - - { os: ubuntu-latest , features: feat_os_unix } + runs-on: ubuntu-latest steps: - uses: actions/checkout@v7.0.1 with: persist-credentials: false - uses: taiki-e/install-action@nextest - - uses: Swatinem/rust-cache@v2 + - uses: ./.github/actions/rust-cache + with: + key: make-linux # Test build on the system missing libselinux (don't install libselinux1-dev at here) - - name: Run sccache-cache - id: sccache-setup - uses: mozilla-actions/sccache-action@v0.0.11 - continue-on-error: true - - name: Export sccache - if: steps.sccache-setup.outcome == 'success' - run: | - echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV - echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV - name: "`make build`" # Also check that target/CACHEDIR.TAG is created on a fresh checkout shell: bash @@ -268,29 +256,18 @@ jobs: name: Build MSYS permissions: contents: write # Publish cygwin binary - runs-on: ${{ matrix.job.os }} + runs-on: windows-latest env: CARGO_INCREMENTAL: 0 RUSTFLAGS: "-C link-arg=-Wl,--dynamicbase -C link-arg=-Wl,--enable-auto-image-base" - strategy: - fail-fast: false - matrix: - job: - - { os: windows-latest , features: feat_os_windows } steps: - uses: actions/checkout@v7.0.1 with: persist-credentials: false - - uses: Swatinem/rust-cache@v2 - - name: Run sccache-cache - id: sccache-setup - uses: mozilla-actions/sccache-action@v0.0.11 - continue-on-error: true - - name: Export sccache - if: steps.sccache-setup.outcome == 'success' - run: | - echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV - echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV + - uses: ./.github/actions/rust-cache + with: + key: make-msys + sccache: false - name: Disable Mandatory ASLR (required for Cygwin/MSYS2 bash on GitHub runners) shell: powershell run: | @@ -377,12 +354,7 @@ jobs: test_busybox: name: Tests/BusyBox test suite - runs-on: ${{ matrix.job.os }} - strategy: - fail-fast: false - matrix: - job: - - { os: ubuntu-latest } + runs-on: ubuntu-latest steps: - name: Initialize workflow variables id: vars @@ -393,16 +365,9 @@ jobs: - uses: actions/checkout@v7.0.1 with: persist-credentials: false - - uses: Swatinem/rust-cache@v2 - - name: Run sccache-cache - id: sccache-setup - uses: mozilla-actions/sccache-action@v0.0.11 - continue-on-error: true - - name: Export sccache - if: steps.sccache-setup.outcome == 'success' - run: | - echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV - echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV + - uses: ./.github/actions/rust-cache + with: + key: busybox - name: Install/setup prerequisites shell: bash run: | @@ -461,12 +426,7 @@ jobs: test_toybox: name: Tests/Toybox test suite - runs-on: ${{ matrix.job.os }} - strategy: - fail-fast: false - matrix: - job: - - { os: ubuntu-latest } + runs-on: ubuntu-latest steps: - name: Initialize workflow variables id: vars @@ -479,16 +439,9 @@ jobs: - uses: actions/checkout@v7.0.1 with: persist-credentials: false - - uses: Swatinem/rust-cache@v2 - - name: Run sccache-cache - id: sccache-setup - uses: mozilla-actions/sccache-action@v0.0.11 - continue-on-error: true - - name: Export sccache - if: steps.sccache-setup.outcome == 'success' - run: | - echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV - echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV + - uses: ./.github/actions/rust-cache + with: + key: toybox - name: Install/setup prerequisites shell: bash run: | diff --git a/.github/workflows/manpage-lint.yml b/.github/workflows/manpage-lint.yml index 7825ca32038..c34095ca69d 100644 --- a/.github/workflows/manpage-lint.yml +++ b/.github/workflows/manpage-lint.yml @@ -28,7 +28,7 @@ permissions: # End the current execution if there is a new changeset in the PR. concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + cancel-in-progress: ${{ github.ref_type != 'tag' && github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }} jobs: manpage-lint: diff --git a/.github/workflows/openbsd.yml b/.github/workflows/openbsd.yml index eee12ac9ab4..a4109e78eca 100644 --- a/.github/workflows/openbsd.yml +++ b/.github/workflows/openbsd.yml @@ -19,7 +19,7 @@ permissions: # End the current execution if there is a new changeset in the PR. concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + cancel-in-progress: ${{ github.ref_type != 'tag' && github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }} jobs: style: @@ -43,6 +43,7 @@ jobs: run: | echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV + echo "SCCACHE_GHA_RW_MODE=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && 'READ_WRITE' || 'READ_ONLY' }}" >> $GITHUB_ENV - uses: mlugg/setup-zig@v2.2.1 - uses: taiki-e/install-action@cargo-zigbuild - name: cargo clippy diff --git a/.github/workflows/wasi.yml b/.github/workflows/wasi.yml index e09bad73322..0a31cecf1e5 100644 --- a/.github/workflows/wasi.yml +++ b/.github/workflows/wasi.yml @@ -14,7 +14,7 @@ permissions: # End the current execution if there is a new changeset in the PR. concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + cancel-in-progress: ${{ github.ref_type != 'tag' && github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }} jobs: test_wasi: @@ -33,9 +33,10 @@ jobs: - uses: dtolnay/rust-toolchain@stable with: targets: ${{ matrix.job.target }} - - uses: Swatinem/rust-cache@v2 + - uses: ./.github/actions/rust-cache with: - key: "${{ matrix.job.target }}" + key: wasi-${{ matrix.job.target }} + sccache: false - name: Install wasmtime uses: taiki-e/install-action@wasmtime - name: Run unit tests diff --git a/.github/workflows/wsl2.yml b/.github/workflows/wsl2.yml index 10b3db822f2..972fa13c34f 100644 --- a/.github/workflows/wsl2.yml +++ b/.github/workflows/wsl2.yml @@ -14,7 +14,7 @@ permissions: # End the current execution if there is a new changeset in the PR. concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + cancel-in-progress: ${{ github.ref_type != 'tag' && github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }} jobs: test: