Skip to content
Merged
Show file tree
Hide file tree
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: 67 additions & 5 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,89 @@ on:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:

permissions:
contents: read

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

jobs:
check-style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Report cargo version
run: cargo --version
- name: Report rustfmt version
run: cargo fmt -- --version
- name: Check style
run: cargo fmt -- --check
run: cargo fmt --all -- --check

clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
- name: Report clippy version
run: cargo clippy --version
- name: Run clippy
run: cargo clippy --locked --workspace --all-targets --all-features -- -D warnings

docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
- name: Build documentation
run: cargo doc --locked --no-deps --all-features --workspace
env:
RUSTDOCFLAGS: -D warnings

# Runs everything, including the trybuild compile-fail test, under the
# toolchain pinned by rust-toolchain.toml.
build-and-test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
steps:
- uses: actions/checkout@v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
- name: Build
run: cargo build --locked --workspace --tests --verbose
- name: Run tests
run: cargo test --locked --workspace --no-fail-fast --verbose

msrv:
runs-on: ubuntu-latest
env:
# rust-toolchain.toml would otherwise override whatever
# dtolnay/rust-toolchain selects; this variable overrides
# rust-toolchain.toml, so this job really uses the MSRV compiler.
# Without it the job silently builds with the pinned toolchain and
# proves nothing.
RUSTUP_TOOLCHAIN: "1.97"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable
with:
# Keep "1.97" (here and in RUSTUP_TOOLCHAIN above) in sync with
# rust-version in Cargo.toml.
toolchain: "1.97"
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
key: msrv
- name: Report cargo version
run: cargo --version
- name: Report rustc version
run: rustc --version
- name: Build
run: cargo build --locked --tests --verbose
run: cargo build --locked --workspace --tests --verbose
- name: Run tests
run: cargo test --locked --verbose
# test_compile_fail (trybuild) runs in build-and-test, on the
# pinned toolchain: it compares against compiler diagnostics,
# which drift between releases.
run: cargo test --locked --workspace --no-fail-fast --verbose -- --skip test_compile_fail
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ members = [

resolver = "2"

[workspace.package]
rust-version = "1.97"

[workspace.dependencies]
typify = { version = "0.10.1", path = "typify" }
typify-impl = { version = "0.10.1", path = "typify-impl" }
Expand Down
1 change: 1 addition & 0 deletions cargo-typify/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ repository = "https://github.com/oxidecomputer/typify"
readme = "README.md"
keywords = ["json", "schema", "cargo"]
categories = ["api-bindings", "compilers"]
rust-version.workspace = true

default-run = "cargo-typify"

Expand Down
1 change: 1 addition & 0 deletions typify-impl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ license = "Apache-2.0"
description = "typify backend implementation"
repository = "https://github.com/oxidecomputer/typify"
readme = "../README.md"
rust-version.workspace = true

[dependencies]
heck = { workspace = true }
Expand Down
1 change: 1 addition & 0 deletions typify-macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ license = "Apache-2.0"
description = "typify macro implementation"
repository = "https://github.com/oxidecomputer/typify"
readme = "../README.md"
rust-version.workspace = true

[lib]
proc-macro = true
Expand Down
1 change: 1 addition & 0 deletions typify/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ repository = "https://github.com/oxidecomputer/typify"
readme = "../README.md"
keywords = ["json", "schema", "proc_macro"]
categories = ["api-bindings", "compilers"]
rust-version.workspace = true

[features]
default = ["macro"]
Expand Down
Loading