feat: initialize this project (#1) #16
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
name: Rust | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
env: | |
# This env var is used by Swatinem/rust-cache@v2 for the cache | |
# key, so we set it to make sure it is always consistent. | |
CARGO_TERM_COLOR: always | |
# Disable full debug symbol generation to speed up CI build and keep memory down | |
# "1" means line tables only, which is useful for panic tracebacks. | |
RUSTFLAGS: "-C debuginfo=1" | |
RUST_BACKTRACE: "1" | |
# according to: https://matklad.github.io/2021/09/04/fast-rust-builds.html | |
# CI builds are faster with incremental disabled. | |
CARGO_INCREMENTAL: "0" | |
CARGO_BUILD_JOBS: "1" | |
jobs: | |
lint: | |
runs-on: ubuntu-24.04 | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: 1.83 | |
components: rustfmt, clippy | |
- uses: Swatinem/rust-cache@v2 | |
- name: Check formatting | |
run: cargo fmt -- --check | |
- name: Check clippy | |
run: cargo clippy --tests --benches -- -D warnings | |
test: | |
strategy: | |
matrix: | |
machine: | |
- ubuntu-24.04 | |
# - ubuntu-2404-4x-arm64 | |
- macos-14 | |
runs-on: ${{ matrix.machine }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: 1.83 | |
- uses: rui314/setup-mold@v1 | |
- uses: Swatinem/rust-cache@v2 | |
- name: Run tests | |
run: cargo test |