Skip to content

Commit

Permalink
chore(ci): Smart caching in native Windows and macOS jobs (#3859)
Browse files Browse the repository at this point in the history
  • Loading branch information
ark0f authored Apr 10, 2024
1 parent c5b3629 commit 7f0e452
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 36 deletions.
9 changes: 6 additions & 3 deletions .config/nextest.toml
Original file line number Diff line number Diff line change
@@ -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"
3 changes: 1 addition & 2 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ on:
schedule:
- cron: "0 3 * * *"
push:
branches: [master]
branches: [ master ]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
RUST_BACKTRACE: short
TERM: xterm-256color
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 6 additions & 14 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ on:
workflow_dispatch:

env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
RUST_BACKTRACE: short
TERM: xterm-256color
Expand All @@ -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

Expand All @@ -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

Expand Down
16 changes: 13 additions & 3 deletions .github/workflows/build-win-native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ on:
workflow_dispatch:

env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
RUST_BACKTRACE: short
TERM: xterm-256color
Expand All @@ -25,8 +24,6 @@ jobs:
defaults:
run:
shell: msys2 {0}
env:
CARGO_INCREMENTAL: 0
steps:
- name: "ACTIONS: Checkout"
uses: actions/checkout@v4
Expand All @@ -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
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) }}
Expand Down Expand Up @@ -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) }}
Expand All @@ -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"
Expand Down Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
workflow_call:

env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
RUST_BACKTRACE: short
TERM: xterm-256color
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/crates-io.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ on:
type: string

env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
RUST_BACKTRACE: short
TERM: xterm-256color
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@ name: Release

on:
push:
tags: ["*"]
tags: [ "*" ]

env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
TERM: xterm-256color
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}

jobs:
changelog:
name: Generate changelog
runs-on: [kuberunner]
runs-on: [ kuberunner ]
outputs:
release_body: ${{ steps.git-cliff.outputs.content }}
steps:
Expand All @@ -33,7 +32,7 @@ jobs:

build:
needs: changelog
runs-on: [kuberunner]
runs-on: [ kuberunner ]
steps:
- name: "Actions: Checkout"
uses: actions/checkout@v4
Expand Down

0 comments on commit 7f0e452

Please sign in to comment.