forked from DCMTK/dcmtk
-
Notifications
You must be signed in to change notification settings - Fork 0
123 lines (102 loc) · 5 KB
/
cmake-win.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
name: C/C++ CI Windows
on:
push:
branches: [ "master", "github_actions" ]
pull_request:
branches: [ "master", "github_actions" ]
workflow_dispatch:
jobs:
build-windows:
runs-on: windows-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
with:
fetch-tags: true
- uses: microsoft/[email protected]
with:
vs-version: '17'
msbuild-architecture: x64
- uses: actions/setup-python@v4
with:
python-version: '3.8.0'
# - name: Download prerequisite packages
# run: |
# $client = new-object System.Net.WebClient;
# $client.DownloadFile("https://github.com/QIICR/dicom3tools/releases/download/20200512090031/dicom3tools_winexe_1.00.snapshot.20200512090031.zip", "c:\dicom3tools.zip")
# $client.DownloadFile("https://github.com/QIICR/zlib-dcmqi/releases/download/zlib-dcmqi-1.2.3-VS17-Win64-Release-static/zlib-dcmqi.zip", "c:\zlib-dcmqi.zip")
# $client.DownloadFile("https://github.com/QIICR/dcmtk-dcmqi/releases/download/DCMTK-dcmqi-3.6.7_20220105-VS12-Win64-Release-v0.0.32-static/DCMTK-dcmqi.zip", "c:\DCMTK-dcmqi.zip")
# $client.DownloadFile("https://github.com/QIICR/ITK-dcmqi/releases/download/ITK-dcmqi-VS17-Win64-Release-v0.0.40-static/ITK-dcmqi.zip", "c:\ITK-dcmqi.zip")
# shell: pwsh
# - name: Uncompress prerequisite packages
# run: |
# 7z x c:\dicom3tools.zip -oc:\dicom3tools
# 7z x c:\zlib-dcmqi.zip -oc:\zlib-install
# 7z x c:\DCMTK-dcmqi.zip -oc:\DCMTK-install
# 7z x c:\ITK-dcmqi.zip -oc:\ITK-install
# - name: Install prerequisite python packages
# run: |
# pip install jsondiff
- name: Prepare environment
run: |
$NOW=& Get-Date -format yyyy-MM-dd
echo "NOW=$NOW" >> $env:GITHUB_ENV
$git_hash=$(git.exe rev-parse --short ${{ github.sha }})
echo "COMMIT_SHORT_SHA=$git_hash" >> $env:GITHUB_ENV
- name: Configure project
run: |
ls ${{ github.workspace }}
echo "WORKSPACE dir: ${{ github.workspace }}"
cmake --version
mkdir ${{ github.workspace }}\dcmtk-build
echo "Step 2"
cd ${{ github.workspace }}\dcmtk-build
echo "Step 3"
cmake -G "Visual Studio 17 2022" -Ax64 -DDCMTK_MODULES:STR="ofstd;oflog;oficonv;dcmdata" -DDCMTK_ENABLE_BUILTIN_OFICONV_DATA:BOOL=On -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_INSTALL_PREFIX:PATH=${{ github.workspace }}\dcmtk-${{ env.NOW }}-${{ env.COMMIT_SHORT_SHA }} ${{ github.workspace }}
- name: Build dcmtk
run: |
cd ${{ github.workspace }}\dcmtk-build/
cmake --build . --config Release -- /m
- name: Test dcmtk
run: |
cd ${{ github.workspace }}\dcmtk-build
ctest -VV -C Release --no-compress-output
- name: Install dcmtk
run: |
cd ${{ github.workspace }}\dcmtk-build
cmake --build . --config Release --target INSTALL -- /m
Compress-Archive -Path ${{ github.workspace }}\dcmtk-${{ env.NOW }}-${{ env.COMMIT_SHORT_SHA }} -Destination ${{ github.workspace }}\dcmtk-${{ env.NOW }}-${{ env.COMMIT_SHORT_SHA }}\dcmtk-${{ env.NOW }}-${{ env.COMMIT_SHORT_SHA }}-win64.zip
echo "Listing install dir: ${{ github.workspace }}\dcmtk-${{ env.NOW }}-${{ env.COMMIT_SHORT_SHA }}"
ls ${{ github.workspace }}\dcmtk-${{ env.NOW }}-${{ env.COMMIT_SHORT_SHA }}
- uses: actions/upload-artifact@v3
with:
name: dcmtk-install-zip-package
path: ${{ github.workspace }}\dcmtk-${{ env.NOW }}-${{ env.COMMIT_SHORT_SHA }}\dcmtk-*-win64.zip
publish-windows:
runs-on: windows-latest
timeout-minutes: 5
# Only run if the event is not a pull request and the repository owner is michaelonken.
# The latter is to prevent forks from publishing packages even if the owner's token
# would have sufficient privileges.
if: ${{ (github.event_name != 'pull_request') && (github.repository_owner == 'michaelonken')}}
needs: build-windows
steps:
- uses: actions/checkout@v3
with:
fetch-tags: true
- uses: actions/download-artifact@v3
with:
name: dcmtk-install-zip-package
path: ${{ github.workspace }}\dcmtk-install
- name: Publish package
run: |
echo "Listing install dir: ${{ github.workspace }}\dcmtk-install"
ls ${{ github.workspace }}\dcmtk-install
pip install -U "scikit-ci-addons>=0.22.0"
ci_addons publish_github_release michaelonken/dcmtk `
--exit-success-if-missing-token `
--release-packages "${{ github.workspace }}\dcmtk-install\dcmtk-*-win64.zip" `
--prerelease-packages "${{ github.workspace }}\dcmtk-install\dcmtk-*-win64.zip" `
--prerelease-packages-clear-pattern "dcmtk-*-win64.zip" `
--prerelease-packages-keep-pattern "*<COMMIT_SHORT_SHA>*" `
--token ${{ secrets.PUBLISH_RELEASE_TOKEN }}