Skip to content

Commit

Permalink
Add MSRV verification jobs to the CI. (#523)
Browse files Browse the repository at this point in the history
* Update dependencies.

* Add `Cargo.lock`.

* Add MSRV verification jobs to the CI.

* Add MSRV acronym for easier searching.

* Add `--locked` to all cargo commands that support it.

* Add a brief rationale for MSRV job design.

* Adjust MSRV sync notice in `Cargo.toml`.
  • Loading branch information
xStrom committed Mar 18, 2024
1 parent 74715ee commit 399a723
Show file tree
Hide file tree
Showing 13 changed files with 5,070 additions and 31 deletions.
77 changes: 70 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ env:
# come automatically. If the version specified here is no longer the latest stable version,
# then please feel free to submit a PR that adjusts it along with the potential clippy fixes.
RUST_STABLE_VER: "1.76" # In quotes because otherwise (e.g.) 1.70 would be interpreted as 1.7
# The purpose of checking with the minimum supported Rust toolchain is to detect its staleness.
# If the compilation fails, then the version specified here needs to be bumped up to reality.
# Be sure to also update the rust-version property in the workspace Cargo.toml file,
# plus all the README.md files of the affected packages.
RUST_MIN_VER: "1.75"
# List of packages that will be checked with the minimum supported Rust version.
# This should be limited to packages that are intended for publishing.
RUST_MIN_VER_PKGS: "-p vello -p vello_encoding -p vello_shaders"


# Rationale
Expand Down Expand Up @@ -31,6 +39,9 @@ env:
# This explicit dependency can be switched back to macos-latest once it points to macos-14,
# which is expected to happen sometime in Q2 FY24 (April – June 2024).
# https://github.blog/changelog/2024-01-30-github-actions-macos-14-sonoma-is-now-available/
#
# The MSRV jobs run only cargo check because different clippy versions can disagree on goals and
# running tests introduces dev dependencies which may require a higher MSRV than the bare package.

name: CI

Expand Down Expand Up @@ -90,10 +101,10 @@ jobs:
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev

- name: cargo clippy
run: cargo hack clippy --workspace --each-feature --optional-deps -- -D warnings
run: cargo hack clippy --workspace --locked --each-feature --optional-deps -- -D warnings

- name: cargo clippy (auxiliary)
run: cargo hack clippy --workspace --each-feature --optional-deps --tests --benches --examples -- -D warnings
run: cargo hack clippy --workspace --locked --each-feature --optional-deps --tests --benches --examples -- -D warnings

clippy-stable-wasm:
name: cargo clippy (wasm32)
Expand All @@ -117,10 +128,10 @@ jobs:
tool: cargo-hack

- name: cargo clippy
run: cargo hack clippy --workspace --target wasm32-unknown-unknown --each-feature --optional-deps -- -D warnings
run: cargo hack clippy --workspace --locked --target wasm32-unknown-unknown --each-feature --optional-deps -- -D warnings

- name: cargo clippy (auxiliary)
run: cargo hack clippy --workspace --target wasm32-unknown-unknown --each-feature --optional-deps --tests --benches --examples -- -D warnings
run: cargo hack clippy --workspace --locked --target wasm32-unknown-unknown --each-feature --optional-deps --tests --benches --examples -- -D warnings

test-stable:
name: cargo test
Expand Down Expand Up @@ -164,7 +175,7 @@ jobs:
sudo apt install -y xvfb libegl1-mesa libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers
- name: cargo test
run: cargo test --workspace --all-features
run: cargo test --workspace --locked --all-features
env:
VELLO_CI_GPU_SUPPORT: ${{ matrix.gpu }}

Expand All @@ -186,7 +197,7 @@ jobs:

# TODO: Find a way to make tests work. Until then the tests are merely compiled.
- name: cargo test compile
run: cargo test --workspace --target wasm32-unknown-unknown --all-features --no-run
run: cargo test --workspace --locked --target wasm32-unknown-unknown --all-features --no-run

check-stable-android:
name: cargo check (aarch64-android)
Expand All @@ -212,6 +223,58 @@ jobs:
# This is a bit of a hack, but cargo apk doesn't seem to allow customising this
RUSTFLAGS: '-D warnings'

check-msrv:
name: cargo check (msrv)
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, macos-14, ubuntu-latest]
steps:
- uses: actions/checkout@v4

- name: restore cache
uses: Swatinem/rust-cache@v2

- name: install msrv toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_MIN_VER }}

- name: install cargo-hack
uses: taiki-e/install-action@v2
with:
tool: cargo-hack

- name: install native dependencies
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev

- name: cargo check
run: cargo hack check ${{ env.RUST_MIN_VER_PKGS }} --locked --each-feature --optional-deps

check-msrv-wasm:
name: cargo check (msrv) (wasm32)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: restore cache
uses: Swatinem/rust-cache@v2

- name: install msrv toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_MIN_VER }}
targets: wasm32-unknown-unknown

- name: install cargo-hack
uses: taiki-e/install-action@v2
with:
tool: cargo-hack

- name: cargo check
run: cargo hack check ${{ env.RUST_MIN_VER_PKGS }} --locked --target wasm32-unknown-unknown --each-feature --optional-deps

doc:
name: cargo doc
# NOTE: We don't have any platform specific docs in this workspace, so we only run on Ubuntu.
Expand All @@ -228,4 +291,4 @@ jobs:

# We test documentation using nightly to match docs.rs. This prevents potential breakages
- name: cargo doc
run: cargo doc --workspace --all-features --no-deps --document-private-items -Zunstable-options -Zrustdoc-scrape-examples
run: cargo doc --workspace --locked --all-features --no-deps --document-private-items -Zunstable-options -Zrustdoc-scrape-examples
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/target
Cargo.lock
/trace.json
.DS_Store

Expand Down
Loading

0 comments on commit 399a723

Please sign in to comment.