-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from scratchcpp/windows_workflow
Add Windows workflow
- Loading branch information
Showing
22 changed files
with
1,050 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/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 "<>" | ||
|
||
REPO="$1" | ||
part1='/<Version>/c\\t<Version>' | ||
VERSION=${previous_tag//v} | ||
part2='<\/Version>' | ||
part3='/<ReleaseDate>/c\\t<ReleaseDate>' | ||
part4='<\/ReleaseDate>' | ||
sed -i -e "${part1}${VERSION}${part2}" release/win_installer/config/config.xml | ||
sed -i -e "${part1}${VERSION}${part2}" release/win_installer/packages/${windows_app_name}/meta/package.xml | ||
sed -i -e "${part3}$(date +'%Y-%m-%d')${part4}" release/win_installer/packages/${windows_app_name}/meta/package.xml | ||
|
||
mv win_release/* "release/win_installer/packages/${windows_app_name}/data/${app_name}" | ||
cd release/win_installer | ||
curl -L https://aka.ms/vs/16/release/VC_redist.x64.exe > packages/com.microsoft.vcredist/data/VC_redist.x64.exe || exit $? | ||
./build.sh $(echo ../../../Tools/QtInstallerFramework/*/bin/binarycreator.exe) || exit $? | ||
mv *installer.exe ../.. | ||
|
||
if (( $update_windows_repository == 1 )); then | ||
./update_repo.sh $(echo ../../../Tools/QtInstallerFramework/*/bin/repogen.exe) || exit $? | ||
old_dir="$(pwd)" | ||
cd "$REPO" | ||
git checkout -b tmp | ||
git branch -D master && | ||
git switch --orphan master && | ||
mv $old_dir/repository/* ./ && | ||
rm -rf "$old_dir/repository" && | ||
git add -A && | ||
git commit -m "Generate repository" || exit $? | ||
git push -f --set-upstream origin master | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
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: 'recursive' | ||
- 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=$(LC_ALL=en_US.utf8 grep -oP 'project\([^)]*\s+VERSION\s+\K[0-9]+\.[0-9]+\.[0-9]+' CMakeLists.txt) | ||
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 | ||
- name: Install MinGW | ||
uses: egor-tensin/setup-mingw@v2 | ||
with: | ||
platform: x64 | ||
static: 0 | ||
version: ${{ matrix.mingw-version }} | ||
## Build | ||
- name: Windows build | ||
run: .ci/common/build.sh win_build win64 | ||
shell: bash | ||
- name: Deploy | ||
run: | | ||
mkdir win_release | ||
for /r win_build %%f in (${{ env.executable_name }}.exe) do @move "%%f" win_release | ||
for /r win_build %%f in (*.dll) do @move "%%f" win_release | ||
cd win_release | ||
windeployqt ${{ env.executable_name }}.exe --qmldir ..\win_build\src || exit 5 | ||
shell: cmd | ||
## 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_repository=0" >> "${GITHUB_ENV}" | ||
shell: bash | ||
- if: env.create_windows_installer == 1 | ||
name: Get installer repository | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ env.installer_repo_github }}/${{ env.installer_repo_name }} | ||
fetch-depth: 0 | ||
path: win_repo | ||
token: ${{ secrets.PUSH_TOKEN }} | ||
- if: env.create_windows_installer == 1 | ||
name: Build installer | ||
run: .ci/windows_installer.sh "${GITHUB_WORKSPACE}/win_repo" | ||
shell: bash | ||
# Upload installer | ||
- name: Upload installer | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: installer-Qt-${{ matrix.qt-version }} | ||
path: '*installer.exe' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
BINARYCREATOR=$1 | ||
source "$SCRIPT_DIR/env.sh" | ||
|
||
if [[ "$BINARYCREATOR" == "" ]]; then | ||
if [[ `command -v binarycreator` != "" ]]; then | ||
BINARYCREATOR=binarycreator | ||
else | ||
echo "No binarycreator executable path specified!" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
echo "D: binarycreator: $BINARYCREATOR" | ||
echo "Creating installer binary..." | ||
$BINARYCREATOR --offline-only -c config/config.xml -p packages "$FILE_NAME" || exit $? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Installer> | ||
<Name>ScratchCPP Player</Name> | ||
<Version></Version> | ||
<Title>ScratchCPP Player</Title> | ||
<Publisher>adazem009</Publisher> | ||
<StartMenuDir>ScratchCPP</StartMenuDir> | ||
<TargetDir>@ApplicationsDir@/ScratchCPP</TargetDir> | ||
<!-- <InstallerWindowIcon>windowicon.png</InstallerWindowIcon> | ||
<InstallerApplicationIcon>appicon</InstallerApplicationIcon> --> | ||
<WizardStyle>Modern</WizardStyle> | ||
<StyleSheet>style.qss</StyleSheet> | ||
<ControlScript>controller.qs</ControlScript> | ||
<RemoteRepositories> | ||
<Repository> | ||
<Url>http://scratchcpp.github.io/installer-repo</Url> | ||
<Enabled>1</Enabled> | ||
<DisplayName>ScratchCPP official repository</DisplayName> | ||
</Repository> | ||
</RemoteRepositories> | ||
</Installer> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
function Controller() { | ||
installer.setMessageBoxAutomaticAnswer("installationErrorWithRetry", QMessageBox.Ignore); | ||
installer.setMessageBoxAutomaticAnswer("installationError", QMessageBox.Ignore); | ||
} | ||
|
||
Controller.prototype.IntroductionPageCallback = function() { | ||
if(installer.isUpdater()) | ||
gui.clickButton(buttons.NextButton); | ||
} | ||
|
||
Controller.prototype.ComponentSelectionPageCallback = function() { | ||
if(installer.isUpdater()) | ||
gui.clickButton(buttons.NextButton); | ||
} | ||
|
||
Controller.prototype.ReadyForInstallationPageCallback = function() { | ||
if(installer.isUpdater()) { | ||
gui.clickButton(buttons.NextButton); | ||
installer.setDefaultPageVisible(QInstaller.Introduction, false); | ||
installer.setDefaultPageVisible(QInstaller.TargetDirectory, false); | ||
installer.setDefaultPageVisible(QInstaller.ReadyForInstallation, false); | ||
installer.setDefaultPageVisible(QInstaller.ComponentSelection, false); | ||
installer.setDefaultPageVisible(QInstaller.StartMenuSelection, false); | ||
installer.setDefaultPageVisible(QInstaller.LicenseCheck, false); | ||
} | ||
} | ||
|
||
Controller.prototype.FinishedPageCallback = function() { | ||
if(installer.isUpdater()) { | ||
var execName = installer.value("updateSource"); | ||
if(execName != "") { | ||
installer.executeDetached(execName); | ||
gui.clickButton(buttons.FinishButton); | ||
gui.clickButton(buttons.QuitButton); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
QWidget | ||
{ | ||
color: white; | ||
background-color: rgb(61, 56, 56); | ||
} | ||
|
||
QPushButton | ||
{ | ||
background-color: rgb(50, 130, 172); | ||
border-style: solid; | ||
border-width: 1px; | ||
border-color: rgb(61, 56, 56); | ||
border-radius: 5px; | ||
min-height: 25px; | ||
max-height: 25px; | ||
min-width: 60px; | ||
padding-left: 15px; | ||
padding-right: 15px; | ||
} | ||
|
||
QPushButton:disabled | ||
{ | ||
background-color: rgb(30, 77, 102); | ||
} | ||
|
||
QPushButton:pressed, QPushButton:checked | ||
{ | ||
background: qlineargradient(x1:0, y1:1, x2:0, y2:0, stop:0 rgba(50, 130, 172, 60%), stop:1 rgba(30, 77, 102, 60%)); | ||
} | ||
|
||
QProgressBar | ||
{ | ||
text-align: center; | ||
} | ||
|
||
QProgressBar::chunk | ||
{ | ||
background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 rgba(50, 130, 172, 60%), stop:1 rgba(30, 77, 102, 60%)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
export FILE_NAME="ScratchCPP_Player_installer" |
Empty file.
13 changes: 13 additions & 0 deletions
13
release/win_installer/packages/com.microsoft.vcredist/meta/installscript.qs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
function Component(){} | ||
|
||
Component.prototype.createOperations = function() | ||
{ | ||
try { | ||
component.createOperations(); | ||
if (installer.value("os") === "win") { | ||
component.addElevatedOperation("Execute", "{0,1638}", "@TargetDir@/VC_redist.x64.exe", "/norestart", "/quiet"); | ||
} | ||
} catch (e) { | ||
print(e); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
release/win_installer/packages/com.microsoft.vcredist/meta/package.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Package> | ||
<DisplayName>Microsoft Visual C++ Redistributable</DisplayName> | ||
<Description>Installs the Visual C++ redistributables</Description> | ||
<Version>14.29.30139</Version> | ||
<ReleaseDate>2019-04-02</ReleaseDate> | ||
<Virtual>true</Virtual> | ||
<Script>installscript.qs</Script> | ||
<UserInterfaces> | ||
<UserInterface>page.ui</UserInterface> | ||
</UserInterfaces> | ||
</Package> |
28 changes: 28 additions & 0 deletions
28
release/win_installer/packages/com.microsoft.vcredist/meta/page.ui
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>Page</class> | ||
<widget class="QWidget" name="Page"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>400</width> | ||
<height>300</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Dynamic page example</string> | ||
</property> | ||
<layout class="QVBoxLayout" name="verticalLayout"> | ||
<item> | ||
<widget class="QLabel" name="m_pageLabel"> | ||
<property name="alignment"> | ||
<set>Qt::AlignCenter</set> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</widget> | ||
<resources/> | ||
<connections/> | ||
</ui> |
Empty file.
17 changes: 17 additions & 0 deletions
17
release/win_installer/packages/com.scratchcpp.player/meta/installscript.qs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
function Component() { } | ||
|
||
Component.prototype.createOperations = function() | ||
{ | ||
component.createOperations(); | ||
programName = "ScratchCPP Player"; | ||
execName = "scratchcpp-player"; | ||
programDescription = "C++-based Scratch project player"; | ||
if (systemInfo.productType === "windows") { | ||
component.addOperation("CreateShortcut", "@TargetDir@/" + programName + "/" + execName + ".exe", "@StartMenuDir@/" + programName + ".lnk", | ||
"workingDirectory=@TargetDir@/" + programName, "iconPath=@TargetDir@/" + programName + "/" + execName + ".exe", | ||
"iconId=0", "description=" + programDescription); | ||
component.addOperation("CreateShortcut", "@TargetDir@/" + programName + "/" + execName + ".exe", "@DesktopDir@/" + programName + ".lnk", | ||
"workingDirectory=@TargetDir@/" + programName, "iconPath=@TargetDir@/" + programName + "/" + execName + ".exe", | ||
"iconId=0", "description=" + programDescription); | ||
} | ||
} |
Oops, something went wrong.