-
Notifications
You must be signed in to change notification settings - Fork 21
163 lines (158 loc) · 6.04 KB
/
test.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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: Test CI
on:
push:
pull_request:
workflow_call:
inputs:
TopTestDirectory:
description: 'The directory where the main repository will be placed'
required: true
type: string
CallerPackage:
description: 'The package to call the workflow'
required: true
type: string
CallerRepository:
description: 'The repository to call the workflow'
required: true
type: string
CallerCommit:
description: 'The commit of the repository to call the workflow'
required: true
type: string
TopBranch:
description: 'The branch of the main repository'
required: false
type: string
default: 'main'
env:
qemu-version: 8.2.0
rust-toolchain: nightly-2024-05-02
jobs:
prepare_for_external_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: step1
if: github.repository != 'Starry-OS/Starry'
# 输出的值可以在后续的job中使用
run: echo "TopTestDirectory=${{ inputs.TopTestDirectory }}" >> $GITHUB_OUTPUT
- id: step2
if: github.repository == 'Starry-OS/Starry'
run: echo "TopTestDirectory=./" >> $GITHUB_OUTPUT
outputs:
TopTestDirectory: ${{ steps.step1.outputs.TopTestDirectory || steps.step2.outputs.TopTestDirectory }}
app-test-for-unikernel:
needs: prepare_for_external_test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
arch: [x86_64, riscv64, aarch64]
env:
WORKING_DIRECTORY: ${{ needs.prepare_for_external_test.outputs.TopTestDirectory }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.rust-toolchain }}
components: rust-src
- uses: Swatinem/rust-cache@v2
- run: cargo install cargo-binutils
- name: Clone Top Repository
if: github.repository != 'Starry-OS/Starry'
run: |
git clone https://github.com/Starry-OS/Starry.git ${{ env.WORKING_DIRECTORY }} && cd ${{ env.WORKING_DIRECTORY }} && git checkout ${{ inputs.TopBranch }} && cd ..
sh ${{ env.WORKING_DIRECTORY }}/scripts/test/external_test.sh ${{ env.WORKING_DIRECTORY }} ${{ inputs.CallerPackage }} ${{ inputs.CallerRepository }} ${{ inputs.CallerCommit }}
- name: Update Top Repository
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make pre_update
- uses: ./.github/workflows/actions/setup-qemu
with:
qemu-version: ${{ env.qemu-version }}
- uses: ./.github/workflows/actions/setup-musl
with:
arch: ${{ matrix.arch }}
- name: Run app tests
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
make disk_img
make test ARCH=${{ matrix.arch }}
app-test-for-monolithic:
needs: prepare_for_external_test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
arch: [x86_64, riscv64, aarch64]
env:
WORKING_DIRECTORY: ${{ needs.prepare_for_external_test.outputs.TopTestDirectory }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.rust-toolchain }}
components: rust-src
- uses: Swatinem/rust-cache@v2
- run: cargo install cargo-binutils
- name: Clone Top Repository
if: github.repository != 'Starry-OS/Starry'
run: |
git clone https://github.com/Starry-OS/Starry.git ${{ env.WORKING_DIRECTORY }} && cd ${{ env.WORKING_DIRECTORY }} && git checkout ${{ inputs.TopBranch }} && cd ..
sh ${{ env.WORKING_DIRECTORY }}/scripts/test/external_test.sh ${{ env.WORKING_DIRECTORY }} ${{ inputs.CallerPackage }} ${{ inputs.CallerRepository }} ${{ inputs.CallerCommit }}
- name: Update Top Repository
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make pre_update
- uses: ./.github/workflows/actions/setup-qemu
with:
qemu-version: ${{ env.qemu-version }}
- uses: ./.github/workflows/actions/setup-musl
with:
arch: ${{ matrix.arch }}
- name: Run app tests
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
make disk_img
make test_monolithic ARCH=${{ matrix.arch }}
app-test-for-ext4fs:
needs: prepare_for_external_test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
arch: [x86_64, riscv64, aarch64]
env:
WORKING_DIRECTORY: ${{ needs.prepare_for_external_test.outputs.TopTestDirectory }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.rust-toolchain }}
components: rust-src
- uses: Swatinem/rust-cache@v2
- run: cargo install cargo-binutils
- name: Clone Top Repository
if: github.repository != 'Starry-OS/Starry'
run: |
git clone https://github.com/Starry-OS/Starry.git ${{ env.WORKING_DIRECTORY }} && cd ${{ env.WORKING_DIRECTORY }} && git checkout ${{ inputs.TopBranch }} && cd ..
sh ${{ env.WORKING_DIRECTORY }}/scripts/test/external_test.sh ${{ env.WORKING_DIRECTORY }} ${{ inputs.CallerPackage }} ${{ inputs.CallerRepository }} ${{ inputs.CallerCommit }}
- name: Update Top Repository
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make pre_update
- uses: ./.github/workflows/actions/setup-qemu
with:
qemu-version: ${{ env.qemu-version }}
- uses: ./.github/workflows/actions/setup-musl
with:
arch: ${{ matrix.arch }}
- name: Run app tests
working-directory: ${{ needs.prepare_for_external_test.outputs.TopTestDirectory }}
run: |
sh ./build_img.sh -a ${{ matrix.arch }} -fs ext4
export MONOLITHIC_TESTCASE=other
make ARCH=${{ matrix.arch }} A=apps/monolithic_userboot APP_FEATURES=batch FEATURES="lwext4_rust" LOG=off ACCEL=n run
make clean
make ARCH=${{ matrix.arch }} A=apps/monolithic_userboot APP_FEATURES=batch FEATURES="ext4_rs" LOG=off ACCEL=n run