From 89ef8a366c89f140db48e87892146e9d0f5ccb1a Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Sat, 28 Dec 2024 06:01:51 +0000 Subject: [PATCH 1/4] Clean up the CI configuration file Shorten test names and adjust indentation. --- .github/workflows/rust.yml | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 2e7b9fc..1516127 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,4 +1,4 @@ -name: Continuous integration +name: CI on: pull_request: @@ -7,29 +7,28 @@ on: - master jobs: - os_tests: - name: "Tests / OS: ${{ matrix.os }} - ${{ matrix.channel }}" + test: + name: Tests runs-on: ${{ matrix.os }} strategy: matrix: channel: - - stable - - beta - - nightly - - 1.23.0 + - stable + - beta + - nightly + - 1.23.0 os: - # FIXME: compiling with 1.23 on macOS 12 fails to linL - # archive member 'rust.metadata.bin' with length 40821 is not mach-o or llvm bitcode file - - macos-11 - - windows-2022 - - ubuntu-22.04 + - macos-11 + - windows-2022 + - ubuntu-22.04 steps: - name: Checkout repository uses: actions/checkout@v4 - name: Update rust - run: rustup update ${{ matrix.channel }} --no-self-update + run: | + rustup default ${{ matrix.channel }} + rustup update --no-self-update - - name: Tests - run: cargo +${{ matrix.channel }} test --all + - run: cargo test --all From 8c5d22c98968155e4f27fa30361a7f3d0c8dbe84 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Sat, 28 Dec 2024 06:02:02 +0000 Subject: [PATCH 2/4] Check only (no longer test) at the MSRV Adjust CI so we only run a check the main crate at the MSRV (1.23), running tests only at the MSRV of test dependencies. This allows us to keep CI passing without increasing `glob`'s MSRV to match that of `libc` (which since recently is 1.63.0) or other test dependencies. Additionally, set `rust-version` in Cargo.toml. --- .github/workflows/rust.yml | 16 +++++++++++++++- Cargo.toml | 3 ++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 1516127..b9bc9c9 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -16,7 +16,7 @@ jobs: - stable - beta - nightly - - 1.23.0 + - 1.63.0 # MSRV of test dependencies os: - macos-11 - windows-2022 @@ -32,3 +32,17 @@ jobs: rustup update --no-self-update - run: cargo test --all + + msrv: + name: Check building with the MSRV + runs-on: ubuntu-22.04 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Update rust + run: | + rustup default 1.23.0 + rustup update --no-self-update + + - run: cargo build diff --git a/Cargo.toml b/Cargo.toml index 894ed21..f2de0b2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,8 +11,9 @@ description = """ Support for matching file paths against Unix shell style patterns. """ categories = ["filesystem"] +rust-version = "1.23.0" [dev-dependencies] -# FIXME: Replace it with `tempfile` once we bump up MSRV. +# FIXME: This should be replaced by `tempfile` tempdir = "0.3" doc-comment = "0.3" From 9bd1af895d5d0b4765b0cadd5a1572e24da0950e Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Sat, 28 Dec 2024 06:31:49 +0000 Subject: [PATCH 3/4] Update CI runners to the latest available versions Also ensure we test both x86 and aarch64 MacOS. To slightly reduce the total number of jobs, only check `beta` on Linux. --- .github/workflows/rust.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index b9bc9c9..054f897 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -14,13 +14,16 @@ jobs: matrix: channel: - stable - - beta - nightly - 1.63.0 # MSRV of test dependencies os: - - macos-11 - - windows-2022 - - ubuntu-22.04 + - macos-13 # x86 MacOS + - macos-15 # Arm MacOS + - windows-2025 + - ubuntu-24.04 + include: + - channel: beta + os: ubuntu-24.04 steps: - name: Checkout repository @@ -35,7 +38,7 @@ jobs: msrv: name: Check building with the MSRV - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout repository uses: actions/checkout@v4 From 1dff47741cfa83bf896ecc9e84fcec1bae502c01 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Sat, 28 Dec 2024 23:22:30 +0000 Subject: [PATCH 4/4] Add a `success` job to CI for branch protection --- .github/workflows/rust.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 054f897..8f3901c 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -49,3 +49,17 @@ jobs: rustup update --no-self-update - run: cargo build + + success: + needs: + - test + - msrv + runs-on: ubuntu-latest + # GitHub branch protection is exceedingly silly and treats "jobs skipped because a dependency + # failed" as success. So we have to do some contortions to ensure the job fails if any of its + # dependencies fails. + if: always() # make sure this is never "skipped" + steps: + # Manually check the status of all dependencies. `if: failure()` does not work. + - name: check if any dependency failed + run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'