Skip to content

Commit 015f0d7

Browse files
committed
Add initial Windows workflow
1 parent 50ff07e commit 015f0d7

File tree

3 files changed

+133
-1
lines changed

3 files changed

+133
-1
lines changed

.ci/common/build.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ PLATFORM=$2
99
# 4: build failed
1010

1111
mkdir -p "$BUILD_DIR"
12-
cmake -B "$BUILD_DIR" -DCMAKE_BUILD_TYPE=Release -DSCRATCHCPP_PLAYER_BUILD_UNIT_TESTS=OFF || exit 3
12+
13+
if [[ "$PLATFORM" == "win64" ]] || [[ "$PLATFORM" == "win32" ]]; then
14+
cmake -B "$BUILD_DIR" -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DSCRATCHCPP_PLAYER_BUILD_UNIT_TESTS=OFF || exit 3
15+
else
16+
cmake -B "$BUILD_DIR" -DCMAKE_BUILD_TYPE=Release -DSCRATCHCPP_PLAYER_BUILD_UNIT_TESTS=OFF || exit 3
17+
fi
1318

1419
if [[ "$PLATFORM" == "win32" ]]; then
1520
cmake --build "$BUILD_DIR" -j4 || exit 4

.ci/windows_installer.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
### This script generates an installer and a Qt Installer Framework repository and uploads it
4+
git config --global user.name "GitHub Actions Bot"
5+
git config --global user.email "<>"
6+
7+
part1='/<Version>/c\\t<Version>'
8+
VERSION=${previous_tag//v}
9+
part2='<\/Version>'
10+
part3='/<ReleaseDate>/c\\t<ReleaseDate>'
11+
part4='<\/ReleaseDate>'
12+
sed -i -e "${part1}${VERSION}${part2}" config/config.xml
13+
sed -i -e "${part1}${VERSION}${part2}" packages/${windows_app_name}/meta/package.xml
14+
sed -i -e "${part3}$(date +'%Y-%m-%d')${part4}" packages/${windows_app_name}/meta/package.xml
15+
16+
if (( $update_windows_installer == 1 )); then
17+
git add config/config.xml
18+
git add packages/${windows_app_name}/meta/package.xml
19+
git diff --quiet HEAD || git commit -m "Release ${app_name} v${VERSION}"
20+
git push
21+
fi
22+
23+
mv ../release/* packages/${windows_app_name}/data/${app_name}
24+
curl -L https://aka.ms/vs/16/release/VC_redist.x64.exe > packages/com.microsoft.vcredist/data/VC_redist.x64.exe
25+
./build.sh $(echo ../Tools/QtInstallerFramework/*/bin/binarycreator.exe) $(echo ../Tools/QtInstallerFramework/*/bin/repogen.exe)
26+
27+
if (( $update_windows_repository == 1 )); then
28+
git push -f --set-upstream origin repository
29+
fi
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: Windows build
2+
3+
on:
4+
push:
5+
branches: '*'
6+
tags: '*'
7+
pull_request:
8+
branches: [ "master" ]
9+
10+
jobs:
11+
build:
12+
runs-on: windows-latest
13+
strategy:
14+
matrix:
15+
qt-version: ['6.6']
16+
qt-target: ['desktop']
17+
qt-modules: ['']
18+
mingw-version: ['11.2.0']
19+
steps:
20+
- uses: actions/checkout@v3
21+
with:
22+
fetch-depth: 0
23+
submodules: 'recursive'
24+
- name: Setup environment
25+
run: |
26+
sed -i -e '/^#/d' .github/config.env
27+
sed -i -e '/^$/d' .github/config.env
28+
cat .github/config.env >> "${GITHUB_ENV}"
29+
shell: bash
30+
- name: Get version
31+
run: |
32+
version=$(LC_ALL=en_US.utf8 grep -oP 'project\([^)]*\s+VERSION\s+\K[0-9]+\.[0-9]+\.[0-9]+' CMakeLists.txt)
33+
echo "Project version: $version"
34+
echo previous_tag=$version >> "${GITHUB_ENV}"
35+
shell: bash
36+
## Install Qt
37+
- name: Install Qt
38+
uses: jurplel/install-qt-action@v3
39+
with:
40+
version: ${{ matrix.qt-version }}
41+
host: 'windows'
42+
arch: 'win64_mingw'
43+
target: ${{ matrix.qt-target }}
44+
modules: ${{ matrix.qt-modules }}
45+
- name: Install Qt IFW
46+
run: |
47+
curl -o aqt.exe -L https://github.com/miurahr/aqtinstall/releases/download/v2.2.1/aqt.exe
48+
./aqt.exe install-tool windows desktop tools_ifw
49+
mv Tools ..
50+
echo ${pwd}/../Tools/QtInstallerFramework/*/bin >> "${GITHUB_PATH}"
51+
shell: bash
52+
- name: Install MinGW
53+
uses: egor-tensin/setup-mingw@v2
54+
with:
55+
platform: x64
56+
version: ${{ matrix.mingw-version }}
57+
## Build
58+
#- name: Build
59+
# run: .ci/windows_build.sh
60+
# shell: bash
61+
- name: Windows build
62+
run: .ci/common/build.sh win_build win64
63+
shell: bash
64+
- name: Copy files
65+
run: |
66+
mkdir win_release
67+
robocopy win_build release *.exe /S /MOV
68+
robocopy win_build release *.dll /S /MOV
69+
cd win_release
70+
windeployqt ${{ env.executable_name }}.exe --qmldir ..\win_build\src || exit 5
71+
for %%v in (*.dll) do windeployqt "%%v" || exit 5
72+
shell: cmd
73+
#- name: Finalize Windows build
74+
# run: .ci/windows_build.sh 1
75+
# shell: bash
76+
## Upload
77+
- name: Upload artifacts
78+
uses: actions/upload-artifact@v3
79+
with:
80+
name: build-Qt-${{ matrix.qt-version }}
81+
path: win_release/
82+
## Build installer
83+
#- if: env.create_windows_installer == 1
84+
# name: Disable repository update
85+
# run: |
86+
# echo "update_windows_installer=0" >> "${GITHUB_ENV}"
87+
# echo "update_windows_repository=0" >> "${GITHUB_ENV}"
88+
# shell: bash
89+
#- if: env.create_windows_installer == 1
90+
# name: Build installer
91+
# run: .ci/windows-repo.sh
92+
# shell: bash
93+
## Upload installer
94+
#- name: Upload installer
95+
# uses: actions/upload-artifact@v3
96+
# with:
97+
# name: installer-Qt-${{ matrix.qt-version }}
98+
# path: '*.exe'

0 commit comments

Comments
 (0)