-
Notifications
You must be signed in to change notification settings - Fork 81
121 lines (95 loc) · 3.71 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
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-14, 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: "ad25766aefb5313b6bc4e2a4b78a2946f84fbf66"
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