From 53c9cd07860cf2b0bf60e0968083d076f87bda0c Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Sun, 23 Nov 2025 02:21:38 +0000 Subject: [PATCH 1/6] CI: No need to run on push to all branches --- .github/workflows/rust-ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rust-ci.yml b/.github/workflows/rust-ci.yml index f9a6d5bd5..79548435b 100644 --- a/.github/workflows/rust-ci.yml +++ b/.github/workflows/rust-ci.yml @@ -3,7 +3,9 @@ name: Rust CI on: push: branches: - - '**' + - master + - main + - llvm18 pull_request: branches: - '**' From 5b6f3e1b80282eb4451d8b6724316e6a0cebbd8d Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Sun, 23 Nov 2025 16:25:24 +0000 Subject: [PATCH 2/6] CI: Explictly name runner images --- .github/workflows/rust-ci.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/rust-ci.yml b/.github/workflows/rust-ci.yml index 79548435b..3e7b17d55 100644 --- a/.github/workflows/rust-ci.yml +++ b/.github/workflows/rust-ci.yml @@ -132,7 +132,7 @@ jobs: echo '[net]' > .cargo/config.toml echo 'git-fetch-with-cli = true' >> .cargo/config.toml - name: Cache sccache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.cache/sccache key: ${{ runner.os }}-sccache-${{ hashFiles('**/Cargo.lock') }} @@ -160,11 +160,15 @@ jobs: fail-fast: false matrix: include: - - arch: arm64 - macos: 13 - - arch: x86_64 - macos: 13 - runs-on: macos-${{ matrix.macos }} + # Intel + - image: macos-15-intel + - image: macos-14-large + # ARM64 + - image: macos-15 + - image: macos-14 + + runs-on: ${{ matrix.image }} + needs: [format, machete] steps: - name: Checkout uses: actions/checkout@v4 From e99c4dd3c7435283412354d385fe36d2f3809879 Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Sun, 23 Nov 2025 16:43:10 +0000 Subject: [PATCH 3/6] CI: Cache brew packages --- .github/workflows/rust-ci.yml | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/.github/workflows/rust-ci.yml b/.github/workflows/rust-ci.yml index 3e7b17d55..d9d4c5031 100644 --- a/.github/workflows/rust-ci.yml +++ b/.github/workflows/rust-ci.yml @@ -28,6 +28,7 @@ jobs: - name: Setup sccache if: github.event_name != 'release' && github.event_name != 'workflow_dispatch' uses: mozilla-actions/sccache-action@v0.0.9 + - name: Configure sccache if: github.event_name != 'release' && github.event_name != 'workflow_dispatch' run: | @@ -35,10 +36,13 @@ jobs: echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV - uses: actions/checkout@v4 + - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable + - name: Install cargo-machete run: cargo install cargo-machete + - name: Run cargo machete run: cargo machete @@ -47,19 +51,23 @@ jobs: needs: [format, machete] steps: - uses: actions/checkout@v4 + - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable with: components: clippy targets: x86_64-pc-windows-gnu + - name: Setup sccache if: github.event_name != 'release' && github.event_name != 'workflow_dispatch' uses: mozilla-actions/sccache-action@v0.0.9 + - name: Configure sccache if: github.event_name != 'release' && github.event_name != 'workflow_dispatch' run: | echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV + - name: Install LLVM 18 and Windows cross-compilation tools run: | wget https://apt.llvm.org/llvm.sh @@ -76,18 +84,22 @@ jobs: # Verify installation which llvm-lib llvm-lib --version + - name: Set LLVM environment variables run: | echo "LLVM_SYS_181_PREFIX=/usr/lib/llvm-18" >> $GITHUB_ENV echo "CLANG_PATH=/usr/lib/llvm-18/bin/clang" >> $GITHUB_ENV echo "PATH=/usr/lib/llvm-18/bin:$PATH" >> $GITHUB_ENV echo "RUST_BACKTRACE=1" >> $GITHUB_ENV + - name: Install build dependencies run: | sudo apt-get update sudo apt-get install -y build-essential + - name: Build run: cargo build --release + - name: Show sccache stats if: github.event_name != 'release' && github.event_name != 'workflow_dispatch' shell: bash @@ -95,6 +107,7 @@ jobs: # someone has to fix the errors # - name: Run Clippy # run: cargo clippy -- -D warnings + - name: Run tests run: cargo test --release @@ -131,6 +144,7 @@ jobs: mkdir -p .cargo echo '[net]' > .cargo/config.toml echo 'git-fetch-with-cli = true' >> .cargo/config.toml + - name: Cache sccache uses: actions/cache@v4 with: @@ -138,12 +152,14 @@ jobs: key: ${{ runner.os }}-sccache-${{ hashFiles('**/Cargo.lock') }} restore-keys: | ${{ runner.os }}-sccache- + - name: Locate and configure sccache shell: msys2 {0} run: | # export SCCACHE_PATH=$(which sccache) # echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV echo "RUSTC_WRAPPER=${SCCACHE_PATH}" >> $GITHUB_ENV + - name: Run cargo shell: msys2 {0} run: cargo build --release @@ -151,6 +167,7 @@ jobs: # if: github.event_name != 'release' && github.event_name != 'workflow_dispatch' # shell: msys2 {0} # run: $SCCACHE_PATH --show-stats + - name: Run tests shell: msys2 {0} run: cargo test --release @@ -162,7 +179,6 @@ jobs: include: # Intel - image: macos-15-intel - - image: macos-14-large # ARM64 - image: macos-15 - image: macos-14 @@ -173,16 +189,24 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Install pkg-config with Homebrew + - name: Install dependencies with Homebrew + uses: tecolicom/actions-use-homebrew-tools@v1 + with: + tools: pkg-config mingw-w64 sccache llvm@18 + cache: yes + + - name: Set LLVM environment variables run: | - brew install pkg-config mingw-w64 sccache llvm - echo "$(brew --prefix llvm)/bin" >> $GITHUB_PATH + echo "$(brew --prefix llvm@18)/bin" >> $GITHUB_PATH + echo "LLVM_SYS_181_PREFIX=$(brew --prefix llvm@18)" >> $GITHUB_ENV + echo "RUST_BACKTRACE=1" >> $GITHUB_ENV + echo "RUN_DEV_TESTS=1" >> $GITHUB_ENV + - name: sccache setup run: | # echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV echo "RUSTC_WRAPPER=$(which sccache)" >> $GITHUB_ENV - - name: Build run: cargo build --release From 54d21f6c1ac185ce8fb0a94129e506d5da0bf4cd Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Sun, 23 Nov 2025 18:24:39 +0000 Subject: [PATCH 4/6] CI: No need to install mingw on macos --- .github/workflows/rust-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust-ci.yml b/.github/workflows/rust-ci.yml index d9d4c5031..f002eb13b 100644 --- a/.github/workflows/rust-ci.yml +++ b/.github/workflows/rust-ci.yml @@ -192,7 +192,7 @@ jobs: - name: Install dependencies with Homebrew uses: tecolicom/actions-use-homebrew-tools@v1 with: - tools: pkg-config mingw-w64 sccache llvm@18 + tools: pkg-config sccache llvm@18 cache: yes - name: Set LLVM environment variables From 5557811aedaee73d35a87f3bf286ceab313fe30e Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Sun, 23 Nov 2025 10:43:22 +0000 Subject: [PATCH 5/6] CI: Cache cargo build --- .github/workflows/rust-ci.yml | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/.github/workflows/rust-ci.yml b/.github/workflows/rust-ci.yml index f002eb13b..a1de258fe 100644 --- a/.github/workflows/rust-ci.yml +++ b/.github/workflows/rust-ci.yml @@ -68,6 +68,20 @@ jobs: echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV + - name: "Cache cargo" + id: cache-cargo + uses: "actions/cache@v4" + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + save-always: true + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo- + - name: Install LLVM 18 and Windows cross-compilation tools run: | wget https://apt.llvm.org/llvm.sh @@ -160,6 +174,20 @@ jobs: # echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV echo "RUSTC_WRAPPER=${SCCACHE_PATH}" >> $GITHUB_ENV + - name: "Cache cargo" + id: cache-cargo + uses: "actions/cache@v4" + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + save-always: true + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo- + - name: Run cargo shell: msys2 {0} run: cargo build --release @@ -206,6 +234,20 @@ jobs: run: | # echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV echo "RUSTC_WRAPPER=$(which sccache)" >> $GITHUB_ENV + + - name: "Cache cargo" + id: cache-cargo + uses: "actions/cache@v4" + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + save-always: true + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo- - name: Build run: cargo build --release From 8ad0f48189dd431f5156933cffd73510d98cd819 Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Fri, 28 Nov 2025 14:03:26 +0000 Subject: [PATCH 6/6] CI: Use architecture in cache keys --- .github/workflows/rust-ci.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/rust-ci.yml b/.github/workflows/rust-ci.yml index a1de258fe..8edb432bb 100644 --- a/.github/workflows/rust-ci.yml +++ b/.github/workflows/rust-ci.yml @@ -79,8 +79,8 @@ jobs: ~/.cargo/git/db/ target/ save-always: true - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo- + key: ${{ runner.os }}-${{runner.arch}}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-${{runner.arch}}-cargo- - name: Install LLVM 18 and Windows cross-compilation tools run: | @@ -163,9 +163,9 @@ jobs: uses: actions/cache@v4 with: path: ~/.cache/sccache - key: ${{ runner.os }}-sccache-${{ hashFiles('**/Cargo.lock') }} + key: ${{ runner.os }}-${{runner.arch}}-sccache-${{ hashFiles('**/Cargo.lock') }} restore-keys: | - ${{ runner.os }}-sccache- + ${{ runner.os }}-${{runner.arch}}-sccache- - name: Locate and configure sccache shell: msys2 {0} @@ -185,8 +185,8 @@ jobs: ~/.cargo/git/db/ target/ save-always: true - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo- + key: ${{ runner.os }}-${{runner.arch}}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-${{runner.arch}}-cargo- - name: Run cargo shell: msys2 {0} @@ -246,8 +246,8 @@ jobs: ~/.cargo/git/db/ target/ save-always: true - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo- + key: ${{ runner.os }}-${{runner.arch}}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-${{runner.arch}}}-cargo- - name: Build run: cargo build --release