-
Notifications
You must be signed in to change notification settings - Fork 5
65 lines (59 loc) · 2.43 KB
/
test.yml
File metadata and controls
65 lines (59 loc) · 2.43 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: Unit Tests
run-name: "🧪 Unit Tests · ${{ github.event_name == 'schedule' && 'Scheduled (master)' || (github.event_name == 'workflow_dispatch' && 'Manual Run' || github.event.workflow_run.head_branch) }}"
on:
schedule:
# 每天凌晨 2 点执行
- cron: "0 2 * * *"
workflow_dispatch:
workflow_run:
workflows: ["Code Format Check"]
types:
- completed
jobs:
test:
name: Unit Test (${{ matrix.os }} - ${{ matrix.arch }} - Zig ${{ matrix.version }})
# 依赖 format check 成功,或定时任务/手动触发时执行
if: |
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
strategy:
matrix:
# 架构配置标识符
arch_config: [linux-x86_64, linux-aarch64, macos-arm64, windows-x86_64]
# 定时任务只测试 master 版本,其他情况测试所有版本
version: ${{ github.event_name == 'schedule' && fromJSON('["master"]') || fromJSON('["0.14.1", "0.15.1", "master"]') }}
include:
# Linux x86_64
- arch_config: linux-x86_64
os: ubuntu-latest
arch: x86_64
runner: ubuntu-latest
# Linux aarch64
- arch_config: linux-aarch64
os: ubuntu-latest
arch: aarch64
runner: ubuntu-24.04-arm
# macOS arm64
- arch_config: macos-arm64
os: macos-latest
arch: arm64
runner: macos-14
# Windows x86_64
- arch_config: windows-x86_64
os: windows-latest
arch: x86_64
runner: windows-latest
fail-fast: false
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Zig
uses: goto-bus-stop/setup-zig@v2
with:
version: ${{ matrix.version }}
- name: Run unit tests
run: zig build test --summary all