-
Notifications
You must be signed in to change notification settings - Fork 4
148 lines (129 loc) · 4.21 KB
/
ci.yaml
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: CI pipeline
on:
push:
branches: [dev]
env:
build_dir: build
build_config: Release
jobs:
analyze:
name: Run analyzers
runs-on: ${{vars.ubuntu_runner || 'ubuntu-latest'}}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 2
submodules: recursive
- name: Run pre-commit
run: |
python -m venv .venv
source .venv/bin/activate
pip install pre-commit
pre-commit run --from-ref=HEAD~1 --to-ref=HEAD
- name: Configure CMake
run: >
CC=clang cmake -B ${{env.build_dir}}
-DCOWL_CPP_TESTS=OFF
-DCOWL_LTO=OFF
-DCOWL_CLANG_TIDY=ON
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON
- name: Build
run: cmake --build ${{env.build_dir}} --target cowl-test cowl-bench cowl-examples cowl-tools
test:
name: Test
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
os:
- ${{vars.ubuntu_runner || 'ubuntu-latest'}}
- ${{vars.windows_runner || 'windows-latest'}}
- ${{vars.macos_runner || 'macos-latest'}}
lib_type: [STATIC, SHARED]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Configure runner
run: |
if [ $RUNNER_OS == 'Windows' ]; then
choco install winflexbison3
elif [ $RUNNER_OS == 'macOS' ]; then
brew install flex bison
echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH
echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH
fi
shell: bash
- name: Configure CMake
run: >
cmake -B ${{env.build_dir}}
-DULIB_LEAKS=ON
-DULIB_SANITIZERS=ON
-DULIB_LIBRARY_TYPE=${{matrix.lib_type}}
-DCOWL_LIBRARY_TYPE=${{matrix.lib_type}}
-DCOWL_ENTITY_IDS=ON
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON
-DCMAKE_SYSTEM_VERSION=''
-DCMAKE_BUILD_TYPE=${{env.build_config}}
- name: Build
run: >
cmake --build ${{env.build_dir}}
--config ${{env.build_config}}
--target cowl-test cowl-cpp-test cowl-bench cowl-examples cowl-tools
- name: Debug
if: ${{always()}}
run: sed '4019q;d' ${{env.build_dir}}/src/reader/functional/cowl_func_yyparser.c
shell: bash
- name: Configure tests (Windows)
working-directory: ${{env.build_dir}}
if: runner.os == 'Windows'
run: |
mv test/${{env.build_config}}/*.exe test
mv examples/${{env.build_config}}/*.exe examples
mv tools/${{env.build_config}}/*.exe tools
if [ ${{matrix.lib_type}} == 'SHARED' ]; then
find . -name '*.dll' -exec cp -t test {} + -exec cp -t examples {} + -exec cp -t tools {} +
fi
shell: bash
- name: Run tests
working-directory: ${{env.build_dir}}/test
run: ./cowl-test
- name: Run tests (C++)
working-directory: ${{env.build_dir}}/test
run: ./cowl-cpp-test
- name: Run benchmark
working-directory: ${{env.build_dir}}/test
run: ./cowl-bench
- name: Run examples
working-directory: ${{env.build_dir}}/examples
run: |
if [ $RUNNER_OS == 'Windows' ]; then
EXAMPLES=(./*-example.exe)
else
EXAMPLES=(./*-example)
fi
for EXAMPLE in "${EXAMPLES[@]}"; do
"${EXAMPLE}"
done
shell: bash
- name: Run tools
working-directory: ${{env.build_dir}}/tools
run: ./cowl-stats test_onto.owl
docs:
name: Generate the documentation
runs-on: ${{vars.ubuntu_runner || 'ubuntu-latest'}}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Build docs
run: |
sudo apt install doxygen
python -m venv .venv
source .venv/bin/activate
pip install Sphinx sphinx-rtd-theme breathe
cmake -B ${{env.build_dir}} -DCOWL_READERS=OFF -DCOWL_WRITERS=OFF
cmake --build ${{env.build_dir}} --target cowl-docs