-
Notifications
You must be signed in to change notification settings - Fork 2
110 lines (95 loc) · 3.67 KB
/
cmake.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
name: CMake
env:
VCPKG_BINARY_SOURCES: 'clear;nuget,GitHub,readwrite'
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
build:
name: "${{ matrix.configurations.name }} | ${{ matrix.cmake-build-type }}"
runs-on: ${{ matrix.configurations.os }}
strategy:
fail-fast: false
matrix:
configurations:
- name: Ubuntu 22.04 Clang
os: ubuntu-22.04
cmake_env:
CC: clang-12
CXX: clang++-12
cmake_platform_option: ""
cache_name: "ubuntu-clang"
- name: Ubuntu 22.04 GCC
os: ubuntu-22.04
cmake_env: {}
cmake_platform_option: ""
cache_name: "ubuntu-gcc"
- name: 64 Windows 2022
os: windows-2022
cmake_env: {}
cmake_platform_option: "-A x64"
cache_name: "win64"
- name: MacOS 11
os: macos-11
cmake_env: {}
cmake_platform_option: ""
cache_name: "macos"
- name: 32 Windows 2022
os: windows-2022
cmake_env: {}
cmake_platform_option: "-A Win32"
cache_name: "win32"
cmake-build-type: [Release, Debug]
steps:
- uses: actions/checkout@v2
- name: Create vcpkg build folder
run: |
mkdir -p ${{runner.workspace}}/build/vcpkg_installed
mkdir -p ${{runner.workspace}}/build/_deps
- name: Cache vcpkg
uses: actions/cache@v2
env:
cache-name: vcpkg-modules
with:
path: |
${{runner.workspace}}/build/vcpkg_installed
${{runner.workspace}}/build/_deps
key: ${{ matrix.configurations.os }}-${{ matrix.configurations.cache_name }}-${{ matrix.cmake-build-type }}-${{ hashFiles('vcpkg.json') }}-${{ hashFiles('cmake/vcpkg.cmake') }}
# - name: Fix Path on Ubuntu
# if: matrix.configurations.os == 'ubuntu-20.04'
# run: echo "/home/runner/.local/bin" >> $GITHUB_PATH
- name: Install Linux dependencies
if: matrix.configurations.os == 'ubuntu-22.04'
run: sudo apt-get update && sudo apt-get install -y libx11-dev libxrandr-dev libxi-dev libgl1-mesa-dev libudev-dev clang-12 make ninja-build cmake
- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{runner.workspace}}/build
- name: Configure CMake
working-directory: ${{runner.workspace}}/build
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.cmake-build-type }} ${{ matrix.configurations.cmake_platform_option }}
env: ${{ matrix.configurations.cmake_env }}
- name: Build
working-directory: ${{runner.workspace}}/build
shell: bash
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config ${{ matrix.cmake-build-type }}
env: ${{ matrix.configurations.cmake_env }}
- name: Test
working-directory: ${{runner.workspace}}/build
shell: bash
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{ matrix.cmake-build-type }}
env:
CTEST_OUTPUT_ON_FAILURE: 1
- name: Demo Check
if: matrix.configurations.os == 'ubuntu-22.04'
shell: bash
run: ./demo-check.sh ${{runner.workspace}}