-
Notifications
You must be signed in to change notification settings - Fork 2
176 lines (156 loc) · 5.84 KB
/
build.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
name: build-qt5-vtk
on:
push:
paths-ignore:
- '*.md'
- 'rtd/**'
pull_request:
branches:
- 'main'
- 'develop'
workflow_dispatch:
env:
AQT_TARGET: desktop
AQT_VER: 5.15.2
VTK_VER: 9.1.0
# ${{ env.RUNNER_WORKSPACE }} doesn't seem to work on linux and macos
# but ${RUNNER_WORKSPACE} is set in the environment for all os
# therefore use ${{ runner.workspace }} instead of ${{ env.RUNNER_WORKSPACE }}
jobs:
init:
runs-on: ubuntu-latest
# Map step outputs to job outputs
outputs:
DATE_COMPILED: ${{ steps.vars.outputs.DATE_COMPILED }}
steps:
- name: Setup vars
id: vars
run: |
echo "DATE_COMPILED=$(date --rfc-3339=date) (compiled $(date "+%b %d %Y %H:%M:%S"))" >> $GITHUB_OUTPUT
build:
name: ${{ matrix.config.os }}
needs: [init]
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
os: macos-11,
aqt_host: mac,
aqt_arch: clang_64,
package_suffix: "dmg"
}
- {
os: macos-12,
aqt_host: mac,
aqt_arch: clang_64,
package_suffix: "dmg"
}
- {
os: ubuntu-20.04,
aqt_host: linux,
aqt_arch: gcc_64,
package_suffix: "gz"
}
- {
os: ubuntu-22.04,
aqt_host: linux,
aqt_arch: gcc_64,
package_suffix: "gz"
}
- {
os: windows-2019,
aqt_host: windows,
aqt_arch: win64_msvc2019_64,
package_suffix: "zip"
}
- {
os: windows-2022,
aqt_host: windows,
aqt_arch: win64_msvc2019_64,
package_suffix: "zip"
}
steps:
- uses: actions/checkout@v3
#
# Open 'PowerShell 7 for VS 2019 x64' in Windows Terminal
#
# see https://ddalcino.github.io/aqt-list-server/
# aqt install-qt mac desktop 5.15.2 clang_64 --dir ${HOME}/work/modelviewer-mf6/Qt
# aqt install-qt linux desktop 5.15.2 gcc_64 --dir ${HOME}/work/modelviewer-mf6/Qt
# aqt install-qt windows desktop 5.15.2 win64_msvc2019_64 --dir ${env:USERPROFILE}\work\modelviewer-mf6\Qt
#
- name: Install Qt (${{ env.AQT_VER }})
uses: jurplel/install-qt-action@v3
with:
version: ${{ env.AQT_VER }}
host: ${{ matrix.config.aqt_host }}
target: ${{ env.AQT_TARGET }}
arch: ${{ matrix.config.aqt_arch }}
dir: ${{ runner.workspace }}
cache: true
cache-key-prefix: install-qt-action
tools: tools_ninja
- name: Add ninja path
shell: bash
run: |
echo "${IQTA_TOOLS}/Ninja" >> $GITHUB_PATH
- name: Download (qt5-vtk-${{ env.VTK_VER }}-${{ matrix.config.os }}.7z)
uses: robinraju/[email protected]
id: download
with:
repository: "MODFLOW-USGS/modelviewer-mf6-build-deps"
latest: true
# releaseId: "90254461" # 2023-01-26T02.03.20Z
fileName: "qt5-vtk-${{ env.VTK_VER }}-${{ matrix.config.os }}.7z"
- name: "Extract (Tag: ${{ steps.download.outputs.tag_name }})"
shell: bash
working-directory: ${{ runner.workspace }}
run: |
echo ${{ steps.download.outputs.tag_name }}
7z x "${{ github.workspace }}/qt5-vtk-${{ env.VTK_VER }}-${{ matrix.config.os }}.7z"
rm "${{ github.workspace }}/qt5-vtk-${{ env.VTK_VER }}-${{ matrix.config.os }}.7z"
- name: Set env vars
shell: bash
run: |
echo "MV_SHORT_SHA1=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "MV_DATE_COMPILED=${{ needs.init.outputs.DATE_COMPILED }}" >> $GITHUB_ENV
# the shell needs to be set to use ninja on windows
- name: Set up Visual Studio shell
if: runner.os == 'Windows'
uses: egor-tensin/vs-shell@v2
with:
arch: x64
- name: "Configure modelviewer-mf6 for release"
if: ${{ github.ref_name == 'main' }}
env:
VTK_DIR: ${{ runner.workspace }}/qt5-vtk-${{ env.VTK_VER }}/lib/cmake
run: cmake -S . -B ./_ninja_multi -G "Ninja Multi-Config" -DMV_SHORT_SHA1="${{ env.MV_SHORT_SHA1 }}" -DMV_DATE_COMPILED="${{ env.MV_DATE_COMPILED }}"
- name: "Configure modelviewer-mf6 for prerelease"
if: ${{ github.ref_name != 'main' }}
env:
VTK_DIR: ${{ runner.workspace }}/qt5-vtk-${{ env.VTK_VER }}/lib/cmake
MV_VERSION_PRERELEASE: -prerelease.${{ github.run_number }}
run: cmake -S . -B ./_ninja_multi -G "Ninja Multi-Config" -DMV_SHORT_SHA1="${{ env.MV_SHORT_SHA1 }}" -DMV_DATE_COMPILED="${{ env.MV_DATE_COMPILED }}" -DMV_VERSION_PRERELEASE="${{ env.MV_VERSION_PRERELEASE }}"
- name: "Build modelviewer-mf6 debug with cmake"
run: cmake --build ./_ninja_multi --config Debug
- name: "Build modelviewer-mf6 release with cmake"
run: cmake --build ./_ninja_multi --config Release
- name: "Package modelviewer-mf6 release with cpack"
if: runner.os != 'Windows'
working-directory: ./_ninja_multi
run: cpack --verbose
- name: "Package modelviewer-mf6 release with cpack (Windows)"
if: runner.os == 'Windows'
working-directory: ./_ninja_multi
run: |
Write-Output 'Prepend $env:SystemRoot\System32 to the path so that fixup_bundle finds the right dbghelp.dll'
Write-Output 'see https://github.com/MODFLOW-USGS/modelviewer-mf6/issues/81'
$env:PATH="$env:SystemRoot\System32;$env:PATH"
cpack --verbose
- name: "Upload package"
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.config.os }}-artifact
path: ${{ github.workspace }}/_ninja_multi/*.${{ matrix.config.package_suffix }}