-
Notifications
You must be signed in to change notification settings - Fork 4
139 lines (120 loc) · 4.04 KB
/
tests.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: tests
on:
# push:
# branches: [ "main" ]
# paths-ignore:
# - "examples/**"
# - "doc/**"
# - "README.md"
# - "*.txt"
# - "CHANGELOG"
# - "tools/*.py"
pull_request:
branches: [ "main" ]
paths-ignore:
- "examples/**"
- "doc/**"
- "README.md"
- "CHANGELOG"
- "tools/*.py"
- ".github/workflows/build_wheels.yml"
- ".github/dependabot.yml"
- ".github/ISSUE_TEMPLATE/**"
- "branding/**"
- ".gitignore"
- "CMakePresets.json"
- "THANKS.txt"
- "LICENSE.txt"
- "VERSION.txt"
- "CITATION.cff"
- ".gitignore"
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Debug
VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite'
jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-python@v5
with:
python-version: 3.13
- name: Setup gha caching for vcpkg
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 || '');
# - uses: microsoft/[email protected]
# if: runner.os == 'Windows'
# with:
# msbuild-architecture: x64
- name: use ninja on non windows
# if: runner.os != 'Windows'
shell: bash
run: |
echo "CMAKE_GENERATOR=Ninja" >> $GITHUB_ENV
- name: Setup msbuild on Windows
if: runner.os == 'Windows'
uses: microsoft/[email protected]
- name: Setup ninja on Windows
if: runner.os == 'Windows'
uses: ashutoshvarma/[email protected]
- name: Enable developer command prompt
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
- name: install pkgconfig on windows
if: runner.os == 'Windows'
shell: bash
run: |
choco install pkgconfiglite
- name: install autoconf on macos
if: runner.os == 'macOs'
shell: bash
run: |
brew install autoconf automake libtool m4 ninja
- name: Python dependencies
shell: bash
run: |
python -m pip install numpy ninja pytest pybind11
- name: setup vcpkg
shell: bash
run: |
git clone https://github.com/Microsoft/vcpkg.git tools/vcpkg
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: |
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DROUGHPY_BUILD_TESTS=ON -DROUGHPY_BUILD_PYMODULE_INPLACE=ON
env:
VERBOSE: 1
CMAKE_TOOLCHAIN_FILE: ${{ github.workspace }}/tools/vcpkg/scripts/buildsystems/vcpkg.cmake
MACOSX_DEPLOYMENT_TARGET: 11.0.0
- name: Build
# Build your program with the given configuration
run: cmake --build ${{ github.workspace }}/build --config ${{env.BUILD_TYPE}}
env:
VERBOSE: 1
- name: Test
shell: bash
working-directory: ${{ github.workspace }}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}}
- name: PyTests
shell: bash
run: pytest tests
env:
PYTHONPATH: ${{ github.workspace }}