forked from XiaomiMiMo/MiMo-Code
-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (55 loc) · 2 KB
/
Copy pathtest.yml
File metadata and controls
64 lines (55 loc) · 2 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
name: test
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
unit:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shard: ["1/4", "2/4", "3/4", "4/4"]
name: unit (shard ${{ matrix.shard }})
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup Bun
uses: ./.github/actions/setup-bun
- name: Configure git identity
run: |
git config --global user.email "ci@mimo.ai"
git config --global user.name "mimo-ci"
# runtime-worktree.test.ts excluded from shards: its deadline-fired test
# deadlocks when run after other tests (QuickJS WASM state leak).
# It runs separately below in an isolated process.
- name: Run unit tests (shard ${{ matrix.shard }})
timeout-minutes: 8
working-directory: packages/opencode
run: |
find test -name '*.test.ts' ! -name 'runtime-worktree.test.ts' | sort > /tmp/test-files.txt
shard=${{ matrix.shard }}
idx=${shard%/*}
n=${shard#*/}
files=$(awk -v i="$idx" -v n="$n" 'NR % n == i - 1' /tmp/test-files.txt)
mkdir -p .artifacts/unit
bun test $files --timeout 120000 --reporter=junit --reporter-outfile=.artifacts/unit/junit.xml
- name: Upload JUnit
if: always()
uses: actions/upload-artifact@v7
with:
name: junit-shard-${{ strategy.job-index }}
path: packages/opencode/.artifacts/unit/junit.xml
# Run deadline worktree test in isolation (shard 4/4 only).
- name: Run deadline worktree test (isolated)
if: matrix.shard == '4/4'
timeout-minutes: 3
working-directory: packages/opencode
run: bun test test/workflow/runtime-worktree.test.ts -t 'deadline-fired' --timeout 120000