-
Notifications
You must be signed in to change notification settings - Fork 2
109 lines (93 loc) · 3.12 KB
/
ci.yml
File metadata and controls
109 lines (93 loc) · 3.12 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
name: CI
on:
push:
branches:
- "**"
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install formatting tools
run: |
sudo apt-get update
sudo apt-get install -y clang-format clang-tidy
- name: Run clang-format
run: ./scripts/clang-format-check.sh
- name: Run clang-tidy
run: |
clang-tidy src/ctx.c --warnings-as-errors=* --checks=-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling -- -std=c11 -Isrc
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: ubuntu-gcc-x86
os: ubuntu-latest
cc: gcc
arch: x86_64
codegen_script: codegen/x86_encoder.js
harness: tests/test_harness_x86.c
- name: ubuntu-clang-x86
os: ubuntu-latest
cc: clang
arch: x86_64
codegen_script: codegen/x86_encoder.js
harness: tests/test_harness_x86.c
install_clang: true
- name: ubuntu-gcc-arm64
os: ubuntu-24.04-arm
cc: gcc
arch: arm64
codegen_script: codegen/arm64_encoder.js
harness: tests/test_harness_arm64.c
- name: ubuntu-clang-arm64
os: ubuntu-24.04-arm
cc: clang
arch: arm64
codegen_script: codegen/arm64_encoder.js
harness: tests/test_harness_arm64.c
install_clang: true
- name: macos-clang-arm64
os: macos-latest
cc: clang
arch: arm64
codegen_script: codegen/arm64_encoder.js
harness: tests/test_harness_arm64.c
name: ${{ matrix.name }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Install clang
if: matrix.install_clang && startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install -y clang
- name: Install Node dependencies
run: npm ci
- name: Regenerate backend
run: node ${{ matrix.codegen_script }}
- name: Build library
run: make dev
env:
CC: ${{ matrix.cc }}
- name: Build and run architecture-specific test harness
run: |
${{ matrix.cc }} -std=c11 -O2 -Isrc ${{ matrix.harness }} src/ctx.c -o jit_tests
./jit_tests
- name: Build and run builder test harness
run: |
${{ matrix.cc }} -std=c11 -O2 -Isrc tests/test_harness_builder.c src/ctx.c -o jit_tests_builder
./jit_tests_builder
- name: Build and run minilang example
timeout-minutes: 1
run: |
${{ matrix.cc }} -std=c11 -O2 -Isrc examples/minilang.c src/ctx.c -o minilang_example
./minilang_example "(def main (x) (add 10 (call dec x))) (def dec (y) (sub y 1))" 10
- name: Build and run SIMD example
run: |
${{ matrix.cc }} -std=c11 -O2 -Isrc examples/simd.c src/ctx.c -o simd_example
./simd_example