Skip to content

Commit 28677d5

Browse files
authored
win ci: reduce usage (#5012)
* use json config files for win ci * test update * test * run ci * upd config * allow to build win release by tag * codereview * upd bulid token * fix * minimize * fix * fix win 19 usage * comment, general fixes * fix * return inputs.upload_artifacts flag * Update config comment Signed-off-by: Max Raiskii <max.raiskii@meshinspector.com> --------- Signed-off-by: Max Raiskii <max.raiskii@meshinspector.com>
1 parent 13ab22b commit 28677d5

9 files changed

+386
-108
lines changed

.github/workflows/build-test-distribute.yml

Lines changed: 6 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,11 @@ jobs:
6262
needs: [ config, prepare-image ]
6363
uses: ./.github/workflows/build-test-windows.yml
6464
with:
65+
config_matrix: ${{ needs.config.outputs.windows_x64_config_matrix }}
6566
full_config_build: ${{ needs.config.outputs.full_config_build == 'true' }}
6667
internal_build: ${{ needs.config.outputs.internal_build == 'true' }}
67-
upload_artifacts: ${{ needs.config.outputs.upload_artifacts == 'true' }}
68+
upload_artifacts: ${{ needs.config.outputs.upload_artifacts == 'true' || needs.config.outputs.tag-build-release-windows == 'true' }}
6869
upload_test_artifacts: ${{ needs.config.outputs.upload_test_artifacts == 'true' }}
69-
vs19_vcpkg_version: ${{ needs.config.outputs.vs19_vcpkg_version }}
70-
vs22_vcpkg_version: ${{ needs.config.outputs.vs22_vcpkg_version }}
7170
nuget_build: ${{ needs.config.outputs.build_enable_ubuntu_x64 == 'true' && needs.config.outputs.upload_artifacts == 'true' }}
7271
secrets: inherit
7372

@@ -138,66 +137,11 @@ jobs:
138137
needs:
139138
- config
140139
- windows-build-test
141-
timeout-minutes: 60
142-
runs-on: [self-hosted, windows, x64, vs-2019, vcpkg-2024.10.21, meshinspector]
143-
env:
140+
uses: ./.github/workflows/update-win-version.yml
141+
with:
144142
vs19_vcpkg_version: ${{ needs.config.outputs.vs19_vcpkg_version }}
145-
steps:
146-
- name: Checkout
147-
uses: actions/checkout@v5
148-
with:
149-
submodules: true
150-
151-
- name: Checkout Vcpkg ${{env.vs19_vcpkg_version}}
152-
working-directory: C:\vcpkg
153-
run: |
154-
git fetch
155-
git checkout ${{env.vs19_vcpkg_version}}
156-
157-
- name: Restore Vcpkg Cache
158-
uses: actions/cache@v4
159-
id: vcpkg-cache
160-
with:
161-
key: vcpkg-cache-${{env.vs19_vcpkg_version}}
162-
path: |
163-
C:\vcpkg\*
164-
165-
- name: Update vcpkg packages
166-
run: |
167-
.\thirdparty\install.bat
168-
169-
- name: Download Windows Binaries Archive
170-
uses: actions/download-artifact@v5
171-
with:
172-
pattern: WindowsArchive*
173-
merge-multiple: true
174-
175-
- name: Extract Windows Binaries
176-
run: |
177-
tar -xvzf MREDist_Release.zip
178-
tar -xvzf MREDist_Debug.zip
179-
tar -xvzf MeshLibC2Headers.zip
180-
181-
- name: Make Install Folder
182-
run: py -3.10 scripts\make_install_folder.py ${{ needs.config.outputs.app_version }}
183-
184-
- name: Add msbuild to PATH
185-
uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2
186-
187-
- name: Archive Distribution
188-
run: py -3.10 scripts\zip_distribution.py install example_plugin MeshLibDist.zip
189-
190-
- name: Test Example Plugin # call it after archive not to pack build results
191-
run: |
192-
msbuild -m example_plugin\example_plugin.sln -p:Configuration=Debug
193-
msbuild -m example_plugin\example_plugin.sln -p:Configuration=Release
194-
195-
- name: Upload Windows Distribution
196-
uses: actions/upload-artifact@v4
197-
with:
198-
name: DistributivesWin
199-
path: MeshLibDist.zip
200-
retention-days: 1
143+
app_version: ${{ needs.config.outputs.app_version }}
144+
secrets: inherit
201145

202146
create-nuget-package:
203147
if: ${{ needs.config.outputs.upload_artifacts == 'true' && needs.config.outputs.build_enable_windows == 'true' && needs.config.outputs.build_enable_ubuntu_x64 == 'true'}}

.github/workflows/build-test-windows.yml

Lines changed: 4 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name: Build and test Windows
33
on:
44
workflow_call:
55
inputs:
6+
config_matrix:
7+
required: true
8+
type: string
69
full_config_build:
710
default: false
811
required: false
@@ -16,12 +19,6 @@ on:
1619
upload_test_artifacts:
1720
required: true
1821
type: boolean
19-
vs19_vcpkg_version:
20-
required: true
21-
type: string
22-
vs22_vcpkg_version:
23-
required: true
24-
type: string
2522
mrbind:
2623
default: true
2724
required: false
@@ -41,39 +38,7 @@ jobs:
4138
runs-on: ${{ matrix.runner }}
4239
strategy:
4340
fail-fast: false
44-
matrix:
45-
config: [ "Debug", "Release" ]
46-
build_system: [ MSBuild, CMake ]
47-
os: [ windows-2022, windows-2019 ]
48-
full_config_build:
49-
- ${{fromJSON(inputs.full_config_build)}}
50-
exclude:
51-
- full_config_build: false
52-
os: windows-2022
53-
build_system: CMake
54-
config: "Debug"
55-
- full_config_build: false
56-
os: windows-2019
57-
build_system: MSBuild
58-
- full_config_build: false
59-
os: windows-2022
60-
build_system: MSBuild
61-
config: "Debug"
62-
include:
63-
- os: windows-2022
64-
runner: [windows-2022]
65-
vc-path: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise'
66-
CUDA-VERSION: '12.0.1.52833'
67-
CUDA-MAJOR: '12'
68-
CUDA-MINOR: '0'
69-
vcpkg-version: ${{ inputs.vs22_vcpkg_version }}
70-
- os: windows-2019
71-
runner: [self-hosted, windows, x64, vs-2019, meshinspector]
72-
vc-path: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community'
73-
CUDA-VERSION: '11.4.2.47141'
74-
CUDA-MAJOR: '11'
75-
CUDA-MINOR: '4'
76-
vcpkg-version: ${{ inputs.vs19_vcpkg_version }}
41+
matrix: ${{ fromJSON( inputs.config_matrix ) }}
7742
permissions:
7843
id-token: write # This is required for requesting the JWT
7944
contents: read # This is required for actions/checkout

.github/workflows/config.yml

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ on:
3838
ubuntu_x64_config_matrix:
3939
description: "Config matrix for Ubuntu x64 builds"
4040
value: ${{ jobs.prepare-config.outputs.ubuntu_x64_config_matrix }}
41+
windows_x64_config_matrix:
42+
description: "Config matrix for Windows builds"
43+
value: ${{ jobs.prepare-config.outputs.windows_x64_config_matrix }}
4144
update_doc:
4245
description:
4346
value: ${{ jobs.prepare-config.outputs.tag-update-doc == 'true' || jobs.prepare-config.outputs.tag-update-doc-only == 'true' }}
@@ -85,6 +88,7 @@ jobs:
8588
linux-changes: ${{ steps.linux-changes.outputs.src }}
8689
linux-vcpkg-changes: ${{ steps.linux-vcpkg-changes.outputs.src }}
8790
ubuntu_x64_config_matrix: ${{ steps.set-ubuntu-x64-matrix.outputs.matrix }}
91+
windows_x64_config_matrix: ${{ steps.set-windows-x64-matrix.outputs.matrix }}
8892
vcpkg-docker-image-tag: ${{ steps.select-vcpkg-docker-image-tag.outputs.image_tag }}
8993
windows-changes: ${{ steps.windows-changes.outputs.src }}
9094
# please list the required tags here
@@ -97,12 +101,13 @@ jobs:
97101
tag-upload-test-artifacts: ${{ contains( github.event.pull_request.labels.*.name, 'upload-test-artifacts' ) }}
98102
tag-test-pip-build: ${{ contains( github.event.pull_request.labels.*.name, 'test-pip-build' ) }}
99103
# tags for disabling builds for different systems
104+
tag-build-release-windows: ${{ contains( github.event.pull_request.labels.*.name, 'build-release-windows' ) }}
100105
tag-disable-windows: ${{ contains( github.event.pull_request.labels.*.name, 'disable-build-windows' ) }}
101-
tag-disable-ubuntu-x64: ${{ contains( github.event.pull_request.labels.*.name, 'disable-build-ubuntu-x64' ) }}
102-
tag-disable-ubuntu-arm64: ${{ contains( github.event.pull_request.labels.*.name, 'disable-build-ubuntu-arm64' ) }}
103-
tag-disable-linux-vcpkg: ${{ contains( github.event.pull_request.labels.*.name, 'disable-build-linux-vcpkg' ) }}
104-
tag-disable-macos: ${{ contains( github.event.pull_request.labels.*.name, 'disable-build-macos' ) }}
105-
tag-disable-emscripten: ${{ contains( github.event.pull_request.labels.*.name, 'disable-build-emscripten' ) }}
106+
tag-disable-ubuntu-x64: ${{ contains( github.event.pull_request.labels.*.name, 'disable-build-ubuntu-x64' ) }}
107+
tag-disable-ubuntu-arm64: ${{ contains( github.event.pull_request.labels.*.name, 'disable-build-ubuntu-arm64' ) }}
108+
tag-disable-linux-vcpkg: ${{ contains( github.event.pull_request.labels.*.name, 'disable-build-linux-vcpkg' ) }}
109+
tag-disable-macos: ${{ contains( github.event.pull_request.labels.*.name, 'disable-build-macos' ) }}
110+
tag-disable-emscripten: ${{ contains( github.event.pull_request.labels.*.name, 'disable-build-emscripten' ) }}
106111

107112
runs-on: aws-micro
108113

@@ -207,11 +212,31 @@ jobs:
207212
echo "release_tag=${version}" >> $GITHUB_OUTPUT
208213
echo "app_version=${version%%-*}" >> $GITHUB_OUTPUT
209214
210-
- name: Set matrix for ubuntu-arm64 builds
215+
- name: Set matrix for ubuntu-x64 builds
211216
id: set-ubuntu-x64-matrix
212217
run: |
213218
if [[ "${{ env.full_config_build }}" == "true" ]]; then
214219
echo "matrix=$(jq -c . < .github/workflows/matrix/ubuntu-x64-full-config.json)" >> $GITHUB_OUTPUT
215220
else
216221
echo "matrix=$(jq -c . < .github/workflows/matrix/ubuntu-x64-minimal-config.json)" >> $GITHUB_OUTPUT
217222
fi
223+
224+
- name: Set matrix for windows-x64 builds
225+
id: set-windows-x64-matrix
226+
run: |
227+
if [[ "${{ env.full_config_build }}" == "true" || github.event_name == 'schedule' ]]; then
228+
MATRIX_FILE=".github/workflows/matrix/windows-full-config.json"
229+
elif [[ "${{ contains(github.event.pull_request.labels.*.name, 'build-release-windows') }}" == "true" ]]; then
230+
MATRIX_FILE=".github/workflows/matrix/windows-standard-config.json"
231+
else
232+
MATRIX_FILE=".github/workflows/matrix/windows-minimal-config.json"
233+
fi
234+
235+
jq \
236+
--arg vs19 "2024.10.21" \
237+
--arg vs22 "2025.04.09" \
238+
'(.include[] | select(.["vcpkg-version"]=="__VCPKG_VERSION_VS19__") | .["vcpkg-version"]) = $vs19
239+
| (.include[] | select(.["vcpkg-version"]=="__VCPKG_VERSION_VS22__") | .["vcpkg-version"]) = $vs22' \
240+
"$MATRIX_FILE" > tmp.json
241+
242+
echo "matrix=$(jq -c . tmp.json)" >> $GITHUB_OUTPUT

.github/workflows/distro-release.yml

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
echo "release_tag=$TAG" >> $GITHUB_OUTPUT
3434
3535
# Minimal matrix: Release only
36-
MATRIX_FILE=".github/workflows/matrix/windows-release-config.json"
36+
MATRIX_FILE=".github/workflows/matrix/windows-finalize-release-config.json"
3737
MATRIX=$(jq -c . < "$MATRIX_FILE")
3838
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
3939
@@ -45,3 +45,77 @@ jobs:
4545
"$MATRIX_FILE" > tmp.json
4646
4747
echo "matrix=$(jq -c . tmp.json)" >> $GITHUB_OUTPUT
48+
49+
windows-build-test:
50+
needs: [ config ]
51+
uses: ./.github/workflows/build-test-windows.yml
52+
with:
53+
config_matrix: ${{ needs.config.outputs.windows_x64_config_matrix }}
54+
full_config_build: ${{ needs.config.outputs.full_config_build == 'true' }}
55+
internal_build: ${{ needs.config.outputs.internal_build == 'true' }}
56+
upload_artifacts: "true"
57+
upload_test_artifacts: ${{ needs.config.outputs.upload_test_artifacts == 'true' }}
58+
nuget_build: ${{ needs.config.outputs.nuget_build == 'true' }}
59+
secrets: inherit
60+
61+
update-win-version:
62+
needs:
63+
- config
64+
- windows-build-test
65+
uses: ./.github/workflows/update-win-version.yml
66+
with:
67+
vs19_vcpkg_version: ${{ needs.config.outputs.vs19_vcpkg_version }}
68+
app_version: ${{ needs.config.outputs.app_version }}
69+
secrets: inherit
70+
71+
upload-distributions:
72+
if: ${{ !cancelled() }}
73+
timeout-minutes: 10
74+
runs-on: ubuntu-latest
75+
needs:
76+
- config
77+
- update-win-version
78+
steps:
79+
- name: Checkout
80+
uses: actions/checkout@v5
81+
82+
- name: Download All Developer Distributives
83+
uses: actions/download-artifact@v5
84+
with:
85+
pattern: Distributives*
86+
merge-multiple: true
87+
88+
- name: Rename Distributives
89+
run: |
90+
shopt -s nullglob
91+
for PKG_FILE in MeshLibDist*.zip ; do
92+
mv "$PKG_FILE" "${PKG_FILE/Dist/Dist_${{ needs.config.outputs.app_version }}}"
93+
done
94+
95+
- name: Upload Distributives
96+
run: |
97+
shopt -s nullglob
98+
PKG_FILES="MeshLibDist*.zip meshlib_*.zip meshlib_*.tar.xz"
99+
if [ -n "$(echo $PKG_FILES)" ] ; then
100+
echo ${{ secrets.BUILD_MACHINE_TOKEN }} | gh auth login --with-token
101+
gh release upload ${{ needs.config.outputs.release_tag }} $PKG_FILES --clobber
102+
fi
103+
104+
update-artifacts:
105+
timeout-minutes: 15
106+
runs-on: aws-micro
107+
needs: upload-distributions
108+
if: always()
109+
steps:
110+
# all distribution
111+
- name: Delete All MeshInspector Distribution Files
112+
uses: geekyeggo/delete-artifact@f275313e70c08f6120db482d7a6b98377786765b # v5
113+
with:
114+
name: Distributives*
115+
failOnError: false
116+
117+
- name: Delete All MeshInspector Distribution Files
118+
uses: geekyeggo/delete-artifact@f275313e70c08f6120db482d7a6b98377786765b # v5
119+
with:
120+
name: WindowsArchive*
121+
failOnError: false
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"include": [
3+
{
4+
"os": "windows-2019",
5+
"runner": ["self-hosted", "windows", "x64", "vs-2019", "meshinspector"],
6+
"config": "Debug",
7+
"build_system": "CMake",
8+
"vc-path": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community",
9+
"CUDA-VERSION": "11.4.2.47141",
10+
"CUDA-MAJOR": "11",
11+
"CUDA-MINOR": "4",
12+
"vcpkg-version": "__VCPKG_VERSION_VS19__"
13+
},
14+
{
15+
"os": "windows-2019",
16+
"runner": ["self-hosted", "windows", "x64", "vs-2019", "meshinspector"],
17+
"config": "Release",
18+
"build_system": "CMake",
19+
"vc-path": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community",
20+
"CUDA-VERSION": "11.4.2.47141",
21+
"CUDA-MAJOR": "11",
22+
"CUDA-MINOR": "4",
23+
"vcpkg-version": "__VCPKG_VERSION_VS19__"
24+
}
25+
]
26+
}

0 commit comments

Comments
 (0)