From 7f0e452ebbd1333f9a2f3268c5a5185bbadcbcac Mon Sep 17 00:00:00 2001 From: Arsenii Lyashenko Date: Wed, 10 Apr 2024 04:02:24 +0300 Subject: [PATCH] chore(ci): Smart caching in native Windows and macOS jobs (#3859) --- .config/nextest.toml | 9 ++++++--- .github/workflows/CI.yaml | 3 +-- .github/workflows/PR.yml | 3 +-- .github/workflows/build-macos.yml | 20 ++++++-------------- .github/workflows/build-win-native.yml | 16 +++++++++++++--- .github/workflows/build.yml | 11 +++++------ .github/workflows/check.yml | 1 - .github/workflows/crates-io.yml | 1 - .github/workflows/release.yml | 7 +++---- 9 files changed, 35 insertions(+), 36 deletions(-) diff --git a/.config/nextest.toml b/.config/nextest.toml index e58179fa23d..fc779012762 100644 --- a/.config/nextest.toml +++ b/.config/nextest.toml @@ -1,6 +1,9 @@ [profile.ci.junit] path = "junit.xml" -[[profile.default.overrides]] -filter = 'test(/^property_tests::/)' -threads-required = 2 +# sometimes fails on CI machine in debug profile +# due to an inconsistent machine load and unoptimized code +[[profile.ci.overrides]] +filter = 'package(gear-authorship)' +retries = 5 +threads-required = "num-test-threads" diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 9c14af6ffa2..14fe0982bcd 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -4,7 +4,7 @@ on: schedule: - cron: "0 3 * * *" push: - branches: [master] + branches: [ master ] workflow_dispatch: concurrency: @@ -12,7 +12,6 @@ concurrency: cancel-in-progress: true env: - CARGO_INCREMENTAL: 0 CARGO_TERM_COLOR: always RUST_BACKTRACE: short TERM: xterm-256color diff --git a/.github/workflows/PR.yml b/.github/workflows/PR.yml index 54dd43d31cf..284c760f9ea 100644 --- a/.github/workflows/PR.yml +++ b/.github/workflows/PR.yml @@ -2,14 +2,13 @@ name: PR on: pull_request: - branches: [master] + branches: [ master ] concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true env: - CARGO_INCREMENTAL: 0 CARGO_TERM_COLOR: always RUST_BACKTRACE: short TERM: xterm-256color diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index a8ce32d2cf7..14aae8f6c08 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -9,7 +9,6 @@ on: workflow_dispatch: env: - CARGO_INCREMENTAL: 0 CARGO_TERM_COLOR: always RUST_BACKTRACE: short TERM: xterm-256color @@ -28,19 +27,6 @@ jobs: - name: "ACTIONS: Checkout" uses: actions/checkout@v4 - - name: "ACTIONS: Setup caching" - uses: actions/cache@v4 - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo- - - name: "Install: protobuf" run: brew install protobuf @@ -53,6 +39,12 @@ jobs: - name: "Install: Rust toolchain" uses: dsherret/rust-toolchain-file@v1 + - name: "ACTIONS: Setup caching" + uses: Swatinem/rust-cache@v2 + with: + key: "${{ matrix.profile }}" + save-if: ${{ github.ref == 'refs/heads/master' }} + - name: "Install: cargo-nextest" run: curl -LsSf https://get.nexte.st/latest/mac | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin diff --git a/.github/workflows/build-win-native.yml b/.github/workflows/build-win-native.yml index fb8d2216235..9353dd00601 100644 --- a/.github/workflows/build-win-native.yml +++ b/.github/workflows/build-win-native.yml @@ -9,7 +9,6 @@ on: workflow_dispatch: env: - CARGO_INCREMENTAL: 0 CARGO_TERM_COLOR: always RUST_BACKTRACE: short TERM: xterm-256color @@ -25,8 +24,6 @@ jobs: defaults: run: shell: msys2 {0} - env: - CARGO_INCREMENTAL: 0 steps: - name: "ACTIONS: Checkout" uses: actions/checkout@v4 @@ -39,9 +36,22 @@ jobs: procps mingw-w64-x86_64-protobuf + - name: "Install: Rustup" + run: | + Invoke-WebRequest -OutFile rustup-init.exe https://win.rustup.rs/x86_64 + .\rustup-init.exe -y + Remove-Item rustup-init.exe + shell: powershell + - name: "Install: Rust toolchain" uses: dsherret/rust-toolchain-file@v1 + - name: "ACTIONS: Setup caching" + uses: Swatinem/rust-cache@v2 + with: + key: "${{ matrix.profile }}" + save-if: ${{ github.ref == 'refs/heads/master' }} + - name: "Install: cargo-nextest" run: | $tmp = New-TemporaryFile | Rename-Item -NewName { $_ -replace 'tmp$', 'zip' } -PassThru diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c94826544a6..27a629bfa0a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,7 +27,6 @@ on: run-name: ${{ inputs.title }} ( ${{ format('#{0}', inputs.number) }} ) env: - CARGO_INCREMENTAL: 0 CARGO_TERM_COLOR: always RUST_BACKTRACE: short TERM: xterm-256color @@ -50,7 +49,7 @@ jobs: echo "matrix=${matrix}" >> $GITHUB_OUTPUT linux: - runs-on: [kuberunner, github-runner-02] + runs-on: [ kuberunner, github-runner-02 ] needs: matrix strategy: matrix: ${{ fromJson(needs.matrix.outputs.matrix) }} @@ -172,7 +171,7 @@ jobs: path: artifact win-cross: - runs-on: [kuberunner, github-runner-03] + runs-on: [ kuberunner, github-runner-03 ] needs: matrix strategy: matrix: ${{ fromJson(needs.matrix.outputs.matrix) }} @@ -182,7 +181,7 @@ jobs: XWIN_ARCH: x86_64 RUSTUP_HOME: /tmp/rustup_home WINEDEBUG: fixme-all - CARGO_INCREMENTAL: 0 + CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse steps: - name: "ACTIONS: Checkout" @@ -254,14 +253,14 @@ jobs: CARGO_BUILD_TARGET: x86_64-pc-windows-msvc win-native: - needs: [matrix, linux] + needs: [ matrix, linux ] if: ${{ !cancelled() && (github.ref == 'refs/heads/master' || inputs.win-native) }} uses: ./.github/workflows/build-win-native.yml with: matrix: ${{ needs.matrix.outputs.matrix }} macos: - needs: [matrix, linux] + needs: [ matrix, linux ] if: ${{ !cancelled() && inputs.macos }} uses: ./.github/workflows/build-macos.yml with: diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 0c7494e1dd8..f5d92403941 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -4,7 +4,6 @@ on: workflow_call: env: - CARGO_INCREMENTAL: 0 CARGO_TERM_COLOR: always RUST_BACKTRACE: short TERM: xterm-256color diff --git a/.github/workflows/crates-io.yml b/.github/workflows/crates-io.yml index d06ceae95e4..0568b4569e6 100644 --- a/.github/workflows/crates-io.yml +++ b/.github/workflows/crates-io.yml @@ -13,7 +13,6 @@ on: type: string env: - CARGO_INCREMENTAL: 0 CARGO_TERM_COLOR: always RUST_BACKTRACE: short TERM: xterm-256color diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8cfe91cf3ef..771c1ea0849 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,10 +2,9 @@ name: Release on: push: - tags: ["*"] + tags: [ "*" ] env: - CARGO_INCREMENTAL: 0 CARGO_TERM_COLOR: always TERM: xterm-256color GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} @@ -13,7 +12,7 @@ env: jobs: changelog: name: Generate changelog - runs-on: [kuberunner] + runs-on: [ kuberunner ] outputs: release_body: ${{ steps.git-cliff.outputs.content }} steps: @@ -33,7 +32,7 @@ jobs: build: needs: changelog - runs-on: [kuberunner] + runs-on: [ kuberunner ] steps: - name: "Actions: Checkout" uses: actions/checkout@v4