Repository navigation
234 lines (224 loc) · 8.8 KB
/
Copy pathci.yml
File metadata and controls
234 lines (224 loc) · 8.8 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
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
name: CI
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
# ゲスト命令の大量実行を最適化する。debug assertions / overflow checks は既定のまま。
CARGO_PROFILE_DEV_OPT_LEVEL: "2"
CARGO_PROFILE_TEST_OPT_LEVEL: "2"
PYTHON_VERSION: "3.12"
jobs:
# testbench を先に配布し、Rust 統合テストと Python の各テスト群を並列に開始する。
rust:
name: Rust testbench build
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
- name: Install system packages
run: sudo apt-get update && sudo apt-get install -y libasound2-dev libudev-dev
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
shared-key: ci
- name: Build src32_testbench
run: cargo build --bin src32_testbench
- uses: actions/upload-artifact@v4
with:
name: src32_testbench
path: target/debug/src32_testbench
retention-days: 7
rust-tests:
name: Rust integration tests
needs: rust
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
- name: Install system packages
run: sudo apt-get update && sudo apt-get install -y libasound2-dev libudev-dev
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
shared-key: ci
- uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Build sol guest images used by integration tests
run: |
set -e
mkdir -p target/guests
build() {
python3 tools/solc/solc.py compile "$1" -o "target/guests/$2.a"
python3 tools/asm/asm.py "target/guests/$2.a" -o "$2.bin"
}
build dos.sol dos
build tinybasic.sol tinybasic
build tools/dsfs/dsfs_smoke.sol dsfs_guest
# lib の単体テストは外部リポジトリ (s3w2_core) の golden ファイルを include するため
# CI ではビルドできない。tests/ の統合テストだけを実行する。
# strek_* と tb_load_live は既知の失敗/外部ファイル依存なので known-failures ジョブへ回す。
- name: Integration tests
run: |
set -e
args=()
for f in tests/*.rs; do
name=$(basename "$f" .rs)
case "$name" in
strek_micro|strek_smoke|strek_verify|tb_load_live) continue ;;
esac
args+=(--test "$name")
done
cargo test --no-fail-fast "${args[@]}"
# 失敗が既知のテスト。ステップ単位の continue-on-error なので PR のチェックは緑のまま、
# 結果はこのジョブのログ (Known-failing tests ステップ) で確認できる。
known-failures:
name: Rust known failures (non-blocking)
needs: rust
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
- name: Install system packages
run: sudo apt-get update && sudo apt-get install -y libasound2-dev libudev-dev
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
shared-key: ci
- uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Build sol guest images
run: |
set -e
mkdir -p target/guests
python3 tools/solc/solc.py compile dos.sol -o target/guests/dos.a
python3 tools/asm/asm.py target/guests/dos.a -o dos.bin
python3 tools/solc/solc.py compile tinybasic.sol -o target/guests/tinybasic.a
python3 tools/asm/asm.py target/guests/tinybasic.a -o tinybasic.bin
- name: Known-failing tests
continue-on-error: true
run: |
cargo test --no-fail-fast --test strek_micro --test strek_smoke --test tb_load_live
# LLVM/SRC32 ツールチェーンと Foundation の受け入れテスト (test_toolchain.py)。
# Clang は llvmlite が組み込んでいる LLVM と同じメジャーバージョンを使う
# (ずれると -O1/-O2 で "icmp constexprs" エラーになる)。
toolchain:
name: LLVM toolchain + Foundation tests (${{ matrix.suite }})
strategy:
fail-fast: false
matrix:
suite: [toolchain, shell, disk, sol-libfnd]
needs: rust
# Rust 統合テストとは独立し、testbench のビルド成功後に実行する。
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: pip
cache-dependency-path: tools/llvm-src32/requirements.txt
- name: Install Python packages
run: pip install -r tools/llvm-src32/requirements.txt pytest
- name: Install Clang matching llvmlite
run: |
set -e
major=$(python -c "import llvmlite.binding as l; print(l.llvm_version_info[0])")
echo "llvmlite uses LLVM $major"
wget -q https://apt.llvm.org/llvm.sh
sudo bash llvm.sh "$major"
echo "CLANG=/usr/bin/clang-$major" >> "$GITHUB_ENV"
- uses: actions/download-artifact@v4
with:
name: src32_testbench
path: target/debug
- name: Prepare testbench
run: |
chmod +x target/debug/src32_testbench
echo "SRC32_TESTBENCH=$PWD/target/debug/src32_testbench" >> "$GITHUB_ENV"
- name: Toolchain tests
if: matrix.suite == 'toolchain'
run: |
"$CLANG" --version
python -m unittest discover -s foundation/tests/cpu -v
python -m unittest discover -s foundation/tests/panic -v
python -m unittest discover -s tools/llvm-src32 -p 'test_*.py' -v
- name: Foundation shell (testbench, PCG screen)
if: matrix.suite == 'shell'
run: python -m unittest discover -s foundation/tests/shell -v
- name: Foundation disk boot (testbench, BIOS -> stage1 -> FNDBOOT)
if: matrix.suite == 'disk'
run: python -m unittest discover -s foundation/tests/disk -v
- name: sol guests using libfnd (testbench, real services)
if: matrix.suite == 'sol-libfnd'
run: python -m pytest tools/solc/test_sol_libfnd.py -q
# sol コンパイラ / VM / LSP、WAX ツール、Foundation WAX ローダのホストテスト。
# sol の Foundation 実行テストは testbench を使う。
solc:
name: sol compiler + WAX tests
needs: rust
# Rust 統合テストとは独立し、testbench のビルド成功後に実行する。
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
- run: pip install pytest
- uses: actions/download-artifact@v4
with:
name: src32_testbench
path: target/debug
- name: Prepare testbench
run: |
chmod +x target/debug/src32_testbench
echo "SRC32_TESTBENCH=$PWD/target/debug/src32_testbench" >> "$GITHUB_ENV"
- name: pytest
run: python -m pytest tools/solc tools/wax -q
- name: Foundation WAX loader (host)
run: python -m unittest discover -s foundation/tests/wax -v
- name: FS2 host tool
run: python -m unittest discover -s tools/fs2 -v
- name: Shared glyph ROM
run: |
python -m unittest discover -s tools -p test_unifont_hex_to_chr.py -v
python tools/unifont_hex_to_chr.py --check assets/unifont-18.0.01.hex.gz assets/unifont-bmp.chr
wasm-sdk:
name: WASM expansion card SDK
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Package builder tests
run: python -m unittest discover -s sdk/wasm-expansion-card -p 'test_*.py' -v
# VS Code 拡張 (sol / SRC32 アセンブリ) の .vsix を作って artifact に残す。
vscode-extensions:
name: VS Code extensions
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: 22
cache: npm
cache-dependency-path: tools/vscode-sol-syntax/package-lock.json
- name: Package vscode-sol-syntax
working-directory: tools/vscode-sol-syntax
run: |
npm ci
npm run compile
npx vsce package --no-dependencies
- name: Package vscode-src32-asm-syntax
working-directory: tools/vscode-src32-asm-syntax
run: npx --yes @vscode/vsce@3 package --no-dependencies
- uses: actions/upload-artifact@v4
with:
name: vscode-extensions
path: tools/*/*.vsix
retention-days: 7