Adding cmake presets, switching to ninja-multi-config #669
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "CETLVaSt" | |
on: | |
push: # Further filtering is done in the jobs. | |
pull_request: | |
branches: | |
- main | |
- "issue/*" | |
release: | |
types: [published] | |
workflow_dispatch: | |
jobs: | |
cache-warmup: | |
if: > | |
contains(github.event.head_commit.message, '#verification') || | |
contains(github.event.head_commit.message, '#docs') || | |
contains(github.ref, '/main') || | |
contains(github.ref, '/issue/') || | |
(github.event_name == 'pull_request') | |
runs-on: ubuntu-latest | |
container: ghcr.io/opencyphal/toolshed:ts24.4.3 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache ext modules | |
id: cetlvast-ext | |
uses: actions/cache@v4 | |
with: | |
path: cetlvast/build_external | |
key: build-external-${{ hashFiles('**/cetlvast/cmake/modules/ExternalDependencies*.cmake.in') }}-${{ hashFiles('**/cetlvast/cmake/modules/patches/*.patch') }} | |
- name: simple-build-online | |
working-directory: cetlvast | |
if: steps.cetlvast-ext.outputs.cache-hit != 'true' | |
run: cmake --workflow --preset manual-simple-workflow-online | |
verification-amd64: | |
if: > | |
contains(github.event.head_commit.message, '#verification') || | |
contains(github.ref, '/main') || | |
contains(github.ref, '/issue/') || | |
(github.event_name == 'pull_request') | |
runs-on: ubuntu-latest | |
container: ghcr.io/opencyphal/toolshed:ts24.4.3 | |
needs: | |
- cache-warmup | |
strategy: | |
matrix: | |
toolchain: ["gcc-native-32", "clang-native"] | |
standard: ["cpp-14", "cpp-17", "cpp-20"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache ext modules | |
uses: actions/cache@v4 | |
with: | |
path: cetlvast/build_external | |
key: build-external-${{ hashFiles('**/cetlvast/cmake/modules/ExternalDependencies*.cmake.in') }}-${{ hashFiles('**/cetlvast/cmake/modules/patches/*.patch') }} | |
fail-on-cache-miss: true | |
- name: run tests | |
working-directory: cetlvast | |
env: | |
GTEST_COLOR: yes | |
run: > | |
cmake --workflow --preset workflow-${{ matrix.toolchain }}-${{ matrix.standard }}-offline | |
- name: upload-artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.toolchain }}-${{ matrix.standard }}-amd64 | |
path: | | |
cetlvast/build/compile_commands.json | |
cetlvast/build/*/**/coverage.xml | |
cetlvast/build/*/**/*-sonarqube.xml | |
cetlvast/build/*/**/gcovr_html/*.* | |
if-no-files-found: error | |
verification-arm64: | |
if: > | |
contains(github.event.head_commit.message, '#verification') || | |
contains(github.ref, '/main') || | |
contains(github.ref, '/issue/') || | |
(github.event_name == 'pull_request') | |
runs-on: ubuntu-24.04-arm | |
container: ghcr.io/opencyphal/toolshed:ts24.4.3 | |
needs: | |
- cache-warmup | |
strategy: | |
matrix: | |
toolchain: ["gcc-native", "clang-native"] | |
standard: ["cpp-14", "cpp-17", "cpp-20"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache ext modules | |
uses: actions/cache@v4 | |
with: | |
path: cetlvast/build_external | |
key: build-external-${{ hashFiles('**/cetlvast/cmake/modules/ExternalDependencies*.cmake.in') }}-${{ hashFiles('**/cetlvast/cmake/modules/patches/*.patch') }} | |
fail-on-cache-miss: true | |
- name: run tests | |
working-directory: cetlvast | |
env: | |
GTEST_COLOR: yes | |
run: > | |
cmake --workflow --preset workflow-${{ matrix.toolchain }}-${{ matrix.standard }}-offline | |
- name: upload-artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.toolchain }}-${{ matrix.standard }}-arm64 | |
path: | | |
cetlvast/build/compile_commands.json | |
cetlvast/build/*/**/coverage.xml | |
cetlvast/build/*/**/*-sonarqube.xml | |
cetlvast/build/*/**/gcovr_html/*.* | |
if-no-files-found: error | |
docs: | |
if: > | |
contains(github.event.head_commit.message, '#docs') || | |
contains(github.ref, '/main') || | |
contains(github.ref, '/issue/') || | |
(github.event_name == 'pull_request') | |
runs-on: ubuntu-latest | |
container: ghcr.io/opencyphal/toolshed:ts24.4.3 | |
needs: | |
- cache-warmup | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache ext modules | |
uses: actions/cache@v4 | |
with: | |
path: cetlvast/build_external | |
key: build-external-${{ hashFiles('**/cetlvast/cmake/modules/ExternalDependencies*.cmake.in') }}-${{ hashFiles('**/cetlvast/cmake/modules/patches/*.patch') }} | |
fail-on-cache-miss: true | |
- name: doc-gen-configure | |
working-directory: cetlvast | |
run: cmake --preset configure-gcc-native-cpp-14-offline | |
- name: doc-gen-build | |
working-directory: cetlvast/build | |
run: ninja docs | |
- name: Setup Pages | |
if: ${{ github.event_name != 'pull_request' }} | |
uses: actions/configure-pages@v5 | |
- name: Upload docs | |
if: ${{ github.event_name != 'pull_request' }} | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: "cetlvast/build/suites/docs/html/" | |
- name: Deploy to GitHub Pages | |
if: ${{ github.event_name != 'pull_request' }} | |
id: deployment | |
uses: actions/[email protected] | |
- name: upload-pr-docs | |
if: ${{ github.event_name == 'pull_request' }} | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
name: pr-docs | |
path: "cetlvast/build/suites/docs/html/" | |
sonarqube: | |
if: > | |
contains(github.event.head_commit.message, '#sonar') || | |
contains(github.ref, '/main') || | |
contains(github.ref, '/issue/') || | |
(github.event_name == 'pull_request') | |
needs: | |
- verification-amd64 | |
- verification-arm64 | |
- docs | |
runs-on: ubuntu-latest | |
container: ghcr.io/opencyphal/toolshed:ts24.4.3 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis by sonarqube. | |
- name: Install sonar-scanner | |
uses: SonarSource/sonarcloud-github-c-cpp@v2 | |
- name: Cache ext modules | |
uses: actions/cache@v4 | |
with: | |
path: cetlvast/build_external | |
key: build-external-${{ hashFiles('**/cetlvast/cmake/modules/ExternalDependencies*.cmake.in') }}-${{ hashFiles('**/cetlvast/cmake/modules/patches/*.patch') }} | |
fail-on-cache-miss: true | |
- uses: actions/download-artifact@v4 | |
with: | |
name: gcc-native-cpp-14-arm64 | |
path: cetlvast/build | |
- name: Run sonar-scanner | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: > | |
sonar-scanner | |
--define sonar.organization=opencyphal | |
--define sonar.projectKey=OpenCyphal_CETL | |
--define sonar.projectName=CETLVaSt | |
--define sonar.projectVersion=1.0 | |
--define sonar.sources=include,cetlvast/suites/unittest/sonar.cpp | |
--define sonar.tests=cetlvast/suites/unittest,cetlvast/suites/docs/examples | |
--define sonar.test.inclusions=test_*.cpp,example_*.cpp | |
--define sonar.sourceEncoding=UTF-8 | |
--define sonar.host.url=https://sonarcloud.io | |
--define sonar.cfamily.ignoreHeaderComments=false | |
--define sonar.coverage.exclusions="cetlvast/suites/unittest/**/*,cetlvast/suites/docs/examples/**/*,**/sonar.cpp" | |
--define sonar.cpd.exclusions="cetlvast/suites/unittest/**/*,cetlvast/suites/docs/examples/**/*,**/sonar.cpp" | |
--define sonar.cfamily.compile-commands="cetlvast/build/compile_commands.json" | |
--define sonar.cfamily.reportingCppStandardOverride=c++14 | |
--define sonar.coverageReportPaths="cetlvast/build/suites/unittest/coverage.xml,cetlvast/build/suites/docs/examples/coverage.xml" | |
--define sonar.testExecutionReportPaths="cetlvast/build/suites/unittest/unittest-sonarqube.xml,cetlvast/build/suites/docs/examples/examples-sonarqube.xml" | |
deploy-docs: | |
if: > | |
(github.event_name == 'release' && !github.event.release.prerelease) || | |
github.event_name == 'workflow_dispatch' | |
needs: | |
- sonarqube | |
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment | |
permissions: | |
contents: read | |
pages: write # to deploy to Pages | |
id-token: write # to verify the deployment originates from an appropriate source | |
# Deploy to the github-pages environment | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
# Specify runner + deployment step | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 |