Rust 1.80: Use std::sync::LazyLock
.
#107
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This version of the CI workflow is for the `unstable-rust` branch that uses Rust | |
# nightly exclusively, for the sake of testing unstable features in the Rust compiler. | |
# | |
# It is stored in the main branch because only the main branch gets *scheduled* runs. | |
# Scheduled runs are performed so that code is regularly re-tested on new nightlies. | |
# | |
# Differences from `ci.yml`: | |
# | |
# * matrix is 100% nightly | |
# * no fuzzing | |
# * no deployment | |
# * no testing of multiple feature configurations | |
# * no concept of a "primary" matrix configuration | |
name: Unstable Rust Features | |
permissions: {} | |
on: | |
pull_request: | |
branches: | |
- unstable-rust | |
workflow_dispatch: | |
schedule: | |
- cron: '43 14 * * 1' | |
push: | |
branches: | |
- unstable-rust | |
- ci | |
env: | |
CARGO_TERM_COLOR: always | |
# Disable incremental compilation because we aren't caching incremental compilation | |
# artifacts, so they won't be useful for anything (other than maybe the exhaustive | |
# builds with different features). | |
CARGO_INCREMENTAL: 0 | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# Linux | |
- os: ubuntu | |
toolchain: nightly | |
depversions: locked | |
# Windows | |
- os: windows | |
toolchain: nightly | |
depversions: locked | |
# macOS | |
- os: macos | |
toolchain: nightly | |
depversions: locked | |
runs-on: ${{ matrix.os }}-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: unstable-rust | |
- name: Set Rust toolchain | |
# The rust-toolchain.toml file specifies the targets and components we need, | |
# but we may want to override the toolchain. | |
if: ${{ matrix.toolchain != 'stable' }} | |
run: | | |
sed -i.origstable "s/stable/${{ matrix.toolchain }}/" rust-toolchain.toml | |
rustup show # triggers installation of selected toolchain | |
- name: Install native libraries | |
if: ${{ runner.os == 'Linux' }} | |
run: | | |
sudo apt update | |
sudo apt-get -y install libxrandr-dev xorg-dev libx11-xcb-dev libwayland-dev libasound2-dev libudev-dev | |
# libxrandr-dev xorg-dev libx11-xcb-dev libwayland-dev: needed for windowing | |
# Note that `libwayland-dev` provides the library called `wayland-client` | |
# libasound2-dev: needed for audio via `kira` | |
# libudev-dev: needed for gamepad input via `gilrs` | |
# Load cache before doing any Rust builds | |
- uses: Swatinem/[email protected] | |
with: | |
# This is not necessary for keying, but makes the GHA cache viewing page more helpful. | |
prefix-key: "v1-rust-unstablefeatures-${{ matrix.os }}-${{ matrix.depversions }}" | |
# break this out as a separate non-silenced build step | |
- name: Compile xtask | |
run: cargo build --package xtask | |
- name: Update dependencies | |
run: | | |
cargo xtask update "${{ matrix.depversions }}" | |
cargo tree --all-features | |
- name: Install tools | |
# Note: Swatinem/rust-cache will cache these installed binaries, so we don't have to worry | |
# about caching the builds of them. | |
run: | | |
cargo install --locked [email protected] [email protected] | |
- name: Compile basic tests | |
# compile is broken out so we have visibility into compile vs. run times | |
run: cargo xtask --scope=only-normal test --timings --no-run | |
- name: Run basic tests | |
run: cargo xtask --scope=only-normal test --timings | |
# Save the test-renderers results so we can download and view them | |
- name: Save test-renderers output | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-renderers-output ${{ matrix.os }} ${{ matrix.toolchain }} ${{ matrix.depversions }} | |
path: | | |
target/test-renderers-output/ | |
- name: Lint | |
run: cargo xtask --scope=only-normal lint --timings | |
# Save timing reports so we can download and view them | |
# (for understanding build performance in CI) | |
- name: Save cargo --timings output | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cargo-timings ${{ matrix.os }} ${{ matrix.toolchain }} ${{ matrix.depversions }} | |
path: | | |
target/cargo-timings/cargo-timing-*.html | |
miri: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: Swatinem/[email protected] | |
with: | |
# This is not necessary for keying, but makes the GHA cache viewing page more helpful. | |
prefix-key: "v1-rust-unstablefeatures-ubuntu-locked" | |
- name: Install Rust toolchain | |
run: | | |
rustup toolchain install nightly --component miri | |
- name: Run Miri tests | |
# `universe::owning_guard` is the only module that contains nontrivial unsafe code, | |
# and the tests in `universe` are those most worth running to exercise it. | |
run: | | |
cargo +nightly miri test --no-default-features -p all-is-cubes universe:: |