Skip to content

Commit 05b6210

Browse files
committed
Setup GitHub Actions
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
1 parent 1e72078 commit 05b6210

1 file changed

Lines changed: 136 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
name: Codegen
2+
3+
on:
4+
schedule:
5+
# Once per day, Monday to Friday
6+
- cron: '0 19 * * 1-5'
7+
push:
8+
branches:
9+
- main
10+
pull_request:
11+
12+
jobs:
13+
test:
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
platform:
18+
- os: macos-latest
19+
cc: clang
20+
cxx: clang++
21+
type: static
22+
shell: sh
23+
- os: macos-latest
24+
cc: clang
25+
cxx: clang++
26+
type: shared
27+
shell: sh
28+
- os: macos-latest
29+
cc: gcc-13
30+
cxx: g++-13
31+
type: static
32+
shell: sh
33+
- os: ubuntu-latest
34+
cc: clang
35+
cxx: clang++
36+
type: static
37+
shell: sh
38+
- os: ubuntu-latest
39+
cc: gcc
40+
cxx: g++
41+
type: static
42+
shell: sh
43+
- os: ubuntu-latest
44+
cc: clang
45+
cxx: clang++
46+
type: shared
47+
shell: sh
48+
- os: ubuntu-latest
49+
cc: gcc
50+
cxx: g++
51+
type: shared
52+
shell: sh
53+
- os: windows-latest
54+
type: static
55+
shell: pwsh
56+
- os: windows-latest
57+
type: shared
58+
shell: pwsh
59+
60+
# Sanitizers
61+
- os: ubuntu-latest
62+
cc: clang
63+
cxx: clang++
64+
type: static
65+
shell: sh
66+
options: -DCODEGEN_ADDRESS_SANITIZER:BOOL=ON
67+
- os: ubuntu-latest
68+
cc: clang
69+
cxx: clang++
70+
type: static
71+
shell: sh
72+
options: -DCODEGEN_UNDEFINED_SANITIZER:BOOL=ON
73+
74+
defaults:
75+
run:
76+
shell: ${{ matrix.platform.shell }}
77+
78+
runs-on: ${{ matrix.platform.os }}
79+
env:
80+
CC: ${{ matrix.platform.cc }}
81+
CXX: ${{ matrix.platform.cxx }}
82+
steps:
83+
- uses: actions/checkout@v4
84+
- name: Install dependencies (macOS)
85+
if: runner.os == 'macos'
86+
run: brew bundle
87+
env:
88+
HOMEBREW_NO_ANALYTICS: 1
89+
HOMEBREW_NO_AUTO_UPDATE: 1
90+
- run: npm ci
91+
- run: cmake --version
92+
- name: Configure Codegen (static)
93+
if: matrix.platform.type == 'static'
94+
run: >
95+
cmake -S . -B ./build
96+
-DCMAKE_BUILD_TYPE:STRING=Release
97+
-DCODEGEN_TESTS:BOOL=ON
98+
-DCODEGEN_CONTRIB:BOOL=ON
99+
-DCODEGEN_DOCS:BOOL=OFF
100+
-DBUILD_SHARED_LIBS:BOOL=OFF
101+
-DCMAKE_COMPILE_WARNING_AS_ERROR:BOOL=ON
102+
${{ matrix.platform.options }}
103+
- name: Configure Codegen (shared)
104+
if: matrix.platform.type == 'shared'
105+
run: >
106+
cmake -S . -B ./build
107+
-DCMAKE_BUILD_TYPE:STRING=Release
108+
-DCODEGEN_TESTS:BOOL=ON
109+
-DCODEGEN_CONTRIB:BOOL=ON
110+
-DCODEGEN_DOCS:BOOL=OFF
111+
-DBUILD_SHARED_LIBS:BOOL=ON
112+
-DCMAKE_COMPILE_WARNING_AS_ERROR:BOOL=ON
113+
${{ matrix.platform.options }}
114+
- run: cmake --build ./build --config Release --target clang_format_test
115+
- run: cmake --build ./build --config Release --target jsonschema_metaschema
116+
- run: cmake --build ./build --config Release --parallel 4
117+
- run: >
118+
cmake --install ./build --prefix ./build/dist --config Release --verbose
119+
--component sourcemeta_core
120+
- run: >
121+
cmake --install ./build --prefix ./build/dist --config Release --verbose
122+
--component sourcemeta_core_dev
123+
- run: >
124+
cmake --install ./build --prefix ./build/dist --config Release --verbose
125+
--component sourcemeta_codegen
126+
- run: >
127+
cmake --install ./build --prefix ./build/dist --config Release --verbose
128+
--component sourcemeta_codegen_dev
129+
130+
# Not every CTest version supports the --test-dir option. If such option
131+
# is not recognized, `ctest` will successfully exit finding no tests.
132+
# Better to be sure and `cd` all the time here.
133+
- run: cd ./build && ctest --build-config Release --output-on-failure --parallel
134+
env:
135+
# See https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
136+
UBSAN_OPTIONS: print_stacktrace=1

0 commit comments

Comments
 (0)