|
1 | 1 | name: CI |
2 | | - |
3 | 2 | on: |
4 | 3 | push: |
| 4 | + branches: [main] |
5 | 5 | pull_request: |
6 | | - |
| 6 | +permissions: |
| 7 | + contents: read |
7 | 8 | concurrency: |
8 | 9 | group: ${{ github.workflow }}-${{ github.ref }} |
9 | 10 | cancel-in-progress: true |
10 | | - |
11 | | -permissions: |
12 | | - contents: read |
13 | | - |
14 | | -env: |
15 | | - # Lint levels live in `[lints]` in Cargo.toml so local and CI runs agree; |
16 | | - # don't add a blanket RUSTFLAGS here. |
17 | | - CARGO_TERM_COLOR: always |
18 | | - |
19 | 11 | jobs: |
20 | | - rust: |
21 | | - name: Rust |
22 | | - runs-on: ubuntu-latest |
23 | | - steps: |
24 | | - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 |
25 | | - with: |
26 | | - # This job executes repository code (cargo build/test); don't persist |
27 | | - # the token in git config. |
28 | | - persist-credentials: false |
29 | | - submodules: true |
30 | | - |
31 | | - - uses: dtolnay/rust-toolchain@686976e191b89faba57d3206551f0f330d8cb249 # stable |
32 | | - with: |
33 | | - components: rustfmt, clippy |
34 | | - |
35 | | - - uses: taiki-e/install-action@be76f545a6a2f94fb131c5bb748ebed32edb5760 # cargo-llvm-cov |
36 | | - |
37 | | - - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2 |
38 | | - |
39 | | - - name: Check formatting |
40 | | - run: cargo fmt --all -- --check |
41 | | - |
42 | | - - name: Clippy |
43 | | - run: cargo clippy --all-targets --all-features -- -D warnings |
44 | | - |
45 | | - - name: Build |
46 | | - run: cargo build --all-targets --all-features |
47 | | - |
48 | | - - name: Test |
49 | | - run: cargo test --all-features |
50 | | - |
51 | | - - name: Test default features |
52 | | - run: cargo test |
53 | | - |
54 | | - - name: Require 90% line coverage in every source file |
55 | | - run: .github/scripts/check-file-coverage.sh 90 coverage.json |
56 | | - |
57 | | - - name: Upload coverage report |
58 | | - if: ${{ always() }} |
59 | | - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7 |
60 | | - with: |
61 | | - name: coverage-json |
62 | | - path: coverage.json |
63 | | - if-no-files-found: ignore |
64 | | - |
65 | | - jail-platforms: |
66 | | - name: Jail (${{ matrix.os }}) |
67 | | - strategy: |
68 | | - fail-fast: false |
69 | | - matrix: |
70 | | - os: [ubuntu-latest, macos-latest, windows-latest] |
71 | | - runs-on: ${{ matrix.os }} |
72 | | - steps: |
73 | | - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 |
74 | | - with: |
75 | | - persist-credentials: false |
76 | | - submodules: true |
77 | | - - uses: dtolnay/rust-toolchain@686976e191b89faba57d3206551f0f330d8cb249 # stable |
78 | | - - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2 |
79 | | - - name: Constraint and jail tests |
80 | | - run: cargo test -p tinybox-core -p tinybox-jail --all-features |
81 | | - - name: Jail without Landlock feature |
82 | | - run: cargo test -p tinybox-jail --no-default-features |
83 | | - - name: Native process supervision tests |
84 | | - if: matrix.os == 'windows-latest' |
85 | | - run: cargo test --locked --all-features -p tinybox-host -p tinybox-module |
86 | | - |
87 | | - docs: |
88 | | - name: Docs |
89 | | - runs-on: ubuntu-latest |
90 | | - steps: |
91 | | - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 |
92 | | - with: |
93 | | - persist-credentials: false |
94 | | - submodules: true |
95 | | - |
96 | | - - uses: dtolnay/rust-toolchain@686976e191b89faba57d3206551f0f330d8cb249 # stable |
97 | | - |
98 | | - - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2 |
99 | | - |
100 | | - - name: Build documentation |
101 | | - env: |
102 | | - RUSTDOCFLAGS: -D warnings |
103 | | - run: cargo doc --no-deps --all-features |
104 | | - |
105 | | - msrv: |
106 | | - name: Minimum supported Rust version |
107 | | - runs-on: ubuntu-latest |
108 | | - steps: |
109 | | - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 |
110 | | - with: |
111 | | - persist-credentials: false |
112 | | - submodules: true |
113 | | - |
114 | | - - name: Read rust-version from Cargo.toml |
115 | | - id: msrv |
116 | | - run: | |
117 | | - set -euo pipefail |
118 | | - # Members inherit `rust-version` from `[workspace.package]`, and |
119 | | - # `packages[0]` is arbitrary in a workspace, so take the highest |
120 | | - # declared MSRV across every member. |
121 | | - msrv="$(cargo metadata --format-version 1 --no-deps \ |
122 | | - | jq -r '[.packages[].rust_version | select(. != null)] |
123 | | - | sort_by(split(".") | map(tonumber)) |
124 | | - | last // ""')" |
125 | | - if [[ -z "$msrv" || "$msrv" == "null" ]]; then |
126 | | - echo "workspace.package.rust-version is not set in Cargo.toml" >&2 |
127 | | - exit 1 |
128 | | - fi |
129 | | - echo "version=$msrv" >> "$GITHUB_OUTPUT" |
130 | | -
|
131 | | - - uses: dtolnay/rust-toolchain@e2a55d2ffb04f378e9626c28d38b36d230d1e12f # master |
132 | | - with: |
133 | | - toolchain: ${{ steps.msrv.outputs.version }} |
134 | | - |
135 | | - - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2 |
136 | | - |
137 | | - - name: Build with the declared MSRV |
138 | | - run: cargo build --all-targets --all-features |
139 | | - |
140 | | - supply-chain: |
141 | | - name: Supply chain |
142 | | - runs-on: ubuntu-latest |
143 | | - steps: |
144 | | - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 |
145 | | - with: |
146 | | - persist-credentials: false |
147 | | - submodules: true |
148 | | - |
149 | | - - name: Check advisories, licenses, bans, and sources |
150 | | - uses: EmbarkStudios/cargo-deny-action@3c6349835b2b7b196a839186cb8b78e02f7b5f25 # v2 |
151 | | - with: |
152 | | - command: check all |
| 12 | + module-ci: |
| 13 | + uses: tinyhumansai/.github/.github/workflows/module-ci.yml@4adc1080fb495098e7af1aade82ed7e6e3c69bb7 |
| 14 | + with: |
| 15 | + coverage-script: scripts/check-coverage.sh |
| 16 | + module-e2e-script: scripts/test-e2e.sh |
| 17 | + feature-test-script: scripts/test-features.sh |
0 commit comments