Skip to content

Commit 0dbcd9c

Browse files
authored
Create build_windows.yml
1 parent 718a298 commit 0dbcd9c

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed

.github/workflows/build_windows.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: CMake on multiple platforms - windows
2+
3+
on:
4+
workflow_dispatch
5+
6+
jobs:
7+
build:
8+
runs-on: ${{ matrix.os }}
9+
10+
strategy:
11+
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
12+
fail-fast: false
13+
14+
# Set up a matrix to run the following 3 configurations:
15+
# 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
16+
# 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
17+
# 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
18+
#
19+
# To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
20+
matrix:
21+
os: [windows-latest]
22+
build_type: [Release]
23+
include:
24+
- os: windows-latest
25+
openmp: ON
26+
serial: OFF
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- name: Set reusable strings
31+
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
32+
id: strings
33+
shell: bash
34+
run: |
35+
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
36+
37+
- name: Set up Python
38+
uses: actions/setup-python@v5
39+
with:
40+
python-version: 3.11
41+
42+
- name: Install dependencies
43+
env:
44+
PYTHONPATH: ${{ steps.strings.outputs.build-output-dir }}/python
45+
run: |
46+
python -m pip install --upgrade pip
47+
pip install pytest
48+
# Released version of pyttb is too old, so we need to build from the github repo
49+
#pip install pyttb
50+
mkdir pyttb
51+
cd pyttb
52+
git clone https://github.com/sandialabs/pyttb.git
53+
cd pyttb
54+
pip install .
55+
56+
57+
- name: Configure CMake
58+
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
59+
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
60+
run: >
61+
cmake -B ${{ steps.strings.outputs.build-output-dir }}
62+
-DBUILD_SHARED_LIBS=ON
63+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
64+
-DKokkos_ENABLE_OPENMP=${{ matrix.openmp }}
65+
-DKokkos_ENABLE_SERIAL=${{ matrix.serial }}
66+
-DENABLE_PYTHON=ON
67+
-S ${{ github.workspace }}
68+
69+
- name: Build
70+
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
71+
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
72+
73+
- name: Test
74+
working-directory: ${{ steps.strings.outputs.build-output-dir }}
75+
env:
76+
PYTHONPATH: ${{ steps.strings.outputs.build-output-dir }}/python
77+
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
78+
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
79+
run: ctest --build-config ${{ matrix.build_type }} --output-on-failure

0 commit comments

Comments
 (0)