Repository navigation
115 lines (101 loc) · 3.51 KB
/
Copy pathci.yml
File metadata and controls
115 lines (101 loc) · 3.51 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: CI
on:
pull_request:
push:
schedule:
- cron: '0 0 * * 0' # Run weekly on Sundays
jobs:
checks:
name: Checks
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v7
with:
submodules: true
# `shell: bash` so an earlier failing command fails the step on every
# runner; the Windows default shell only reports the last command's exit
# code.
- name: Check
shell: bash
run: |
cargo check --workspace --all-targets
cargo check --workspace --all-targets --all-features
- run: cargo clippy --workspace --all-targets --all-features -- -D warnings
- run: cargo fmt --all -- --check --files-with-diff
- run: cargo doc --workspace --no-deps --all-features
- run: cargo test --workspace --all-targets --all-features
# The members require each other by version, and a stale value there
# publishes a crate pinned to the previous release. Nothing else catches
# it: the path dependency wins locally, so builds and tests stay green.
- name: Workspace version matches the in-workspace dependencies
if: runner.os == 'Linux'
shell: bash
run: |
pkg=$(grep -m1 '^version = ' Cargo.toml | cut -d'"' -f2)
echo "workspace.package.version = ${pkg:-<unset>}"
if [ -z "$pkg" ]; then
echo "::error::could not read the version from the root Cargo.toml"
exit 1
fi
for crate in openusd openusd-build; do
dep=$(grep -m1 "^$crate = { version = " Cargo.toml | cut -d'"' -f2)
echo "workspace.dependencies.$crate.version = ${dep:-<unset>}"
if [ -z "$dep" ]; then
echo "::error::could not read the $crate version from the root Cargo.toml"
exit 1
fi
if [ "$pkg" != "$dep" ]; then
echo "::error::$crate version mismatch - bump both in the root Cargo.toml"
exit 1
fi
done
deny:
name: Deny
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v7
with:
submodules: true
- uses: EmbarkStudios/cargo-deny-action@v2
coverage:
name: Coverage
runs-on: ubuntu-latest
timeout-minutes: 15
if: ${{ github.event_name != 'schedule' && github.ref_name == 'main' }}
steps:
- uses: actions/checkout@v7
with:
submodules: true
- run: cargo install grcov
- run: grcov --version
- run: cargo test --workspace --all-features
env:
RUSTFLAGS: "-Cinstrument-coverage"
LLVM_PROFILE_FILE: "target/coverage/%p-%m.profraw"
- name: Collect coverage data
run: |
grcov . \
--source-dir . \
--binary-path ./target/debug/ \
--branch \
--ignore-not-existing \
--output-types markdown,lcov \
--keep-only 'crates/*/src/*' \
--output-path ./target/coverage/
- name: Upload coverage data
uses: codecov/codecov-action@v7
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
files: ./target/coverage/lcov
verbose: true
- name: Publish job summary
run: |
echo "# Coverage" >> $GITHUB_STEP_SUMMARY
cat target/coverage/markdown.md >> $GITHUB_STEP_SUMMARY