From fcd87b25281e7d1f6e857fb8096eea1ddfefb98c Mon Sep 17 00:00:00 2001 From: BD103 <59022059+BD103@users.noreply.github.com> Date: Mon, 22 Apr 2024 18:41:45 -0400 Subject: [PATCH] Small CI improvements (#13060) # Objective - Some CI jobs specifically use `macos-14`, as compared to the default `macos-latest`. - `macos-latest` is equivalent to `macos-12`, but may be updated in the future. - The CI job that tests on the minimum supported Rust version (MSRV) uses environmental variables to save the toolchain version. - This specific usage is what step outputs were designed for. - Both do the same thing, but step outputs can be checked by the [Github Actions VSCode Extension](https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-github-actions). - Some workflows have a `NIGHTLY_TOOLCHAIN` variable that let us pin the nightly version, in case a new release breaks CI. ## Solution - Document why certain actions required `macos-14`. - Switch MSRV step to use step outputs. - Add a small comment documenting the purpose of the `NIGHTLY_TOOLCHAIN` environmental variable. --- .github/workflows/ci.yml | 8 ++++++-- .github/workflows/docs.yml | 1 + .github/workflows/validation-jobs.yml | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 97032ef749..8eaab8df13 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,7 @@ on: env: CARGO_TERM_COLOR: always + # If nightly is breaking CI, modify this variable to target a specific nightly version. NIGHTLY_TOOLCHAIN: nightly concurrency: @@ -70,6 +71,7 @@ jobs: run: cargo run -p ci -- lints miri: + # Explicity use MacOS 14 to take advantage of M1 chip. runs-on: macos-14 timeout-minutes: 60 steps: @@ -228,6 +230,7 @@ jobs: run-examples-macos-metal: + # Explicity use MacOS 14 to take advantage of M1 chip. runs-on: macos-14 timeout-minutes: 30 steps: @@ -388,12 +391,13 @@ jobs: target/ key: ${{ runner.os }}-cargo-msrv-${{ hashFiles('**/Cargo.toml') }} - name: get MSRV + id: msrv run: | msrv=`cargo metadata --no-deps --format-version 1 | jq --raw-output '.packages[] | select(.name=="bevy") | .rust_version'` - echo "MSRV=$msrv" >> $GITHUB_ENV + echo "msrv=$msrv" >> $GITHUB_OUTPUT - uses: dtolnay/rust-toolchain@master with: - toolchain: ${{ env.MSRV }} + toolchain: ${{ steps.msrv.outputs.msrv }} - name: Install Linux dependencies uses: ./.github/actions/install-linux-deps - name: Run cargo check diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 77ebc43365..e4002371d6 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -10,6 +10,7 @@ on: env: CARGO_TERM_COLOR: always RUSTDOCFLAGS: --html-in-header header.html + # If nightly is breaking CI, modify this variable to target a specific nightly version. NIGHTLY_TOOLCHAIN: nightly # Sets the permissions to allow deploying to Github pages. diff --git a/.github/workflows/validation-jobs.yml b/.github/workflows/validation-jobs.yml index b4ae9e0994..a90926773d 100644 --- a/.github/workflows/validation-jobs.yml +++ b/.github/workflows/validation-jobs.yml @@ -13,6 +13,7 @@ concurrency: env: CARGO_TERM_COLOR: always + # If nightly is breaking CI, modify this variable to target a specific nightly version. NIGHTLY_TOOLCHAIN: nightly jobs: