Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix CI cmake project build
Browse files Browse the repository at this point in the history
ClausKlein committed Mar 26, 2024
1 parent 3893e8e commit 5f7f60d
Showing 1 changed file with 100 additions and 89 deletions.
189 changes: 100 additions & 89 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -3,33 +3,35 @@ name: Continuous Integration
on:
push:
branches:
- master
- develop
- feature/*
- master
- develop
- feature/*

pull_request:
branches:
- develop
- develop

jobs:
lint:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with: { python-version: "3.8" }
- uses: actions/setup-python@v4
with: {python-version: "3.8"}

- name: Install codespell
run: pip3 install codespell
- name: Install codespell
run: pip3 install codespell

- name: Lint
run: cmake -D FORMAT_COMMAND=clang-format-14 -P cmake/lint.cmake
- name: Lint
working-directory: asio
run: cmake -D FORMAT_COMMAND=clang-format-14 -P cmake/lint.cmake

- name: Spell check
if: always()
run: cmake -P cmake/spell.cmake
- name: Spell check
if: always()
working-directory: asio
run: cmake -P cmake/spell.cmake

coverage:
needs: [lint]
@@ -44,56 +46,61 @@ jobs:
&& false

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3

- name: Install LCov
run: sudo apt-get update -q
&& sudo apt-get install lcov -q -y
- name: Install LCov
run: sudo apt-get update -q
&& sudo apt-get install lcov -q -y

- name: Configure
run: cmake --preset=ci-coverage
- name: Configure
working-directory: asio
run: cmake --preset=ci-coverage

- name: Build
run: cmake --build build/coverage -j 2
- name: Build
working-directory: asio
run: cmake --build build/coverage -j 2

- name: Test
working-directory: build/coverage
run: ctest --output-on-failure --no-tests=error -j 2
- name: Test
working-directory: asio/build/coverage
run: ctest --output-on-failure --no-tests=error -j 2

- name: Process coverage info
run: cmake --build build/coverage -t coverage
- name: Process coverage info
working-directory: asio
run: cmake --build build/coverage -t coverage

- name: Submit to codecov.io
uses: codecov/codecov-action@v3
with:
file: build/coverage/coverage.info
- name: Submit to codecov.io
uses: codecov/codecov-action@v3
with:
file: build/coverage/coverage.info

sanitize:
needs: [lint]

runs-on: ubuntu-22.04

env: { CXX: clang++-14 }
env: {CXX: clang++-14}

steps:
- uses: actions/checkout@v3

- name: Configure
run: cmake --preset=ci-sanitize

- name: Build
run: cmake --build build/sanitize -j 2

- name: Test
working-directory: build/sanitize
env:
ASAN_OPTIONS: "strict_string_checks=1:\
detect_stack_use_after_return=1:\
check_initialization_order=1:\
strict_init_order=1:\
detect_leaks=1"
UBSAN_OPTIONS: print_stacktrace=1
run: ctest --output-on-failure --no-tests=error -j 2
- uses: actions/checkout@v3

- name: Configure
working-directory: asio
run: cmake --preset=ci-sanitize

- name: Build
working-directory: asio
run: cmake --build build/sanitize -j 2

- name: Test
working-directory: asio/build/sanitize
env:
ASAN_OPTIONS: "strict_string_checks=1:\
detect_stack_use_after_return=1:\
check_initialization_order=1:\
strict_init_order=1:\
detect_leaks=1"
UBSAN_OPTIONS: print_stacktrace=1
run: ctest --output-on-failure --no-tests=error -j 2

test:
needs: [lint]
@@ -105,36 +112,39 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3

- name: Install static analyzers
if: matrix.os == 'ubuntu-22.04'
run: >-
sudo apt-get install clang-tidy-14 cppcheck -y -q
- name: Install static analyzers
if: matrix.os == 'ubuntu-22.04'
run: >-
sudo apt-get install clang-tidy-14 cppcheck -y -q
sudo update-alternatives --install
/usr/bin/clang-tidy clang-tidy
/usr/bin/clang-tidy-14 140
sudo update-alternatives --install
/usr/bin/clang-tidy clang-tidy
/usr/bin/clang-tidy-14 140
- name: Setup MultiToolTask
if: matrix.os == 'windows-2022'
run: |
Add-Content "$env:GITHUB_ENV" 'UseMultiToolTask=true'
Add-Content "$env:GITHUB_ENV" 'EnforceProcessCountAcrossBuilds=true'
- name: Setup MultiToolTask
if: matrix.os == 'windows-2022'
run: |
Add-Content "$env:GITHUB_ENV" 'UseMultiToolTask=true'
Add-Content "$env:GITHUB_ENV" 'EnforceProcessCountAcrossBuilds=true'
- name: Configure
shell: pwsh
run: cmake "--preset=ci-$("${{ matrix.os }}".split("-")[0])"
- name: Configure
shell: pwsh
working-directory: asio
run: cmake "--preset=ci-$("${{ matrix.os }}".split("-")[0])"

- name: Build
run: cmake --build build --config Release -j 2
- name: Build
working-directory: asio
run: cmake --build build --config Release -j 2

- name: Install
run: cmake --install build --config Release --prefix prefix
- name: Install
working-directory: asio
run: cmake --install build --config Release --prefix prefix

- name: Test
working-directory: build
run: ctest --output-on-failure --no-tests=error -C Release -j 2
- name: Test
working-directory: asio/build
run: ctest --output-on-failure --no-tests=error -C Release -j 2

docs:
# Deploy docs only when builds succeed
@@ -159,24 +169,25 @@ jobs:
&& false

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with: { python-version: "3.8" }
- uses: actions/setup-python@v4
with: {python-version: "3.8"}

- name: Install m.css dependencies
run: pip3 install jinja2 Pygments
- name: Install m.css dependencies
run: pip3 install jinja2 Pygments

- name: Install Doxygen
run: sudo apt-get update -q
&& sudo apt-get install doxygen -q -y
- name: Install Doxygen
run: sudo apt-get update -q
&& sudo apt-get install doxygen -q -y

- name: Build docs
run: cmake "-DPROJECT_SOURCE_DIR=$PWD" "-DPROJECT_BINARY_DIR=$PWD/build"
-P cmake/docs-ci.cmake
- name: Build docs
working-directory: asio
run: cmake "-DPROJECT_SOURCE_DIR=$PWD" "-DPROJECT_BINARY_DIR=$PWD/build"
-P cmake/docs-ci.cmake

- name: Deploy docs
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: build/docs/html
- name: Deploy docs
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: build/docs/html

0 comments on commit 5f7f60d

Please sign in to comment.