CI: Check MSRV in CI

As previously proposed on zulip and discussed in the
coordination meeting, add a check to CI to see if
servo still compiles with our minimum supported Rust
version.
To avoid requiring changes, we define our MSRV as the
current version we are using now.

This does not prevent us from updating the default
compiler version, which we should still do, to
get benefits like faster compile times, newer lints
and making sure crown stays up-to-date.

We simply test that libservo compiles in CI on Linux,
since libservo (and dependencies) is what embedders would care about.
We also don't need mach for this, so we just use cargo build.

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
This commit is contained in:
Jonathan Schwender 2025-05-27 19:32:36 +08:00
parent 324196351e
commit 2f0192e97f
No known key found for this signature in database
2 changed files with 43 additions and 1 deletions

View file

@ -43,9 +43,46 @@ jobs:
run: |
sudo apt update
./mach bootstrap
# TODO: Do GitHub anotaions
# TODO: Do GitHub annotations
- name: Clippy
run: |
./mach clippy --use-crown --locked -- -- --deny warnings
- name: Tidy
run: ./mach test-tidy --no-progress --all
msrv_check:
name: Minimum supported Rust version check
runs-on: ubuntu-22.04
env:
# This version should be kept in sync with the `rust-version` in our
# workspace Cargo.toml. Changes should be discussed on zulip.
MINIMUM_SUPPORTED_RUST_VERSION: "1.85.0"
steps:
- uses: actions/checkout@v4
if: github.event_name != 'pull_request_target'
with:
fetch-depth: 1
# This is necessary to checkout the pull request if this run was triggered via a
# `pull_request_target` event.
- uses: actions/checkout@v4
if: github.event_name == 'pull_request_target'
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 1
- name: Set LIBCLANG_PATH env # needed for bindgen in mozangle
run: echo "LIBCLANG_PATH=/usr/lib/llvm-14/lib" >> $GITHUB_ENV
- name: Setup Python
if: ${{ runner.environment != 'self-hosted' }}
uses: ./.github/actions/setup-python
- name: Bootstrap dependencies
if: ${{ runner.environment != 'self-hosted' }}
run: |
sudo apt update
./mach bootstrap --skip-lints
- name: Install MSRV
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${MINIMUM_SUPPORTED_RUST_VERSION}
- name: Compile libservo with MSRV
run: |
cargo +${MINIMUM_SUPPORTED_RUST_VERSION} build -p libservo --locked

View file

@ -13,6 +13,11 @@ authors = ["The Servo Project Developers"]
license = "MPL-2.0"
edition = "2024"
publish = false
# We have yet to decide on a policy for updating the minimum supported rust version.
# Before increasing this, please open a discussion on zulip explaining the reason
# why we should consider increasing our minimum supported rust version.
# Please also note, that the **default** rust version in rust-toolchain.toml may be
# bumped freely.
rust-version = "1.85.0"
[workspace.dependencies]