-
Notifications
You must be signed in to change notification settings - Fork 1
196 lines (185 loc) · 6.69 KB
/
continuous-integration.yml
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
name: Continuous Integration
on:
push:
branches:
- main
# Ignore changes in documentation and benchmark charts.
# Need to contain git add parameters below.
paths-ignore:
- '**/LICENSE'
- '**.md'
- '**.txt'
- '**.bat'
- '**.sh'
- '**.svg'
- '**.png'
- '**.code-workspace'
- '**/benchmark-report.json'
- '**/benchmark-report.xml'
- 'renovate.json'
pull_request:
branches:
- main
# Ignore changes in documentation and benchmark charts.
paths-ignore:
- '**/LICENSE'
- '**.md'
- '**.txt'
- '**.bat'
- '**.sh'
- '**.svg'
- '**.png'
- '**.code-workspace'
- '**/benchmark-report.json'
- '**/benchmark-report.xml'
- 'renovate.json'
env:
PROJECT_NAME: ${{ github.event.repository.name }}
BUILD_TYPE: Release
BUILD_DIR: build
CHART_DIR: chart
CHART_ENVIRONMENT_FILE: BenchmarkChart.env
CI_COMMIT_MESSAGE: (CI) Update chart
CI_COMMIT_AUTHOR: ${{ github.event.repository.name }} Continuous Integration
jobs:
build_and_test:
name: ${{ matrix.artifact }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # show all errors for each platform (vs. cancel jobs on error)
matrix:
include:
- os: ubuntu-latest
artifact: Linux
enforce-sse2: FALSE
enforce-avx: FALSE
enforce-avx2: FALSE
- os: ubuntu-latest
artifact: Linux SSE2
enforce-sse2: TRUE
enforce-avx: FALSE
enforce-avx2: FALSE
- os: ubuntu-latest
artifact: Linux AVX
enforce-sse2: FALSE
enforce-avx: TRUE
enforce-avx2: FALSE
- os: ubuntu-latest
artifact: Linux AVX2
enforce-sse2: FALSE
enforce-avx: FALSE
enforce-avx2: TRUE
- os: windows-latest
artifact: Windows
enforce-sse2: FALSE
enforce-avx: FALSE
enforce-avx2: FALSE
- os: windows-latest
artifact: Windows AVX2
enforce-sse2: FALSE
enforce-avx: FALSE
enforce-avx2: TRUE
- os: windows-latest
artifact: Windows AVX
enforce-sse2: FALSE
enforce-avx: TRUE
enforce-avx2: FALSE
- os: macos-13
artifact: MacOS
enforce-sse2: FALSE
enforce-avx: FALSE
enforce-avx2: FALSE
- os: macos-latest
artifact: MacOS M1
enforce-sse2: FALSE
enforce-avx: FALSE
enforce-avx2: FALSE
steps:
# Install additional packages and tools for the build
- name: (Install) Linux Dependencies and select g++ 10
if: runner.os == 'Linux'
run: |
sudo apt-get update && sudo apt-get install build-essential libcairo2-dev libpango1.0-dev librsvg2-dev
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10
- name: (Install) CMake and Ninja
uses: lukka/get-cmake@latest
# Checkout the code from GIT using a dedicated personal access token
- name: (GIT) Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.WORKFLOW_GIT_ACCESS_TOKEN }}
# Build and test the C++ Project using CMake
- name: (CMake) Ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ matrix.artifact }}-${{ env.BUILD_TYPE }}
- name: (CMake) Configure, Enforce SSE=${{ matrix.enforce-sse2 }}, AVX=${{ matrix.enforce-avx }}, AVX2=${{ matrix.enforce-avx2 }}
run: >
cmake -B ${{ env.BUILD_DIR }}
-G Ninja
-S .
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE}}
-DCMAKE_C_COMPILER_LAUNCHER=ccache
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-DENFORCE_VECTOR_EXTENSION_SSE2:BOOL=${{ matrix.enforce-sse2 }}
-DENFORCE_VECTOR_EXTENSION_AVX:BOOL=${{ matrix.enforce-avx }}
-DENFORCE_VECTOR_EXTENSION_AVX2:BOOL=${{ matrix.enforce-avx2 }}
- name: (CMake) Build
run: cmake --build ${{ env.BUILD_DIR }} --config ${{ env.BUILD_TYPE }}
- name: (CMake) Test
working-directory: ${{ env.BUILD_DIR }}
run: ctest --test-dir test
# Run the benchmark tests using Catch2
- name: (Catch2) Run Benchmarks (POSIX)
if: matrix.os != 'windows-latest'
run: ./script/run-benchmarks.sh
- name: (Catch2) Run Benchmarks (Windows)
if: matrix.os == 'windows-latest'
run: .\script\run-benchmarks.bat
# Generate the charts using Node.js
- name: (Node.js) Setup
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
cache-dependency-path: ${{ env.CHART_DIR }}/package-lock.json
- name: (Node.js) Install Packages
working-directory: ${{ env.CHART_DIR }}
run: npm ci
- name: (Node.js) Build Charts
working-directory: ${{ env.CHART_DIR }}
run: npm run build
# Package the results into a ZIP and upload it as build artifact
- name: (Package) Import environment file ${{ env.CHART_ENVIRONMENT_FILE }}
uses: cardinalby/export-env-action@v1
with:
envFile: '${{ env.BUILD_DIR }}/${{ env.CHART_ENVIRONMENT_FILE }}'
- name: (Package) Zip
working-directory: ${{ env.CHART_DIR }}
run: cmake -E tar cfv ${{ env.PROJECT_NAME }}-charts-${{ env.BENCHMARK_CHART_GROUP }}.zip --format=zip ${{ env.BENCHMARK_CHART_GROUP }}
- name: (Package) Upload Artifact
uses: actions/upload-artifact@v4
with:
path: ${{ env.CHART_DIR }}/${{ env.PROJECT_NAME }}-charts-${{ env.BENCHMARK_CHART_GROUP }}.zip
name: ${{ env.PROJECT_NAME }}-charts-${{ env.BENCHMARK_CHART_GROUP }}-artifact-${{ matrix.artifact }}
retention-days: 7
# Commit and push benchmark reports on merge into "main" branch
- name: Display environment variable "github.event_name"
run: echo "github.event_name=${{ github.event_name }}"
- name: (GIT) Commit benchmark reports
working-directory: ${{ env.CHART_DIR }}
# Only run when a pull request gets merged or a commit is pushed to the main branch
# git add parameters need to directly or indirectly match paths-ignore parameters above
if: github.event_name == 'push'
run: |
git config --global user.name '${{ env.CI_COMMIT_AUTHOR }}'
git config --global user.email "[email protected]"
git fetch origin
git status
git add ${{ env.BENCHMARK_CHART_GROUP }}
git commit -m "${{ env.CI_COMMIT_MESSAGE }} ${{ env.BENCHMARK_CHART_GROUP }}"
git status
git rebase --strategy-option=theirs origin/main --verbose
git status
git push --verbose