Skip to content

Commit 7247608

Browse files
author
Gonzalo Diaz
committed
[CONFIG] [Github Actions] build / test environments splitted by OS.
1 parent af55920 commit 7247608

File tree

4 files changed

+150
-6
lines changed

4 files changed

+150
-6
lines changed

.github/workflows/cpp.yml renamed to .github/workflows/cpp-linux.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
2-
3-
name: C/C++ CMake CI Test
2+
name: C/C++ CMake/GNU Linux CI Test
43

54
on: # yamllint disable-line rule:truthy
65
push:
@@ -11,13 +10,11 @@ on: # yamllint disable-line rule:truthy
1110
workflow_dispatch:
1211

1312
jobs:
14-
build:
13+
test:
1514
name: C/C++ CMake CI Test
1615
strategy:
1716
matrix:
18-
os: ["ubuntu-24.04", "macos-14"
19-
# , "windows-2022"
20-
]
17+
os: ["ubuntu-24.04"]
2118
runs-on: ${{ matrix.os }}
2219

2320
steps:

.github/workflows/cpp-macos.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
name: C/C++ CMake/LLVM MacOS CI Test
3+
4+
on: # yamllint disable-line rule:truthy
5+
push:
6+
branches: ["main"]
7+
pull_request:
8+
# The branches below must be a subset of the branches above
9+
branches: ["main"]
10+
workflow_dispatch:
11+
12+
jobs:
13+
test:
14+
name: C/C++ CMake CI Test
15+
strategy:
16+
matrix:
17+
os: ["macos-14"]
18+
runs-on: ${{ matrix.os }}
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
23+
24+
- name: Install
25+
shell: bash
26+
run: |
27+
if [ "$RUNNER_OS" == "macOS" ]; then
28+
brew install vcpkg
29+
git clone https://github.com/microsoft/vcpkg "$HOME/vcpkg"
30+
export VCPKG_ROOT="$HOME/vcpkg"
31+
echo "VCPKG_ROOT=$HOME/vcpkg" >> $GITHUB_ENV
32+
elif [ "$RUNNER_OS" == "Linux" ]; then
33+
echo "VCPKG_ROOT=/usr/local/share/vcpkg" >> $GITHUB_ENV
34+
elif [ "$RUNNER_OS" == "Windows" ]; then
35+
echo "VCPKG_ROOT=C:/vcpkg" >> $GITHUB_ENV
36+
fi
37+
38+
- name: Check Tools
39+
run: |
40+
echo "-----------"
41+
make --version
42+
echo "-----------"
43+
cmake --version
44+
echo "-----------"
45+
vcpkg --version
46+
echo "-----------"
47+
48+
- name: Install dependencies
49+
run: |
50+
make dependencies
51+
52+
- name: Build
53+
run: |
54+
make build
55+
56+
- name: Test
57+
run: |
58+
make test

.github/workflows/cpp-windows.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
name: C/C++ CMake/MSVC Windows CI Test
3+
4+
on: # yamllint disable-line rule:truthy
5+
push:
6+
branches: ["main"]
7+
pull_request:
8+
# The branches below must be a subset of the branches above
9+
branches: ["main"]
10+
workflow_dispatch:
11+
12+
jobs:
13+
test:
14+
name: C/C++ CMake CI Test
15+
strategy:
16+
matrix:
17+
os: ["windows-2022"]
18+
arch:
19+
- amd64
20+
- amd64_x86
21+
# - amd64_arm64
22+
23+
runs-on: ${{ matrix.os }}
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
28+
29+
- name: Install
30+
shell: bash
31+
run: |
32+
if [ "$RUNNER_OS" == "macOS" ]; then
33+
brew install vcpkg
34+
git clone https://github.com/microsoft/vcpkg "$HOME/vcpkg"
35+
export VCPKG_ROOT="$HOME/vcpkg"
36+
echo "VCPKG_ROOT=$HOME/vcpkg" >> $GITHUB_ENV
37+
elif [ "$RUNNER_OS" == "Linux" ]; then
38+
echo "VCPKG_ROOT=/usr/local/share/vcpkg" >> $GITHUB_ENV
39+
elif [ "$RUNNER_OS" == "Windows" ]; then
40+
echo "VCPKG_ROOT=C:/vcpkg" >> $GITHUB_ENV
41+
fi
42+
43+
- name: Check Tools
44+
run: |
45+
echo "-----------"
46+
make --version
47+
echo "-----------"
48+
cmake --version
49+
echo "-----------"
50+
vcpkg --version
51+
echo "-----------"
52+
53+
- uses: ilammy/msvc-dev-cmd@v1
54+
with:
55+
arch: ${{ matrix.arch }}
56+
57+
- name: Install dependencies
58+
run: |
59+
vcpkg --x-wait-for-lock integrate install
60+
vcpkg --x-wait-for-lock install
61+
62+
- name: Pre Build
63+
run: >
64+
cmake.exe
65+
-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake
66+
-DCMAKE_BUILD_TYPE=Debug
67+
-DCMAKE_C_COMPILER=cl
68+
-DCMAKE_CXX_COMPILER=cl
69+
-S${{ github.workspace }}
70+
-B${{ github.workspace }}/build/default -G "MinGW Makefiles"
71+
72+
- name: Build
73+
run: |
74+
cmake --build build/default
75+
76+
- name: Test
77+
run: >
78+
ctest --test-dir ${{ github.workspace }}/build/default

CMakePresets.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,17 @@
1010
},
1111
"generator": "Unix Makefiles",
1212
"binaryDir": "${sourceDir}/build/default"
13+
},
14+
{
15+
"name": "windows",
16+
"cacheVariables": {
17+
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
18+
"CMAKE_BUILD_TYPE": "Debug",
19+
"CMAKE_C_COMPILER": "cl",
20+
"CMAKE_CXX_COMPILER": "cl"
21+
},
22+
"generator": "MinGW Makefiles",
23+
"binaryDir": "${sourceDir}/build/default"
1324
}
1425
]
1526
}

0 commit comments

Comments
 (0)