Skip to content

Migrate to cbindgen #207

Migrate to cbindgen

Migrate to cbindgen #207

Workflow file for this run

name: Continuous integration
# Based on and adapted from https://github.com/bevyengine/bevy/blob/main/.github/workflows/ci.yml
on:
pull_request:
merge_group:
permissions:
actions: none
attestations: none
checks: none
contents: none
deployments: none
id-token: none
issues: none
discussions: none
packages: none
pages: none
pull-requests: none
repository-projects: none
security-events: none
statuses: none
env:
CARGO_TERM_COLOR: always
# If nightly is breaking CI, modify this variable to target a specific nightly version.
NIGHTLY_TOOLCHAIN: nightly
STABLE_TOOLCHAIN: "1.87.0"
MIRIFLAGS: "-Zmiri-disable-isolation"
concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: ${{github.event_name == 'pull_request'}}
jobs:
build:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
submodules: "true"
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-build-stable-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.STABLE_TOOLCHAIN }}
- name: Build & run tests
run: cargo test --workspace --lib --bins --tests --benches
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-C debuginfo=0 -D warnings"
lint:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
submodules: "true"
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-ci-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.STABLE_TOOLCHAIN }}
components: rustfmt, clippy
- name: Check formatting
run: cargo fmt --all -- --check
- name: Clippy
run: cargo clippy --workspace --all-targets -- -Dwarnings
- name: Clippy (all features)
run: cargo clippy --workspace --all-targets --all-features -- -Dwarnings
# COMBAK: we disable miri for now because it hangs indefinitely. issue #73
# miri:
# # Explicitly use macOS 14 to take advantage of M1 chip.
# runs-on: macos-14
# timeout-minutes: 10
# steps:
# - uses: actions/checkout@v4
# with:
# submodules: "true"
# - uses: actions/cache@v4
# with:
# path: |
# ~/.cargo/bin/
# ~/.cargo/registry/index/
# ~/.cargo/registry/cache/
# ~/.cargo/git/db/
# target/
# key: ${{ runner.os }}-cargo-miri-${{ hashFiles('**/Cargo.toml') }}
# - uses: dtolnay/rust-toolchain@master
# with:
# toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
# components: miri
# - name: CI job
# run: cargo miri test
# env:
# RUSTFLAGS: -Zrandomize-layout
markdownlint:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: DavidAnson/markdownlint-cli2-action@v20
with:
config: ".markdownlint.jsonc"
globs: "**/*.md"
toml:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
submodules: "true"
- uses: tombi-toml/setup-tombi@v1
- name: Lint TOML files
run: tombi lint
- name: Check formatting of TOML files
run: tombi format --check
- name: Tombi info
if: failure()
run: |
echo 'To fix toml fmt, please run `tombi fmt`.'
echo 'You can find tombi here: http://tombi-toml.github.io/tombi/.'
echo 'Also use the `Tombi` extension.'
echo 'You can find the extension here: https://marketplace.visualstudio.com/items?itemName=tombi-toml.tombi'
typos:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Check for typos
uses: crate-ci/typos@v1.31.1
- name: Typos info
if: failure()
run: |
echo 'To fix typos, please run `typos -w`'
echo 'To check for a diff, run `typos`'
echo 'You can find typos here: https://crates.io/crates/typos'
echo 'if you use VS Code, you can also install `Typos Spell Checker'
echo 'You can find the extension here: https://marketplace.visualstudio.com/items?itemName=tekumara.typos-vscode'
check-doc:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-check-doc-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
- name: Build doc
run: cargo doc --workspace --all-features --no-deps --document-private-items --keep-going
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-C debuginfo=0 --cfg docsrs_dep"
- name: Check doc
run: cargo test --workspace --doc
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-C debuginfo=0 --cfg docsrs_dep"
- name: Install cargo-deadlinks
run: cargo install --force cargo-deadlinks
- name: Checks dead links
run: cargo deadlinks
continue-on-error: true
check-unused-dependencies:
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: "true"
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
# cargo-udeps requires this toolchain at runtime
- name: Install nightly toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
- name: Install cargo-udeps
uses: taiki-e/install-action@cargo-udeps
- name: Run cargo-udeps
run: cargo udeps