-
Notifications
You must be signed in to change notification settings - Fork 89
92 lines (88 loc) · 3.36 KB
/
Copy pathtest.yml
File metadata and controls
92 lines (88 loc) · 3.36 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
name: Test
on:
push:
branches: [ master ]
workflow_dispatch:
pull_request:
branches: [ master ]
jobs:
build-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
smp-feature: [ "", "smp" ]
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
rustflags: ""
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y qemu-system-aarch64 wget jq e2fsprogs
- name: Install arm toolchain
run: |
./scripts/download-arm-toolchain.sh /tmp/arm-toolchain.tar.xz
mkdir -p /opt/arm-toolchain
tar -xf /tmp/arm-toolchain.tar.xz -C /opt/arm-toolchain --strip-components=1
rm /tmp/arm-toolchain.tar.xz
- name: Update PATH for arm toolchain
run: echo "/opt/arm-toolchain/bin:$PATH" >> $GITHUB_PATH
- name: Create Image
run: ./scripts/create-image.sh
# If all features are disabled
- name: Run tests
if: ${{ matrix.smp-feature == '' }}
run: |
cargo run -r --no-default-features -- --init /bin/usertest >> usertest.log
cargo test -r --no-default-features >> unittest.log
# If any feature is enabled
- name: Run tests
if: ${{ matrix.smp-feature == 'smp' }}
run: |
cargo run -r --no-default-features --features "${{ matrix.smp-feature }}" -- --init /bin/usertest >> usertest.log
cargo test -r --no-default-features --features "${{ matrix.smp-feature }}" >> unittest.log
- name: Display usertest output
run: cat usertest.log
- name: Display unit test output
run: cat unittest.log
- name: Check for usertest success line
run: grep -q "All tests passed in " usertest.log || (echo "Usertests failed" && exit 1)
- name: Check for unit test success line
run: |
grep -q "test result: .*ok.*\..*passed" unittest.log || (echo "Unit tests failed" && exit 1)
- name: Upload usertest output as artifact
uses: actions/upload-artifact@v6
with:
name: usertest-output-${{ matrix.smp-feature || 'up' }}
path: usertest.log
- name: Upload unittest output as artifact
uses: actions/upload-artifact@v6
with:
name: unittest-output-${{ matrix.smp-feature || 'up' }}
path: unittest.log
upload-image:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y qemu-system-aarch64 wget jq e2fsprogs
- name: Install arm toolchain
run: |
./scripts/download-arm-toolchain.sh /tmp/arm-toolchain.tar.xz
mkdir -p /opt/arm-toolchain
tar -xf /tmp/arm-toolchain.tar.xz -C /opt/arm-toolchain --strip-components=1
rm /tmp/arm-toolchain.tar.xz
- name: Update PATH for arm toolchain
run: echo "/opt/arm-toolchain/bin:$PATH" >> $GITHUB_PATH
- name: Create Image
run: ./scripts/create-image.sh
- name: Upload image as artifact
uses: actions/upload-artifact@v6
with:
name: moss.img
path: moss.img