11name : Main Workflow
2- on : [push, pull_request]
2+ on : [ push, pull_request ]
33env :
4- LLVM_VERSION : 13
4+ LLVM_VERSION : 15
55jobs :
66 debug :
7+ if : github.event_name == 'push'
78 runs-on : ubuntu-latest
8- container : ghcr.io/opencyphal/toolshed:ts20 .4.1
9+ container : ghcr.io/opencyphal/toolshed:ts22 .4.3
910 strategy :
1011 matrix :
11- toolchain : ['clang', 'gcc']
12+ toolchain : [ 'clang', 'gcc' ]
1213 include :
1314 - toolchain : gcc
1415 c-compiler : gcc
@@ -18,57 +19,165 @@ jobs:
1819 cxx-compiler : clang++
1920 steps :
2021 - uses : actions/checkout@v3
22+ with :
23+ submodules : true
24+ # language=bash
2125 - run : >
2226 cmake
2327 -B ${{ github.workspace }}/build
2428 -DCMAKE_BUILD_TYPE=Debug
2529 -DCMAKE_C_COMPILER=${{ matrix.c-compiler }}
2630 -DCMAKE_CXX_COMPILER=${{ matrix.cxx-compiler }}
27- tests
28- - name : make
29- run : |
31+ .
32+ # language=bash
33+ - run : |
3034 cd ${{ github.workspace }}/build
31- make VERBOSE=1
32- make test
33- - uses : actions/upload-artifact@v2
35+ make VERBOSE=1 -j$(nproc)
36+ make test ARGS="--verbose"
37+ - uses : actions/upload-artifact@v3
3438 if : always()
3539 with :
36- name : ${{github.job}}
40+ # The matrix is shown for convenience but this is fragile because the values may not be string-convertible.
41+ # Shall it break one day, feel free to remove the matrix from here.
42+ name : ${{github.job}}-#${{strategy.job-index}}-${{job.status}}-${{join(matrix.*, ',')}}
3743 path : ${{github.workspace}}/**/*
3844 retention-days : 2
3945
4046 optimizations :
47+ if : github.event_name == 'push'
4148 runs-on : ubuntu-latest
42- container : ghcr.io/opencyphal/toolshed:ts20 .4.1
49+ container : ghcr.io/opencyphal/toolshed:ts22 .4.3
4350 strategy :
4451 matrix :
45- toolchain : ['clang', 'gcc']
46- build_type : [Release, MinSizeRel]
52+ toolchain : [ 'clang', 'gcc' ]
53+ build_type : [ Release, MinSizeRel ]
4754 include :
4855 - toolchain : gcc
4956 c-compiler : gcc
5057 cxx-compiler : g++
58+ cxx-flags : -fno-strict-aliasing # GCC in MinSizeRel C++20 mode misoptimizes the Cavl test.
5159 - toolchain : clang
5260 c-compiler : clang
5361 cxx-compiler : clang++
5462 steps :
5563 - uses : actions/checkout@v3
64+ with :
65+ submodules : true
66+ # language=bash
5667 - run : >
5768 cmake
5869 -B ${{ github.workspace }}/build
5970 -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
6071 -DCMAKE_C_COMPILER=${{ matrix.c-compiler }}
6172 -DCMAKE_CXX_COMPILER=${{ matrix.cxx-compiler }}
73+ -DCMAKE_CXX_FLAGS="${{ matrix.cxx-flags }}"
6274 -DNO_STATIC_ANALYSIS=1
63- tests
64- - name : make
65- run : |
75+ .
76+ # language=bash
77+ - run : |
6678 cd ${{ github.workspace }}/build
67- make VERBOSE=1
68- make test
69- - uses : actions/upload-artifact@v2
79+ make VERBOSE=1 -j$(nproc)
80+ make test ARGS="--verbose"
81+ - uses : actions/upload-artifact@v3
7082 if : always()
7183 with :
72- name : ${{github.job}}
84+ # The matrix is shown for convenience but this is fragile because the values may not be string-convertible.
85+ # Shall it break one day, feel free to remove the matrix from here.
86+ name : ${{github.job}}-#${{strategy.job-index}}-${{job.status}}-${{join(matrix.*, ',')}}
7387 path : ${{github.workspace}}/**/*
7488 retention-days : 2
89+
90+ avr :
91+ if : github.event_name == 'push'
92+ runs-on : ubuntu-latest
93+ env :
94+ mcu : at90can64
95+ flags : -Wall -Wextra -Werror -pedantic -Wconversion -Wtype-limits
96+ strategy :
97+ matrix :
98+ std : [ 'c99', 'c11', 'gnu99', 'gnu11' ]
99+ steps :
100+ - uses : actions/checkout@v3
101+ # language=bash
102+ - run : |
103+ sudo apt update -y && sudo apt upgrade -y
104+ sudo apt install gcc-avr avr-libc
105+ avr-gcc --version
106+ - run : avr-gcc libudpard/*.c -c -std=${{matrix.std}} -mmcu=${{env.mcu}} ${{env.flags}}
107+
108+ arm :
109+ if : github.event_name == 'push'
110+ runs-on : ubuntu-latest
111+ env :
112+ flags : -Wall -Wextra -Werror -pedantic -Wconversion -Wtype-limits -Wcast-align -Wfatal-errors
113+ strategy :
114+ matrix :
115+ std : [ 'c99', 'c11', 'gnu99', 'gnu11' ]
116+ steps :
117+ - uses : actions/checkout@v3
118+ # language=bash
119+ - run : |
120+ sudo apt update -y && sudo apt upgrade -y
121+ sudo apt-get install -y gcc-arm-none-eabi
122+ - run : arm-none-eabi-gcc libudpard/*.c -c -std=${{matrix.std}} ${{ env.flags }}
123+
124+ sonar :
125+ runs-on : ubuntu-latest
126+ container : ghcr.io/opencyphal/toolshed:ts22.4.3
127+ if : >
128+ (
129+ (github.event_name == 'pull_request' || contains(github.ref, '/main') || contains(github.ref, '/release')) &&
130+ !contains(github.event.head_commit.message, '#yolo')
131+ ) || (
132+ contains(github.event.head_commit.message, '#sonar')
133+ )
134+ env :
135+ SONAR_SCANNER_VERSION : 4.8.0.2856
136+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
137+ SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
138+ steps :
139+ - uses : actions/checkout@v3
140+ with :
141+ fetch-depth : 0 # Shallow clones should be disabled for a better relevancy of analysis
142+ submodules : true
143+ - uses : actions/setup-java@v3
144+ with :
145+ java-version : 17
146+ distribution : ' zulu'
147+ # language=bash
148+ - run : |
149+ clang --version
150+ - name : Install Sonar tools
151+ env :
152+ SONAR_SCANNER_DOWNLOAD_URL : https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${{ env.SONAR_SCANNER_VERSION }}-linux.zip
153+ BUILD_WRAPPER_DOWNLOAD_URL : https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip
154+ # language=bash
155+ run : |
156+ mkdir -p $HOME/.sonar
157+ curl -sSLo $HOME/.sonar/sonar-scanner.zip ${{ env.SONAR_SCANNER_DOWNLOAD_URL }}
158+ unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
159+ echo "$HOME/.sonar/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin" >> $GITHUB_PATH
160+ curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip ${{ env.BUILD_WRAPPER_DOWNLOAD_URL }}
161+ unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
162+ echo "$HOME/.sonar/build-wrapper-linux-x86" >> $GITHUB_PATH
163+ # Sonar is not run on builds originating from forks due to secrets not being available (avoids errors).
164+ # language=bash
165+ - run : |
166+ [ -z "$SONAR_TOKEN" ] || tools/run_sonar.sh
167+ - uses : actions/upload-artifact@v3
168+ if : always()
169+ with :
170+ name : ${{github.job}}
171+ path : ${{github.workspace}}/
172+ retention-days : 3
173+
174+ style_check :
175+ if : github.event_name == 'push'
176+ runs-on : ubuntu-latest
177+ steps :
178+ - uses : actions/checkout@v3
179+ 180+ with :
181+ source : ' ./libudpard ./tests'
182+ extensions : ' c,h,cpp,hpp'
183+ clangFormatVersion : ${{ env.LLVM_VERSION }}
0 commit comments