-
Notifications
You must be signed in to change notification settings - Fork 1
215 lines (178 loc) · 7 KB
/
windows-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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# Copyright (C) 2023 Roberto Rossini (roberros@uio.no)
# SPDX-License-Identifier: MIT
name: Windows CI
on:
push:
branches: [ main ]
paths:
- ".github/workflows/windows-ci.yml"
- "cmake/**"
- "examples/**"
- "src/**"
- "test/**"
- "CMakeLists.txt"
- "conanfile.txt"
tags:
- 'v*.*.*'
pull_request:
paths:
- ".github/workflows/windows-ci.yml"
- "cmake/**"
- "examples/**"
- "src/**"
- "test/**"
- "CMakeLists.txt"
- "conanfile.txt"
# https://stackoverflow.com/a/72408109
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
CCACHE_DIR: "${{ github.workspace }}/.ccache-cache"
CCACHE_COMPILERCHECK: "content"
CCACHE_COMPRESSLEVEL: "1"
CCACHE_MAXSIZE: "250M"
CONAN_HOME: "${{ github.workspace }}/.conan2"
defaults:
run:
shell: bash
jobs:
cache-test-dataset:
uses: paulsengroup/hictk/.github/workflows/cache-test-dataset.yml@main
build-project:
needs: cache-test-dataset
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
- { compiler-name: msvc, os: 'windows-2022', conan-ver: '2.0.*', cmake-ver: '3.26.*', build_type: Debug, developer_mode: OFF }
- { compiler-name: msvc, os: 'windows-2022', conan-ver: '2.0.*', cmake-ver: '3.26.*', build_type: Release, developer_mode: OFF }
steps:
- uses: actions/checkout@v4
- name: Generate requirements.txt for pip
run: |
echo 'conan==${{ matrix.conan-ver }}' > requirements.txt
echo 'cmake==${{ matrix.cmake-ver }}' >> requirements.txt
- uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
- name: Detect number available CPUs
run: |
ncpus=$(python -c 'import multiprocessing as mp; print(mp.cpu_count())')
echo "CMAKE_BUILD_PARALLEL_LEVEL=$ncpus" >> $GITHUB_ENV
echo "CTEST_PARALLEL_LEVEL=$ncpus" >> $GITHUB_ENV
- name: Install deps
run: |
pip install -r requirements.txt
choco install ccache
- name: Generate cache key
id: cache-key
run: |
set -u
os="${{ matrix.os }}"
compiler="${{ matrix.compiler-name }}"
build_type="${{ matrix.build_type }}"
conanfile_hash="${{ hashFiles('conanfile.txt') }}"
workflow_hash="${{ hashFiles('.github/workflows/windows-ci.yml') }}"
combined_hash="${{ hashFiles('conanfile.txt', '.github/workflows/windows-ci.yml') }}"
# This can be used by to always update a cache entry (useful e.g. for ccache)
current_date="$(date '+%s')"
conan_key_prefix="conan-$os-$compiler-$conanfile_hash-$build_type"
ccache_key_prefix="ccache-$os-$compiler-$conanfile_hash-$build_type"
echo "conan-key=$conan_key_prefix" | tee -a $GITHUB_OUTPUT
echo "conan-restore-key=$conan_key_prefix" | tee -a $GITHUB_OUTPUT
echo "ccache-key=${ccache_key_prefix}-${current_date}" | tee -a $GITHUB_OUTPUT
echo "ccache-restore-key=$ccache_key_prefix" | tee -a $GITHUB_OUTPUT
- name: Restore Conan cache
id: cache-conan
uses: actions/cache/restore@v3
with:
key: conan-${{ steps.cache-key.outputs.conan-restore-key }}
path: ${{ env.CONAN_HOME }}
- name: Configure Conan
if: steps.cache-conan.outputs.cache-hit != 'true'
run: |
conan profile detect --force
- name: Clean Conan cache (pre-build)
if: steps.cache-conan.outputs.cache-hit != 'true'
run: |
conan cache clean "*" --build
conan cache clean "*" --download
conan cache clean "*" --source
conan remove --confirm "*"
- name: Install build dependencies
run: |
conan install . \
--build=missing \
-pr:h default \
-pr:b default \
-s "compiler=${{ matrix.compiler-name }}" \
-s "build_type=${{ matrix.build_type }}" \
-s "compiler.runtime_type=${{ matrix.build_type }}" \
-s compiler.cppstd=17 \
--output-folder=build
- name: Clean Conan cache (post-build)
if: steps.cache-conan.outputs.cache-hit != 'true'
run: |
conan cache clean "*" --build
conan cache clean "*" --download
conan cache clean "*" --source
- name: Save Conan cache
uses: actions/cache/save@v3
if: steps.cache-conan.outputs.cache-hit != 'true'
with:
key: conan-${{ steps.cache-key.outputs.conan-key }}
path: ${{ env.CONAN_HOME }}
- name: Cache Ccache folder
uses: actions/cache@v3
with:
key: ${{ steps.cache-key.outputs.ccache-key }}
restore-keys: ${{ steps.cache-key.outputs.ccache-restore-key }}
path: ${{ env.CCACHE_DIR }}
- name: Configure project
run: |
cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCMAKE_PREFIX_PATH="${{ github.workspace }}/build" \
-DENABLE_DEVELOPER_MODE=${{ matrix.developer_mode }} \
-DHICTK_ENABLE_TESTING=ON \
-DHICTK_BUILD_EXAMPLES=ON \
-DHICTK_DOWNLOAD_TEST_DATASET=OFF \
-DHICTK_ENABLE_GIT_VERSION_TRACKING=OFF \
-DOPT_ENABLE_CLANG_TIDY=OFF \
-DOPT_ENABLE_CPPCHECK=OFF \
-S . \
-B build
- name: Build project
run: cmake --build build --config ${{ matrix.build_type }}
- name: Print Ccache statistics
run: ccache -s
- name: Restore test dataset
uses: actions/cache/restore@v3
with:
key: ${{ needs.cache-test-dataset.outputs.cache-key }}
path: test/data/hictk_test_data.tar.xz
fail-on-cache-miss: true
enableCrossOsArchive: true
- name: Extract test dataset
run: tar -xf test/data/hictk_test_data.tar.xz
- name: Run unit tests
run: |
ctest --test-dir build \
--schedule-random \
--output-on-failure \
--no-tests=error \
--timeout 180 \
--exclude-regex 'Cooler: dataset large read\/write.*' |&
tail -n 1000
windows-ci-status-check:
name: Status Check (Windows CI)
if: ${{ always() }}
runs-on: ubuntu-latest
needs:
- build-project
steps:
- name: Collect job results
if: needs.build-project.result != 'success'
run: exit 1