Skip to content

Commit cf5716e

Browse files
imikejacksonclaude
andcommitted
CI: Enable GitHub Actions CI with ctest discovery
Add linux, macos, and windows workflow files for GitHub Actions CI. Update CMakePresets.json to remove hardcoded VCPKG_INSTALLATION_ROOT and CMAKE_MAKE_PROGRAM paths that don't exist on GitHub Actions runners. Add enable_testing() and catch_discover_tests() so ctest can discover and run the Catch2 unit tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 20b8a01 commit cf5716e

7 files changed

Lines changed: 188 additions & 11 deletions

File tree

.github/workflows/clang-format.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
shell: bash
1616

1717
steps:
18-
- uses: actions/checkout@v2
18+
- uses: actions/checkout@v4
1919
with:
2020
fetch-depth: 2
2121

.github/workflows/linux.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: linux
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- develop
7+
- master
8+
push:
9+
branches:
10+
- develop
11+
- master
12+
13+
jobs:
14+
build:
15+
env:
16+
VCPKG_BINARY_SOURCES: 'clear;nuget,GitHub,readwrite'
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
os:
21+
- ubuntu-22.04
22+
cxx:
23+
- g++-11
24+
- clang++-14
25+
include:
26+
- cxx: g++-11
27+
cc: gcc-11
28+
- cxx: clang++-14
29+
cc: clang-14
30+
runs-on: ${{matrix.os}}
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
- name: Add C++ Problem Matcher
35+
uses: ammaraskar/gcc-problem-matcher@0.2.0
36+
- name: Install Dependencies
37+
run: |
38+
sudo apt-get -y install ninja-build
39+
- name: Setup NuGet Credentials
40+
shell: bash
41+
run: |
42+
mono `vcpkg fetch nuget | tail -n 1` \
43+
sources add \
44+
-source "https://nuget.pkg.github.com/BlueQuartzSoftware/index.json" \
45+
-storepasswordincleartext \
46+
-name "GitHub" \
47+
-username "BlueQuartzSoftware" \
48+
-password "${{secrets.GITHUB_TOKEN}}"
49+
mono `vcpkg fetch nuget | tail -n 1` \
50+
setapikey "${{secrets.GITHUB_TOKEN}}" \
51+
-source "https://nuget.pkg.github.com/BlueQuartzSoftware/index.json"
52+
- name: Configure
53+
env:
54+
CC: ${{matrix.cc}}
55+
CXX: ${{matrix.cxx}}
56+
run: |
57+
cmake --preset ci-linux-x64 ${{github.workspace}}
58+
- name: Build
59+
run: |
60+
cmake --build --preset ci-linux-x64
61+
- name: Test
62+
run: |
63+
ctest --preset ci-linux-x64

.github/workflows/macos.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: macos
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- develop
7+
- master
8+
push:
9+
branches:
10+
- develop
11+
- master
12+
13+
jobs:
14+
build:
15+
env:
16+
VCPKG_BINARY_SOURCES: 'clear;nuget,GitHub,readwrite'
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
os:
21+
- macos-14
22+
- macos-15
23+
include:
24+
- os: macos-14
25+
preset: ci-macos-arm64
26+
- os: macos-15
27+
preset: ci-macos-arm64
28+
runs-on: ${{matrix.os}}
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
- name: Setup vcpkg
33+
run: |
34+
if [ -z "$VCPKG_INSTALLATION_ROOT" ] || [ ! -d "$VCPKG_INSTALLATION_ROOT" ]; then
35+
git clone https://www.github.com/microsoft/vcpkg && cd vcpkg && ./bootstrap-vcpkg.sh
36+
VCPKG_INSTALLATION_ROOT=${{github.workspace}}/vcpkg
37+
echo "$VCPKG_INSTALLATION_ROOT" >> $GITHUB_PATH
38+
echo "VCPKG_INSTALLATION_ROOT=$VCPKG_INSTALLATION_ROOT" >> "$GITHUB_ENV"
39+
fi
40+
- name: Add C++ Problem Matcher
41+
uses: ammaraskar/gcc-problem-matcher@0.2.0
42+
- name: Install Dependencies
43+
run: |
44+
brew install ninja mono
45+
- name: Setup NuGet Credentials
46+
shell: bash
47+
run: |
48+
mono `vcpkg fetch nuget | tail -n 1` \
49+
sources add \
50+
-source "https://nuget.pkg.github.com/BlueQuartzSoftware/index.json" \
51+
-storepasswordincleartext \
52+
-name "GitHub" \
53+
-username "BlueQuartzSoftware" \
54+
-password "${{secrets.GITHUB_TOKEN}}"
55+
mono `vcpkg fetch nuget | tail -n 1` \
56+
setapikey "${{secrets.GITHUB_TOKEN}}" \
57+
-source "https://nuget.pkg.github.com/BlueQuartzSoftware/index.json"
58+
- name: Configure
59+
run: |
60+
cmake --preset ${{matrix.preset}} ${{github.workspace}}
61+
- name: Build
62+
run: |
63+
cmake --build --preset ${{matrix.preset}}
64+
- name: Test
65+
run: |
66+
ctest --preset ${{matrix.preset}}

