Skip to content

[cargo-hakari] add edition = 2021 to new project template #1219

[cargo-hakari] add edition = 2021 to new project template

[cargo-hakari] add edition = 2021 to new project template #1219

Workflow file for this run

on:
push:
branches:
- main
pull_request:
branches:
- main
name: CI
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
env:
RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2
- name: Lint (clippy)
run: cargo clippy --all-features --all-targets
- name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack
- name: Lint (rustfmt)
run: cargo xfmt --check
- name: Install cargo readme
uses: taiki-e/install-action@3451569d988f3b0b3eaccd1d1b539a75ec96f192 # v2
with:
tool: cargo-readme
- name: Run cargo readme
run: ./scripts/regenerate-readmes.sh
- name: Check for differences
run: git diff --exit-code
# cargo hack might cause changes to Cargo.lock which can cause the git diff above to fail. Put
# this at the end.
- name: Clippy feature powerset for target-spec
run: cargo hack --feature-powerset --package target-spec clippy
build:
name: Build and test core crates
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-14, windows-latest]
rust-version: ["1.75", stable]
fail-fast: false
env:
RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust-version }}
- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2
# Build all packages we care about one by one to ensure feature unification
# doesn't happen.
# Build all targets to ensure examples are built as well.
- name: Build target-spec
run: cargo build --all-targets --package target-spec
- name: Build guppy-summaries
run: cargo build --all-targets --package guppy-summaries
- name: Build guppy
run: cargo build --all-targets --package guppy
- name: Build determinator
run: cargo build --all-targets --package determinator
- name: Build hakari
run: cargo build --all-targets --package hakari
- name: Install latest nextest release
uses: taiki-e/install-action@nextest
- name: Run tests for core crates
run: cargo nextest run --package target-spec --package guppy-summaries --package guppy --package determinator --package hakari
- name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack
- name: Check feature powerset for target-spec
run: cargo hack --feature-powerset --package target-spec nextest run
build-all-features:
name: Build and test (all features)
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-14, windows-latest]
rust-version: ["1.75", stable]
fail-fast: false
env:
RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust-version }}
- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2
- name: Build
# Build all targets to ensure examples are built as well.
# Exclude cargo-compare so that it only runs on the cfg-expr version below.
run: cargo test --no-run --all-targets --all-features --workspace --exclude cargo-compare
- name: Run doctests
run: cargo test --doc --all-features --workspace --exclude cargo-compare
- name: Install latest nextest release
uses: taiki-e/install-action@nextest
- name: Run all other tests
run: cargo nextest run --all-targets --all-features --workspace --exclude cargo-compare
build-rustdoc:
name: Build documentation
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
fail-fast: false
env:
RUSTDOCFLAGS: -D warnings
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: dtolnay/rust-toolchain@stable
# Note: caching doesn't appear to work for rustdoc as of 2022-12-04, and we're exceeding cache
# sizes anyway
- name: Build rustdoc
# cargo-compare currently pulls in cargo which bloats build times massively
run: cargo doc --all-features --workspace --exclude cargo-compare
test-extended:
name: cargo-compare extended tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
# Don't run cargo-compare tests on Windows for now. See
# https://github.com/facebookincubator/cargo-guppy/issues/265.
os: [ubuntu-latest, macos-14]
fail-fast: false
env:
RUSTFLAGS: -D warnings
PROPTEST_MULTIPLIER: 64
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
# This matches the cfg-expr version.
- uses: dtolnay/[email protected]
- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2
- name: Build and test
run: cargo test --package cargo-compare --release
aarch64-build:
runs-on: ubuntu-latest
name: Cross-compile to aarch64
env:
RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-unknown-linux-gnu
- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2
- name: Build
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1
with:
use-cross: true
command: build
# * Exclude cargo-compare because it depends on cargo, which in turn
# depends on openssl, and getting *that* to cross-compile is a
# headache.
# * Build all targets to ensure examples are built as well.
args: --target aarch64-unknown-linux-gnu --workspace --exclude cargo-compare --all-targets
# TODO: run tests somehow? possibly through cross/qemu