Skip to content

Commit

Permalink
Small CI improvements (#13060)
Browse files Browse the repository at this point in the history
# 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.
  • Loading branch information
BD103 authored Apr 22, 2024
1 parent 279e89b commit fcd87b2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/validation-jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit fcd87b2

Please sign in to comment.