-
Notifications
You must be signed in to change notification settings - Fork 65
145 lines (126 loc) · 4.94 KB
/
Copy pathcmake-win.yml
File metadata and controls
145 lines (126 loc) · 4.94 KB
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
name: CI Windows
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
release:
types: [ published ]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-windows:
runs-on: windows-2022
timeout-minutes: 360
permissions:
contents: write
actions: write
packages: write
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: microsoft/setup-msbuild@v3
with:
vs-version: '17'
msbuild-architecture: x64
- uses: actions/setup-python@v7
with:
python-version: '3.10.11'
- name: Install prerequisite python packages
run: |
pip install jsondiff
- name: Cache build dependencies
id: cache-build-deps
uses: actions/cache/restore@v6
with:
path: |
${{ github.workspace }}\b\DCMTK
${{ github.workspace }}\b\DCMTK-build
${{ github.workspace }}\b\DCMTK-install
${{ github.workspace }}\b\DCMTK-prefix
${{ github.workspace }}\b\ITK
${{ github.workspace }}\b\ITK-build
${{ github.workspace }}\b\ITK-install
${{ github.workspace }}\b\ITK-prefix
${{ github.workspace }}\b\zlib
${{ github.workspace }}\b\zlib-build
${{ github.workspace }}\b\zlib-install
${{ github.workspace }}\b\zlib-prefix
key: windows-deps-${{ hashFiles('CMakeExternals/*.cmake') }}
restore-keys: |
windows-deps-
- name: Configure project
run: |
ls ${{ github.workspace }}
echo "WORKSPACE dir: ${{ github.workspace }}"
cmake --version
if (-not (Test-Path "${{ github.workspace }}\b")) { mkdir -p "${{ github.workspace }}\b" }
echo "Step 2"
cd ${{ github.workspace }}\b
echo "Step 3"
cmake -G "Visual Studio 17 2022" -Ax64 -DBUILD_SHARED_LIBS:BOOL=OFF ${{ github.workspace }}
- name: Build dcmqi
run: |
cd ${{ github.workspace }}\b/
cmake --build . --config Release -- /m
- name: Test dcmqi
run: |
cd ${{ github.workspace }}\b\dcmqi-build
ctest -VV -C Release -D ExperimentalTest --no-compress-output
- name: Package dcmqi
run: |
cd ${{ github.workspace }}\b\dcmqi-build
cmake --build . --config Release --target PACKAGE -- /m
- name: "Upload package as artifact"
id: upload-artifact
uses: actions/upload-artifact@v7
continue-on-error: true
with:
name: dcmqi-build
path: ${{ github.workspace }}\b\dcmqi-build\dcmqi-*-win64*.zip
- name: "Upload package as artifact (retry)"
if: steps.upload-artifact.outcome == 'failure'
uses: actions/upload-artifact@v7
with:
name: dcmqi-build
path: ${{ github.workspace }}\b\dcmqi-build\dcmqi-*-win64*.zip
# Save cache even if a later step (test, package) failed, so deps don't need rebuilding next run
- name: Save build dependencies cache
if: always() && steps.cache-build-deps.outputs.cache-hit != 'true'
uses: actions/cache/save@v6
with:
path: |
${{ github.workspace }}\b\DCMTK
${{ github.workspace }}\b\DCMTK-build
${{ github.workspace }}\b\DCMTK-install
${{ github.workspace }}\b\DCMTK-prefix
${{ github.workspace }}\b\ITK
${{ github.workspace }}\b\ITK-build
${{ github.workspace }}\b\ITK-install
${{ github.workspace }}\b\ITK-prefix
${{ github.workspace }}\b\zlib
${{ github.workspace }}\b\zlib-build
${{ github.workspace }}\b\zlib-install
${{ github.workspace }}\b\zlib-prefix
key: ${{ steps.cache-build-deps.outputs.cache-primary-key }}
- name: Publish package
# Publish tagged (stable) releases only, inline like the Linux/macOS builds, so
# there is no separate publish job that shows up "skipped" on every master push.
# The package built above is still on disk, so no artifact download is needed.
# The rolling "latest" prerelease is (re)created by the finalize-latest workflow
# once all platforms finish building. The repository-owner check prevents forks
# from publishing packages even if the owner's token would have sufficient privileges.
if: ${{ (github.event_name == 'release') && (github.repository_owner == 'QIICR') }}
shell: bash
env:
GH_TOKEN: ${{ secrets.GA_TOKEN }}
run: |
TAG=$(git describe --tags --exact-match 2>/dev/null || echo "")
if [ -n "$TAG" ] && [ "$TAG" != "latest" ]; then
gh release upload "$TAG" \
"${{ github.workspace }}/b/dcmqi-build"/dcmqi-*-win64.zip \
--clobber
fi