Use more obvious syntax for cloning tasks #55
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
# Copyright (C) 2022-2023 Daniel Mueller <[email protected]> | |
# SPDX-License-Identifier: GPL-3.0-or-later | |
name: Test | |
on: | |
pull_request: | |
push: | |
workflow_call: | |
env: | |
CARGO_TERM_COLOR: always | |
RUST_BACKTRACE: 1 | |
# Build without debug information enabled to decrease compilation time | |
# and binary sizes in CI. This option is assumed to only have marginal | |
# effects on the generated code, likely only in terms of section | |
# arrangement. See | |
# https://doc.rust-lang.org/cargo/reference/environment-variables.html | |
# https://doc.rust-lang.org/rustc/codegen-options/index.html#debuginfo | |
RUSTFLAGS: '-C debuginfo=0' | |
jobs: | |
build: | |
name: Build [${{ matrix.rust }}, ${{ matrix.profile }}] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
rust: [1.65.0, stable] | |
profile: [dev, release] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
profile: minimal | |
override: true | |
- name: Build ${{ matrix.profile }} | |
run: | | |
cargo build --profile=${{ matrix.profile }} --bins --tests --examples --features=test | |
test: | |
name: Test and coverage | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install cargo-llvm-cov | |
uses: taiki-e/install-action@cargo-llvm-cov | |
- name: Test and gather coverage | |
# We lack a TTY, so we hack one with `script`. | |
shell: script --quiet --return --command "bash {0}" | |
run: | |
cargo llvm-cov --lcov --output-path lcov.info --features=test | |
- name: Upload code coverage results | |
uses: codecov/codecov-action@v3 | |
with: | |
files: lcov.info | |
bench: | |
name: Benchmark | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
profile: minimal | |
override: true | |
- run: | | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
cargo bench --features=nightly --quiet -- bench_ >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
clippy: | |
name: Lint with clippy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
components: clippy | |
override: true | |
- run: | | |
cargo clippy --no-deps --tests -- -A unknown_lints -D warnings | |
cargo clippy --no-deps --features=readline -- -A unknown_lints -D warnings |