forked from mne-tools/mne-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
165 lines (157 loc) · 6.9 KB
/
release-windows.yml
File metadata and controls
165 lines (157 loc) · 6.9 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: Release Windows
on:
workflow_call:
jobs:
WinDynamic:
runs-on: windows-2025
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Determine release info
id: release-info
shell: bash
run: |
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
echo "prefix=mne-cpp-${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
echo "should_upload=true" >> "$GITHUB_OUTPUT"
elif [[ "$GITHUB_REF" == "refs/heads/main" ]]; then
echo "tag=latest" >> "$GITHUB_OUTPUT"
echo "prefix=mne-cpp-latest" >> "$GITHUB_OUTPUT"
echo "should_upload=true" >> "$GITHUB_OUTPUT"
elif [[ "$GITHUB_REF" == "refs/heads/staging" ]]; then
echo "tag=dev_build" >> "$GITHUB_OUTPUT"
echo "prefix=mne-cpp-dev" >> "$GITHUB_OUTPUT"
echo "should_upload=true" >> "$GITHUB_OUTPUT"
else
echo "tag=none" >> "$GITHUB_OUTPUT"
echo "prefix=mne-cpp-local" >> "$GITHUB_OUTPUT"
echo "should_upload=false" >> "$GITHUB_OUTPUT"
fi
- name: Install Python 3.10 version
uses: actions/setup-python@v5
with:
python-version: '3.10'
architecture: 'x64'
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: 6.10.2
arch: win64_msvc2022_64
modules: qtshadertools
- name: Configure and compile MNE-CPP
run: |
cmd.exe /c "call `"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat`" && set > %temp%\vcvars.txt"
Get-Content "$env:temp\vcvars.txt" | Foreach-Object { if ($_ -match "^(.*?)=(.*)$") { Set-Content "env:\$($matches[1])" $matches[2] } }
./tools/build_project.bat
- name: Deploy binaries (Windows)
run: |
echo "Qt environment:"
echo " QT_ROOT_DIR=$env:QT_ROOT_DIR"
echo " Qt6_DIR=$env:Qt6_DIR"
Get-Command windeployqt -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Source
./tools/deploy.bat dynamic pack
# Verify archive size
$archive = Get-Item mne-cpp-windows-dynamic-x86_64.zip -ErrorAction SilentlyContinue
if ($archive) {
$sizeMB = [math]::Round($archive.Length / 1MB)
echo "Archive size: ${sizeMB} MB"
if ($sizeMB -lt 30) {
echo "ERROR: Archive is too small (${sizeMB} MB). Qt DLLs likely missing."
echo "Listing archive contents..."
7z l mne-cpp-windows-dynamic-x86_64.zip | Select-String "Qt6" | Select-Object -First 10
exit 1
}
} else {
echo "ERROR: Archive file not found!"
exit 1
}
- name: Upload release binaries
if: steps.release-info.outputs.should_upload == 'true'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GH_PAT || secrets.GITHUB_TOKEN }}
file: mne-cpp-windows-dynamic-x86_64.zip
asset_name: ${{ steps.release-info.outputs.prefix }}-windows-dynamic-x86_64.zip
tag: ${{ steps.release-info.outputs.tag }}
overwrite: true
WinStatic:
runs-on: windows-2025
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Determine release info
id: release-info
shell: bash
run: |
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
echo "prefix=mne-cpp-${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
echo "should_upload=true" >> "$GITHUB_OUTPUT"
elif [[ "$GITHUB_REF" == "refs/heads/main" ]]; then
echo "tag=latest" >> "$GITHUB_OUTPUT"
echo "prefix=mne-cpp-latest" >> "$GITHUB_OUTPUT"
echo "should_upload=true" >> "$GITHUB_OUTPUT"
elif [[ "$GITHUB_REF" == "refs/heads/staging" ]]; then
echo "tag=dev_build" >> "$GITHUB_OUTPUT"
echo "prefix=mne-cpp-dev" >> "$GITHUB_OUTPUT"
echo "should_upload=true" >> "$GITHUB_OUTPUT"
else
echo "tag=none" >> "$GITHUB_OUTPUT"
echo "prefix=mne-cpp-local" >> "$GITHUB_OUTPUT"
echo "should_upload=false" >> "$GITHUB_OUTPUT"
fi
- name: Install Python 3.10 version
uses: actions/setup-python@v5
with:
python-version: '3.10'
architecture: 'x64'
- name: Install ninja
run: |
choco install ninja
- name: Cache static Qt binaries
id: cache-qt-static
uses: actions/cache@v4
with:
path: ..\Qt6_static
key: qt-6.10.2-static-windows-x86_64
- name: Download pre-built static Qt
id: download-qt-static
if: steps.cache-qt-static.outputs.cache-hit != 'true'
continue-on-error: true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release download qt_binaries -p "qt6_6102_static_binaries_win.zip" -D $env:TEMP
mkdir ..\Qt6_static -Force
7z x "$env:TEMP\qt6_6102_static_binaries_win.zip" -o"..\Qt6_static" -y
- name: Build static Qt from source
if: steps.cache-qt-static.outputs.cache-hit != 'true' && steps.download-qt-static.outcome != 'success'
run: |
cd ..
git clone https://code.qt.io/qt/qt5.git -b v6.10.2
mkdir qt6_shadow
cd qt6_shadow
cmd.exe /c "call `"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat`" && set > %temp%\vcvars.txt"
Get-Content "$env:temp\vcvars.txt" | Foreach-Object { if ($_ -match "^(.*?)=(.*)$") { Set-Content "env:\$($matches[1])" $matches[2] } }
..\qt5\configure.bat -release -static -no-pch -optimize-size -opengl desktop -platform win32-msvc -prefix "$env:GITHUB_WORKSPACE\..\Qt6_static" -skip webengine -nomake tools -nomake tests -nomake examples -opensource -confirm-license -init-submodules -submodules qtbase,qtsvg,qtshadertools
cmake --build . --parallel $env:NUMBER_OF_PROCESSORS
cmake --install .
- name: Configure and compile MNE-CPP (static)
run: |
cmd.exe /c "call `"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat`" && set > %temp%\vcvars.txt"
Get-Content "$env:temp\vcvars.txt" | Foreach-Object { if ($_ -match "^(.*?)=(.*)$") { Set-Content "env:\$($matches[1])" $matches[2] } }
$env:CMAKE_PREFIX_PATH = "$env:GITHUB_WORKSPACE\..\Qt6_static"
./tools/build_project.bat static
- name: Deploy binaries (Windows)
run: |
./tools/deploy.bat static pack
- name: Upload release binaries
if: steps.release-info.outputs.should_upload == 'true'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GH_PAT || secrets.GITHUB_TOKEN }}
file: mne-cpp-windows-static-x86_64.zip
asset_name: ${{ steps.release-info.outputs.prefix }}-windows-static-x86_64.zip
tag: ${{ steps.release-info.outputs.tag }}
overwrite: true