-
Notifications
You must be signed in to change notification settings - Fork 29
139 lines (131 loc) · 4.13 KB
/
ci.yml
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: CI
on:
push:
branches:
- main
pull_request:
merge_group:
jobs:
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Test
run: |
cargo test --lib
cargo test --bins --examples
cargo test --doc
integration-tests:
name: Integration Tests
runs-on: [self-hosted]
steps:
- name: Install gdb
run: |
sudo apt-get update
sudo apt-get install gdb
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Integration Tests
run: cargo test --test '*'
run_images:
name: Run images
runs-on: [self-hosted]
steps:
- uses: actions/checkout@v4
with:
lfs: true
- run: git lfs checkout
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- run: cargo build
- name: Run images
timeout-minutes: 1
run: |
cargo run -- -v data/x86_64/hello_world
cargo run -- -v benches_data/rusty_demo
cargo run -- -v data/x86_64/hello_c
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# TODO: Remove this, once https://github.com/rust-lang/rustfmt/issues/4991 is resolved
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: Format
run: cargo fmt --all -- --check
- name: Install rustfmt for Test Kernels
run: rustup component add rustfmt
working-directory: tests/test-kernels
- name: Format Test Kernels
run: cargo fmt --all -- --check
working-directory: tests/test-kernels
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-gnu, x86_64-apple-darwin, aarch64-apple-darwin
components: clippy
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Clippy
run: cargo clippy --all-targets --target x86_64-unknown-linux-gnu --target x86_64-apple-darwin --target aarch64-apple-darwin -- -D warnings
clippy-test-kernel:
name: Clippy test-kernels
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Install clippy for Test Kernels
run: rustup component add clippy
working-directory: tests/test-kernels
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Clippy Test Kernels
run: cargo clippy --all-targets -- -D warnings
working-directory: tests/test-kernels
env:
# TODO: Remove once we have a hermit toolchain upgrade
# capable of sparse registries
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: git
coverage:
name: Coverage
runs-on: [self-hosted]
steps:
- name: Install gdb
run: |
sudo apt-get update
sudo apt-get install gdb
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Install cargo-llvm-cov
run: curl -LsSf https://github.com/taiki-e/cargo-llvm-cov/releases/latest/download/cargo-llvm-cov-x86_64-unknown-linux-gnu.tar.gz | tar xzf - -C ~/.cargo/bin
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Generate code coverage
run: cargo llvm-cov --lcov --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}