Skip to content

Commit 35d4cdb

Browse files
authored
Merge pull request #6 from tdejager/feat/extend-pipeline
2 parents a166369 + bb2c6f2 commit 35d4cdb

File tree

2 files changed

+89
-64
lines changed

2 files changed

+89
-64
lines changed

.github/workflows/rust-compile.yml

Lines changed: 67 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,75 @@
11
on:
2-
push:
3-
branches:
2+
push:
3+
branches:
44
- "main"
5-
pull_request:
6-
5+
pull_request:
6+
77
name: Rust
8-
8+
99
concurrency:
10-
group: ${{ github.workflow }}-${{ github.ref }}
11-
cancel-in-progress: true
12-
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
1313
env:
14-
RUST_LOG: info
15-
RUST_BACKTRACE: 1
16-
RUSTFLAGS: "-D warnings"
17-
CARGO_TERM_COLOR: always
18-
14+
RUST_LOG: info
15+
RUST_BACKTRACE: 1
16+
RUSTFLAGS: "-D warnings"
17+
CARGO_TERM_COLOR: always
18+
1919
jobs:
20-
check-rustdoc-links:
21-
name: Check intra-doc links
22-
runs-on: ubuntu-latest
23-
steps:
24-
- uses: actions/checkout@v4
25-
- uses: actions-rust-lang/setup-rust-toolchain@v1
26-
- run: |
27-
for package in $(cargo metadata --no-deps --format-version=1 | jq -r '.packages[] | .name'); do
28-
cargo rustdoc -p "$package" --all-features -- -D warnings -W unreachable-pub
29-
done
30-
31-
format_and_lint:
32-
name: Format and Lint
33-
runs-on: ubuntu-latest
34-
steps:
35-
- uses: actions/checkout@v4
36-
with:
37-
submodules: recursive
38-
- uses: actions-rust-lang/setup-rust-toolchain@v1
39-
with:
40-
components: clippy, rustfmt
41-
- name: Run rustfmt
42-
uses: actions-rust-lang/rustfmt@v1
43-
- name: Run clippy
44-
run: cargo clippy --all-targets
45-
46-
test:
47-
name: Test
48-
runs-on: ubuntu-latest
49-
needs: [ format_and_lint ]
50-
steps:
51-
- name: Checkout source code
52-
uses: actions/checkout@v4
20+
check-rustdoc-links:
21+
name: Check intra-doc links
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
- uses: actions-rust-lang/setup-rust-toolchain@v1
26+
- shell: bash
27+
run: >
28+
./intra-doc-links.bash
29+
format_and_lint:
30+
name: Format and Lint
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v4
34+
with:
35+
submodules: recursive
36+
- uses: actions-rust-lang/setup-rust-toolchain@v1
37+
with:
38+
components: clippy, rustfmt
39+
- name: Run rustfmt
40+
uses: actions-rust-lang/rustfmt@v1
41+
- name: Run clippy
42+
run: cargo clippy --all-targets
43+
44+
test:
45+
name: Test
46+
strategy:
47+
fail-fast: false
48+
matrix:
49+
os: [ubuntu-latest, macos-latest, windows-latest]
50+
runs-on: ${{ matrix.os }}
51+
needs: [format_and_lint]
52+
steps:
53+
- name: Checkout source code
54+
uses: actions/checkout@v4
55+
56+
- name: Install Rust toolchain
57+
uses: actions-rust-lang/setup-rust-toolchain@v1
58+
with:
59+
components: rustfmt
60+
cache: false
61+
62+
- uses: Swatinem/rust-cache@v2
63+
64+
- name: Install cargo nextest
65+
uses: taiki-e/install-action@v2
66+
with:
67+
tool: cargo-nextest
5368

54-
- name: Install Rust toolchain
55-
uses: actions-rust-lang/setup-rust-toolchain@v1
56-
with:
57-
components: rustfmt
58-
cache: false
69+
- name: Run tests
70+
run: >
71+
cargo nextest run --workspace
5972
60-
- name: Install cargo nextest
61-
uses: taiki-e/install-action@v2
62-
with:
63-
tool: cargo-nextest
64-
65-
- name: Run tests
66-
run: >
67-
cargo nextest run --workspace
68-
69-
- name: Run doctests
70-
run: >
71-
cargo test --doc
72-
73+
- name: Run doctests
74+
run: >
75+
cargo test --doc

intra-doc-links.bash

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
cargo metadata --no-deps --format-version=1 \
3+
| jq -r '.packages[] | .name as $pname | .targets[] | [$pname, .kind[], .name] | @tsv' \
4+
| while IFS=$'\t' read -r package kind name; do
5+
case "$kind" in
6+
lib)
7+
cargo rustdoc -p "$package" --lib --all-features -- -D warnings -W unreachable-pub
8+
;;
9+
bin)
10+
cargo rustdoc -p "$package" --bin "$name" --all-features -- -D warnings -W unreachable-pub
11+
;;
12+
example)
13+
cargo rustdoc -p "$package" --example "$name" --all-features -- -D warnings -W unreachable-pub
14+
;;
15+
test)
16+
cargo rustdoc -p "$package" --test "$name" --all-features -- -D warnings -W unreachable-pub
17+
;;
18+
bench)
19+
cargo rustdoc -p "$package" --bench "$name" --all-features -- -D warnings -W unreachable-pub
20+
;;
21+
esac
22+
done

0 commit comments

Comments
 (0)