forked from fair-acc/gnuradio4
-
Notifications
You must be signed in to change notification settings - Fork 0
157 lines (137 loc) · 5.48 KB
/
ci.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
name: main CI
on:
push:
branches: [ main ]
pull_request:
jobs:
buildAndPublishDocker:
name: "Update the docker container if it is modified"
runs-on: "ubuntu-latest"
outputs:
container: ${{ steps.docker-label.outputs.label }}
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
if: github.event_name == 'push'
with:
fetch-depth: 0
- name: Check if dockerfile was modified
id: changes
uses: dorny/paths-filter@v3
with:
filters: |
docker:
- 'docker/Dockerfile'
- name: Set up Docker Label
id: docker-label
run: |
if [ ${{ steps.changes.outputs.docker == 'true' && github.event_name != 'push' }} = "true" ]; then
echo "label=ghcr.io/fair-acc/gr4-build-container:${GITHUB_HEAD_REF/\//-}" >> "$GITHUB_OUTPUT"
else
echo "label=ghcr.io/fair-acc/gr4-build-container:latest" >> "$GITHUB_OUTPUT"
fi
- name: Set up Docker Buildx
if: steps.changes.outputs.docker == 'true'
uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
if: steps.changes.outputs.docker == 'true'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v5
if: steps.changes.outputs.docker == 'true'
with:
context: "{{defaultContext}}:docker"
push: true
tags: ${{ steps.docker-label.outputs.label }}
build:
name: "${{ matrix.compiler.cc }} | ${{ matrix.cmake-build-type }}"
needs: buildAndPublishDocker
runs-on: "ubuntu-latest"
container:
image: "${{ needs.buildAndPublishDocker.outputs.container }}"
strategy:
fail-fast: false
matrix:
compiler:
- cc: gcc-14
cxx: g++-14
cmake_flags: "-DADDRESS_SANITIZER=ON"
- cc: gcc-13
cxx: g++-13
cmake_flags: "-DADDRESS_SANITIZER=OFF"
- cc: clang-18,
cxx: clang++-18
cmake_flags: "-DCMAKE_LINKER=/usr/bin/clang-18"
- cmake_wrapper: emcmake
cc: emcc
cmake_flags: "-DENABLE_COVERAGE=OFF -DCMAKE_CROSSCOMPILING_EMULATOR=${SYSTEM_NODE}"
cmake-build-type: [ Release, Debug ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache
uses: actions/cache@v4
env:
cache-name: cache-fetchContent-cache
with:
path: ${{runner.workspace}}/build/_deps
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.cmake-build-type }}-${{ hashFiles('CMakeLists.txt') }}
- name: Configure
if: matrix.compiler.cmake_wrapper == null
shell: bash
env:
CC: "${{ matrix.compiler.cc }}"
CXX: "${{ matrix.compiler.cxx }}"
CMAKE_EXPORT_COMPILE_COMMANDS: "ON"
run: |
cmake -S . -B ../build -DCMAKE_COLOR_DIAGNOSTICS=ON -DDISABLE_EXTERNAL_DEPS_WARNINGS=ON -DCMAKE_BUILD_TYPE=${{ matrix.cmake-build-type }} -DENABLE_COVERAGE=${{ matrix.cmake-build-type == 'Debug' && matrix.compiler.cc == 'gcc-14' }} ${{ matrix.compiler.cmake_flags }}
- name: Configure CMake Emscripten
if: matrix.compiler.cmake_wrapper == 'emcmake'
shell: bash
run: |
export SYSTEM_NODE=`which node` # use system node instead of old version distributed with emsdk for threading support
$EMSDK_HOME/emsdk activate $EMSDK_VERSION
source $EMSDK_HOME/emsdk_env.sh
${{ matrix.compiler.cmake_wrapper }} cmake -S . -B ../build -DCMAKE_COLOR_DIAGNOSTICS=ON -DDISABLE_EXTERNAL_DEPS_WARNINGS=ON -DCMAKE_BUILD_TYPE=${{ matrix.cmake-build-type }} ${{ matrix.compiler.cmake_flags }}
- name: Build
shell: bash
run: |
test -f $EMSDK_HOME/emsdk_env.sh && source $EMSDK_HOME/emsdk_env.sh
cmake --build ../build
- name: execute tests
if: matrix.compiler.cc != 'gcc-14' || matrix.cmake-build-type != 'Debug'
env:
DISABLE_SENSITIVE_TESTS: 1 # disables tests which are sensitive to execution speed and will not run with instrumented code
working-directory: ${{runner.workspace}}/build
shell: bash
run: ctest --output-on-failure
- name: execute tests with coverage
if: matrix.compiler.cc == 'gcc-14' && matrix.cmake-build-type == 'Debug'
env:
DISABLE_SENSITIVE_TESTS: 1 # disables tests which are sensitive to execution speed and will not run with instrumented code
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --build . --target coverage
- name: execute native main binary
if: matrix.compiler.cmake_wrapper == null
working-directory: ${{runner.workspace}}/build
shell: bash
run: ./core/src/main
- name: execute wasm main binary with nodejs
if: matrix.compiler.cmake_wrapper != null
working-directory: ${{runner.workspace}}/build
shell: bash
run: node --experimental-wasm-threads ./core/src/main.js
- name: Run sonar-scanner
if: matrix.compiler.cc == 'gcc-14' && matrix.cmake-build-type == 'Debug'
shell: bash
env:
SONAR_HOST_URL: https://sonarcloud.io
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: sonar-scanner