Skip to content

ci: Update CI for building and testing #160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 45 additions & 27 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,72 @@
name: Build and test
permissions:
contents: read

on:
name: Build
'on':
push:
branches: [main, dev]
branches:
- main
pull_request:
branches: [main, dev]

permissions:
contents: read
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: '${{ github.workflow }}-${{ github.ref }}'
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always

jobs:
build-and-test:
name: Build and Test (Stable)
runs-on: ${{ matrix.os }}

test:
runs-on: '${{ matrix.os }}'
name: '${{ matrix.os }} / stable'
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest] # Temp remove ubuntu-latest

os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Rust (stable)
uses: actions-rs/toolchain@v1
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
override: true
components: clippy, rustfmt

- name: Cache cargo registry, git, and target
components: rustfmt, clippy

- name: Setup cache
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-

- name: Build

- name: Check formatting
run: cargo fmt --all -- --check

- name: Build (no features)
run: cargo build --verbose --no-default-features

- name: Build (default features)
run: cargo build --verbose

- name: Test

- name: Build (all features)
run: cargo build --verbose --all-features

- name: Run tests (no features)
run: cargo test --verbose --no-default-features

- name: Run tests (default features)
run: cargo test --verbose

- name: Run tests (all features)
run: cargo test --verbose --all-features

- name: Run doc tests
run: cargo test --doc --all-features
Loading