-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (76 loc) · 2.91 KB
/
cmake-multi-platform.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
name: Build and Test (Linux/macOS/Windows)
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
jobs:
multi-platform-build:
runs-on: ${{matrix.config.os}}
strategy:
matrix:
config:
- os: ubuntu-latest
vcpkg_triplet: x64-linux-release
- os: macos-latest
vcpkg_triplet: arm64-osx-release
- os: windows-latest
vcpkg_triplet: x64-windows-release
steps:
- uses: actions/checkout@v4
- name: Set up GitHub Cache (Windows)
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
if: matrix.config.os == 'windows-latest'
- name: Install Catch2 via vcpkg (Windows)
run: vcpkg install catch2 --binarysource="clear;x-gha,readwrite"
if: matrix.config.os == 'windows-latest'
- name: Install gnuplot (Linux)
run: |
sudo apt-get update && \
sudo apt-get upgrade -y && \
sudo apt-get install -y gnuplot
if: matrix.config.os == 'ubuntu-latest'
- name: Install gnuplot (Windows)
run: |
choco install gnuplot
if: matrix.config.os == 'windows-latest'
- name: Install gnuplot (macOS)
run: |
brew install gnuplot
if: matrix.config.os == 'macos-latest'
- name: vcpkg build (Linux/macOS)
uses: johnwason/vcpkg-action@v6
id: vcpkg
with:
pkgs: catch2
triplet: ${{ matrix.config.vcpkg_triplet }}
cache-key: ${{ matrix.config.os }}
revision: master
token: ${{ github.token }}
github-binarycache: true
if: matrix.config.os == 'ubuntu-latest' || matrix.config.os == 'macos-latest'
- name: Configure with CMake (Linux/macOS)
run: |
cmake ${{ steps.vcpkg.outputs.vcpkg-cmake-config }} -S ${{ github.workspace }} -B build
if: matrix.config.os == 'ubuntu-latest' || matrix.config.os == 'macos-latest'
- name: Configure with CMake (Windows)
run: |
cmake -S ${{github.workspace}} -B build -DCMAKE_TOOLCHAIN_FILE="$Env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"
if: matrix.config.os == 'windows-latest'
- name: Build
run: cmake --build build
- name: Test (Linux and macOS)
working-directory: ${{github.workspace}}/build
run: ctest --output-on-failure
if: matrix.config.os == 'ubuntu-latest' || matrix.config.os == 'macos-latest'
- name: Test (Windows)
working-directory: ${{github.workspace}}/build
run: ctest --output-on-failure
env:
G3P_GNUPLOT_PATH: "C:/Program Files/gnuplot/bin/gnuplot.exe"
if: matrix.config.os == 'windows-latest'