-
Notifications
You must be signed in to change notification settings - Fork 4
50 lines (37 loc) · 1.33 KB
/
build-and-test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# SPDX-FileCopyrightText: slowtec GmbH
# SPDX-License-Identifier: CC0-1.0
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow
name: build-and-test
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
RUST_BACKTRACE: short
jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Check out repository
uses: actions/checkout@v4
- name: Generate Cargo.lock
run: cargo generate-lockfile
- name: Cache Rust toolchain and build artifacts
uses: Swatinem/rust-cache@v2
with:
# The cache should not be shared between different workflows and jobs.
shared-key: ${{ github.workflow }}-${{ github.job }}
- name: Build tests with default features disabled
run: cargo test --workspace --locked --no-default-features --no-run
- name: Run tests with all features enabled
run: cargo test --workspace --locked --all-features -- --nocapture --quiet
- name: Build workspace documentation with all features enabled
run: cargo doc --workspace --locked --all-features
- name: Build release with default features
run: cargo build --locked --profile release