-
Notifications
You must be signed in to change notification settings - Fork 11
116 lines (101 loc) · 3.26 KB
/
test.yml
File metadata and controls
116 lines (101 loc) · 3.26 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
name: Zig Build and Test
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
zig-build-test:
strategy:
matrix:
settings:
- os: ubuntu-latest
arch: x86_64
- os: ubuntu-24.04-arm
arch: aarch64
- os: macos-13
arch: x86_64
- os: macos-latest
arch: aarch64
runs-on: ${{ matrix.settings.os }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: recursive # Ensures submodules are cloned
fetch-depth: 0 # Fetches the entire history for all branches
- name: Print OS ${{ matrix.settings.os }}
run: uname -a
- name: Print Architecture ${{ matrix.settings.arch }}
run: uname -m
- name: Install Zig
uses: mlugg/setup-zig@v1
with:
version: "0.14.0" # Set the required Zig version
- name: Build and Test
run: |
zig build test
- name: Build binary
run: zig build -Doptimize=ReleaseSafe
- name: Check binary
run: |
ls -la zig-out/lib
- name: Install Bun
run: |
curl -fsSL https://bun.sh/install | bash
export PATH="$HOME/.bun/bin:$PATH"
# Append Bun's bin folder to the GitHub Actions PATH.
echo "$HOME/.bun/bin" >> $GITHUB_PATH
bun --version
- name: Bun - Install Dependencies
run: bun install
working-directory: ./bun
- name: Bun - Lint Code
run: bun lint
working-directory: ./bun
- name: Bun - Unit Tests
run: bun test:unit
working-directory: ./bun
- name: Benchmark
if: matrix.settings.os == 'ubuntu-latest' and matrix.settings.arch == 'x86_64'
run: bun benchmark
working-directory: ./bun
env:
# To write to PRs and commits
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Zig Artifacts
uses: actions/upload-artifact@v4
with:
name: bindings-${{ matrix.settings.os }}-${{ matrix.settings.arch }}
path: 'zig-out/lib/libstate-transition-utils.*'
if-no-files-found: error
test-linux-x64-gnu-downloaded-artifacts:
name: Test bindings on linux-x64-gnu
needs: zig-build-test
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4 # no need zig installation, download artifacts from previous job instead
with:
name: bindings-ubuntu-latest-x86_64
path: zig-out/lib # download to the same folder of "zig build -Doptimize=ReleaseSafe"
- name: Install Bun
run: |
curl -fsSL https://bun.sh/install | bash
export PATH="$HOME/.bun/bin:$PATH"
# Append Bun's bin folder to the GitHub Actions PATH.
echo "$HOME/.bun/bin" >> $GITHUB_PATH
bun --version
- name: Bun - Install Dependencies
run: bun install
working-directory: ./bun
- name: Bun - Lint Code
run: bun lint
working-directory: ./bun
- name: Bun - Unit Tests
run: bun test:unit
working-directory: ./bun