.github/workflows/windows.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: windows
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- develop
7+
- master
8+
push:
9+
branches:
10+
- develop
11+
- master
12+
13+
jobs:
14+
build:
15+
env:
16+
VCPKG_BINARY_SOURCES: 'clear;nuget,GitHub,readwrite'
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
os:
21+
- windows-2022
22+
toolset:
23+
- v143
24+
runs-on: ${{matrix.os}}
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
- name: Add C++ Problem Matcher
29+
uses: ammaraskar/msvc-problem-matcher@0.2.0
30+
- name: Setup Build Environment
31+
uses: ilammy/msvc-dev-cmd@v1.12.1
32+
with:
33+
vsversion: 2022
34+
- name: Setup NuGet Credentials
35+
shell: bash
36+
run: |
37+
`vcpkg fetch nuget | tail -n 1` \
38+
sources add \
39+
-source "https://nuget.pkg.github.com/BlueQuartzSoftware/index.json" \
40+
-storepasswordincleartext \
41+
-name "GitHub" \
42+
-username "BlueQuartzSoftware" \
43+
-password "${{secrets.GITHUB_TOKEN}}"
44+
`vcpkg fetch nuget | tail -n 1` \
45+
setapikey "${{secrets.GITHUB_TOKEN}}" \
46+
-source "https://nuget.pkg.github.com/BlueQuartzSoftware/index.json"
47+
- name: Configure
48+
run: |
49+
cmake --preset ci-windows-${{matrix.toolset}} ${{github.workspace}} -T ${{matrix.toolset}}
50+
- name: Build
51+
run: |
52+
cmake --build --preset ci-windows-${{matrix.toolset}}
53+
- name: Test
54+
run: |
55+
ctest --preset ci-windows-${{matrix.toolset}}

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ include(${EbsdLibProj_SOURCE_DIR}/Source/EbsdLib/SourceList.cmake)
164164
# Build Unit Test
165165
# ------------------------------------------------------------------------------
166166
if(EbsdLib_BUILD_TESTS)
167+
enable_testing()
167168
include(${EbsdLibProj_SOURCE_DIR}/Source/Test/CMakeLists.txt)
168169
endif()
169170

CMakePresets.json

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,6 @@
141141
"type": "STRING",
142142
"value": "Debug"
143143
}
144-
},
145-
"environment": {
146-
"VCPKG_INSTALLATION_ROOT": "/opt/local/vcpkg"
147144
}
148145
},
149146
{
@@ -160,14 +157,7 @@
160157
"VCPKG_HOST_TRIPLET": {
161158
"type": "STRING",
162159
"value": "x64-linux-dynamic"
163-
},
164-
"CMAKE_MAKE_PROGRAM": {
165-
"type": "FILEPATH",
166-
"value": "$env{VCPKG_INSTALLATION_ROOT}/downloads/tools/ninja/1.10.2-linux/ninja"
167160
}
168-
},
169-
"environment": {
170-
"VCPKG_INSTALLATION_ROOT": "/opt/local/vcpkg"
171161
}
172162
}
173163
],

Source/Test/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,6 @@ if(MSVC)
5252
set_source_files_properties(${EbsdLibProj_BINARY_DIR}/EbsdLibUnitTest.cpp PROPERTIES COMPILE_FLAGS /bigobj)
5353
endif()
5454

55+
catch_discover_tests(${UNIT_TEST_TARGET} TEST_PREFIX "EbsdLib::")
56+
5557
get_property(EbsdLib_EXTRA_LIBRARY_DIRS GLOBAL PROPERTY EbsdLib_EXTRA_LIBRARY_DIRS)

0 commit comments

Comments
 (0)