-
Notifications
You must be signed in to change notification settings - Fork 1
139 lines (120 loc) · 4.47 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: ci
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
checks: write
id-token: write
jobs:
build:
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
os: [windows, linux, macos]
platform: [x86_64, aarch64]
compiler: [msvc, gcc, clang]
config: [Debug, Release]
python: ["3.10"]
exclude:
# Exclude aarch64 for windows/linux
- { os: windows, platform: aarch64 }
- { os: linux, platform: aarch64 }
# Exclude x86_64 for macos
- { os: macos, platform: x86_64 }
# Exclude unavailable compilers
- { os: windows, compiler: gcc }
- { os: windows, compiler: clang }
- { os: linux, compiler: msvc }
- { os: macos, compiler: msvc }
- { os: macos, compiler: gcc }
include:
# Builds running on self-hosted runners (build + tests + coverage)
- { os: windows, compiler: msvc, config: Debug, flags: "unit-test,header-validation", runs-on: [self-hosted, Windows, X64] }
- { os: windows, compiler: msvc, config: Release, flags: "unit-test", runs-on: [self-hosted, Windows, X64] }
- { os: linux, compiler: gcc, config: Debug, flags: "unit-test,header-validation,coverage", runs-on: [self-hosted, Linux, X64] }
- { os: linux, compiler: gcc, config: Release, flags: "unit-test", runs-on: [self-hosted, Linux, X64] }
# Additional builds running on GitHub hosted runners (build only)
- { os: linux, compiler: clang, runs-on: [ubuntu-latest] }
- { os: macos, compiler: clang, runs-on: [macos-latest] }
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
# Environment variables used by ci.py
CI_OS: ${{ matrix.os }}
CI_PLATFORM: ${{ matrix.platform }}
CI_COMPILER: ${{ matrix.compiler }}
CI_CONFIG: ${{ matrix.config }}
CI_PYTHON: ${{ matrix.python }}
CI_FLAGS: ${{ matrix.flags }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
lfs: true
# Setup Linux.
- name: Setup Linux
if: startsWith(matrix.os, 'linux') && !contains(matrix.runs-on, 'self-hosted')
run: |
sudo apt install -y libxinerama-dev libxcursor-dev xorg-dev libglu1-mesa-dev pkg-config
# Setup Python.
- name: Setup Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: 'pip'
# Setup Python environment.
- name: Setup Python environment
run: |
python -m pip install -r tools/buildrequirements.txt
python -m pip install pytest-github-actions-annotate-failures
# Setup MSVC.
- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1
# Setup.
- name: Setup
run: python tools/ci.py setup
# Setup vcpkg caching.
- name: Export GitHub Actions cache environment variables
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 || '');
# Configure.
- name: Configure
run: python tools/ci.py configure
# Build.
- name: Build
run: python tools/ci.py build
# Typing Checks (Python)
- name: Typing Checks (Python)
run: python tools/ci.py typing-check-python
# Unit Tests (C++)
- name: Unit Tests (C++)
if: contains(matrix.flags, 'unit-test')
run: python tools/ci.py unit-test-cpp
# Unit Tests (Python)
- name: Unit Tests (Python)
if: contains(matrix.flags, 'unit-test')
run: python tools/ci.py unit-test-python
# Unit Test Report
- name: Unit Test Report
uses: mikepenz/action-junit-report@v4
if: contains(matrix.flags, 'unit-test')
with:
report_paths: 'reports/*-junit.xml'
check_name: "Unit Test Report"
# Generate Coverage Report
- name: Generate Coverage Report
if: contains(matrix.flags, 'coverage')
run: python tools/ci.py coverage-report
# Coverage Report
- name: Coverage Report
uses: actions/upload-artifact@v4
if: contains(matrix.flags, 'coverage')
with:
name: coverage-report
path: reports/coverage.html