Update CI action version references #404
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: Continuous Integration | |
on: | |
push: | |
branches: | |
- develop | |
- feature/* | |
paths: | |
- "!cmake-init/templates/common/.github/**" | |
- "!cmake-init/templates/common/docs/**" | |
- "!cmake-init/templates/common/*.md" | |
- "!cmake-init/templates/common/.gitignore" | |
- "!cmake-init/templates/common/CMakeUserPresets.json" | |
- .github/workflows/* | |
- cmake-init/** | |
pull_request: | |
branches: | |
- develop | |
paths: | |
- "!cmake-init/templates/common/.github/**" | |
- "!cmake-init/templates/common/docs/**" | |
- "!cmake-init/templates/common/*.md" | |
- "!cmake-init/templates/common/.gitignore" | |
- "!cmake-init/templates/common/CMakeUserPresets.json" | |
- .github/workflows/* | |
- cmake-init/** | |
jobs: | |
test: | |
if: github.event.commits[0].message != 'Bump version' | |
strategy: | |
fail-fast: false | |
matrix: | |
job: [1, 2, 3, 4, 5, 6, 7, 8, 9] | |
pm: [none, conan, vcpkg] | |
os: [macos-12, ubuntu-22.04, windows-2022] | |
include: | |
- { job: 1, type: "-s --examples", name: "Library (C++): shared", flag: "-D BUILD_SHARED_LIBS=YES" } | |
- { job: 2, type: "-s --examples", name: "Library (C++): static", flag: "" } | |
- { job: 3, type: "-h --examples", name: "Library (C++): header-only", flag: "" } | |
- { job: 4, type: -e, name: "Executable (C++)", flag: "" } | |
- { job: 5, type: "--c -s --examples", name: "Library (C): shared", flag: "-D BUILD_SHARED_LIBS=YES" } | |
- { job: 6, type: "--c -s --examples", name: "Library (C): static", flag: "" } | |
- { job: 7, type: "--c -h --examples", name: "Library (C): header-only", flag: "" } | |
- { job: 8, type: "--c -e", name: "Executable (C)", flag: "" } | |
- { job: 9, type: "--c --std 17 -e", name: "Executable (C17)", flag: "" } | |
name: "${{ matrix.name }} (${{ matrix.os }}) (PM: ${{ matrix.pm }})" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- 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 | |
- uses: actions/setup-python@v5 | |
with: { python-version: "3.8" } | |
- name: Create project | |
run: | | |
python -m zipapp cmake-init -p "/usr/bin/env python3" | |
python cmake-init.pyz ${{ matrix.type }} -p ${{ matrix.pm }} proj | |
- name: Lint generated project | |
if: matrix.os == 'ubuntu-22.04' | |
working-directory: proj | |
run: cmake -D FORMAT_COMMAND=clang-format-14 -P cmake/lint.cmake | |
- name: Setup MultiToolTask | |
if: matrix.os == 'windows-2022' | |
run: | | |
Add-Content "$env:GITHUB_ENV" 'UseMultiToolTask=true' | |
Add-Content "$env:GITHUB_ENV" 'EnforceProcessCountAcrossBuilds=true' | |
- name: Install Conan | |
if: matrix.pm == 'conan' | |
working-directory: proj | |
shell: bash | |
run: bash < .github/scripts/conan-ci-setup.sh | |
- name: Install vcpkg | |
if: matrix.pm == 'vcpkg' | |
uses: friendlyanon/setup-vcpkg@v1 | |
with: | |
committish: "72d66da23b4332533c82d797bf2f82b8d6d1bf8a" | |
cache-version: "1" | |
ignore-reserve-cache-error: true | |
- name: Configure | |
shell: pwsh | |
run: cmake -S proj "--preset=ci-$("${{ matrix.os }}".split("-")[0])" | |
${{ matrix.flag }} | |
- name: Setup PATH | |
if: matrix.os == 'windows-2022' | |
run: Add-Content "$env:GITHUB_PATH" "$(Get-Location)\proj\build\Release" | |
- name: Build | |
run: cmake --build proj/build --config Release | |
- name: Install | |
run: cmake --install proj/build --config Release --prefix proj/prefix | |
- name: Test | |
run: ctest --test-dir proj/build -C Release --no-tests=error |