Skip to content

Commit

Permalink
Add initial Windows workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
adazem009 committed Mar 1, 2024
1 parent 50ff07e commit e6668f0
Show file tree
Hide file tree
Showing 2 changed files with 126 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .ci/windows_installer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

### This script generates an installer and a Qt Installer Framework repository and uploads it
git config --global user.name "GitHub Actions Bot"
git config --global user.email "<>"

part1='/<Version>/c\\t<Version>'
VERSION=${previous_tag//v}
part2='<\/Version>'
part3='/<ReleaseDate>/c\\t<ReleaseDate>'
part4='<\/ReleaseDate>'
sed -i -e "${part1}${VERSION}${part2}" config/config.xml
sed -i -e "${part1}${VERSION}${part2}" packages/${windows_app_name}/meta/package.xml
sed -i -e "${part3}$(date +'%Y-%m-%d')${part4}" packages/${windows_app_name}/meta/package.xml

if (( $update_windows_installer == 1 )); then
git add config/config.xml
git add packages/${windows_app_name}/meta/package.xml
git diff --quiet HEAD || git commit -m "Release ${app_name} v${VERSION}"
git push
fi

mv ../release/* packages/${windows_app_name}/data/${app_name}
curl -L https://aka.ms/vs/16/release/VC_redist.x64.exe > packages/com.microsoft.vcredist/data/VC_redist.x64.exe
./build.sh $(echo ../Tools/QtInstallerFramework/*/bin/binarycreator.exe) $(echo ../Tools/QtInstallerFramework/*/bin/repogen.exe)

if (( $update_windows_repository == 1 )); then
git push -f --set-upstream origin repository
fi
97 changes: 97 additions & 0 deletions .github/workflows/windows-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Windows build

on:
push:
branches: '*'
tags: '*'
pull_request:
branches: [ "master" ]

jobs:
build:
runs-on: windows-latest
strategy:
matrix:
qt-version: ['6.6']
qt-target: ['desktop']
qt-modules: ['']
mingw-version: ['11.2.0']
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- name: Setup environment
run: |
sed -i -e '/^#/d' .github/config.env
sed -i -e '/^$/d' .github/config.env
cat .github/config.env >> "${GITHUB_ENV}"
shell: bash
- name: Get version
run: |
version=$(iconv CMakeLists.txt | grep -oP 'project\([^)]*\s+VERSION\s+\K[0-9]+\.[0-9]+\.[0-9]+')
echo "Project version: $version"
echo previous_tag=$version >> "${GITHUB_ENV}"
shell: bash
## Install Qt
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt-version }}
host: 'windows'
arch: 'win64_mingw'
target: ${{ matrix.qt-target }}
modules: ${{ matrix.qt-modules }}
- name: Install Qt IFW
run: |
curl -o aqt.exe -L https://github.com/miurahr/aqtinstall/releases/download/v2.2.1/aqt.exe
./aqt.exe install-tool windows desktop tools_ifw
mv Tools ..
echo ${pwd}/../Tools/QtInstallerFramework/*/bin >> "${GITHUB_PATH}"
shell: bash
- if: contains(matrix.os, 'windows')
name: Install MinGW
uses: egor-tensin/setup-mingw@v2
with:
platform: x64
version: ${{ matrix.mingw-version }}
## Build
- name: Build
run: .ci/windows-build.sh
shell: bash
- name: Windows build
run: |
.ci/common/build.sh win_build win64
mkdir win_release
robocopy win_build release *.exe /S /MOV
robocopy win_build release *.dll /S /MOV
cd win_release
windeployqt ${{ env.executable_name }}.exe --qmldir ..\win_build\src || exit 5
for %%v in (*.dll) do windeployqt "%%v" || exit 5
shell: cmd
#- name: Finalize Windows build
# run: .ci/windows_build.sh 1
# shell: bash
## Upload
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: build-Qt-${{ matrix.qt-version }}
path: win_release/
## Build installer
#- if: env.create_windows_installer == 1
# name: Disable repository update
# run: |
# echo "update_windows_installer=0" >> "${GITHUB_ENV}"
# echo "update_windows_repository=0" >> "${GITHUB_ENV}"
# shell: bash
#- if: env.create_windows_installer == 1
# name: Build installer
# run: .ci/windows-repo.sh
# shell: bash
## Upload installer
#- name: Upload installer
# uses: actions/upload-artifact@v3
# with:
# name: installer-Qt-${{ matrix.qt-version }}
# path: '*.exe'

0 comments on commit e6668f0

Please sign in to comment.