-
Notifications
You must be signed in to change notification settings - Fork 242
Autobuild: Combine and simplify Windows build scripts #2502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ann0see
merged 2 commits into
jamulussoftware:master
from
hoffie:autobuild-merge-windows-scripts
Mar 14, 2022
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,7 @@ | ||
| # Scripts for building Jamulus via GitHub Actions | ||
|
|
||
| The scripts in this folder are used by the Github autobuild actions in .github/workflows/autobuild.yml. | ||
| They are responsible for setting up the Github environment, building the binaries and passing the resulting artifacts back to the workflow. | ||
|
|
||
| The scripts may work outside of Github, but haven't been designed or tested for that use case. | ||
| See the various platform-specific build scripts in their own folders for standalone builds (e.g. windows/deploy_windows.ps1). |
This file contains hidden or 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,169 @@ | ||
| # Steps for generating Windows artifacts via Github Actions | ||
| # See README.md in this folder for details. | ||
| # See windows/deploy_windows.ps1 for standalone builds. | ||
|
|
||
| param( | ||
| [Parameter(Mandatory=$true)] | ||
| [string] $Stage = "", | ||
| # Allow buildoption to be passed for jackonwindows build, leave empty for standard (ASIO) build: | ||
| [string] $BuildOption = "", | ||
| # unused, only required during refactoring as long as not all platforms have been updated: | ||
| [string] $GithubWorkspace ="" | ||
| ) | ||
|
|
||
| # Fail early on all errors | ||
| $ErrorActionPreference = "Stop" | ||
|
|
||
| $QtDir = 'C:\Qt' | ||
| $ChocoCacheDir = 'C:\ChocoCache' | ||
| $Qt32Version = "5.15.2" | ||
| $Qt64Version = "5.15.2" | ||
| $AqtinstallVersion = "2.0.6" | ||
| $JackVersion = "1.9.17" | ||
| $Msvc32Version = "win32_msvc2019" | ||
| $Msvc64Version = "win64_msvc2019_64" | ||
| $JomVersion = "1.1.2" | ||
|
|
||
| $JamulusVersion = $Env:jamulus_buildversionstring | ||
| if ( $JamulusVersion -notmatch '^\d+\.\d+\.\d+.*' ) | ||
| { | ||
| throw "Environment variable jamulus_buildversionstring has to be set to a valid version string" | ||
| } | ||
|
|
||
| Function Install-Qt | ||
| { | ||
| param( | ||
| [string] $QtVersion, | ||
| [string] $QtArch | ||
| ) | ||
| $Args = ( | ||
| "--outputdir", "$QtDir", | ||
| "windows", | ||
| "desktop", | ||
| "$QtVersion", | ||
| "$QtArch", | ||
| "--archives", "qtbase", "qttools", "qttranslations", "qtwinextras" | ||
| ) | ||
| aqt install-qt @Args | ||
| if ( !$? ) | ||
| { | ||
| echo "WARNING: Qt installation via first aqt run failed, re-starting with different base URL." | ||
| aqt install-qt -b https://mirrors.ocf.berkeley.edu/qt/ @Args | ||
| if ( !$? ) | ||
| { | ||
| throw "Qt installation with args @Args failed with exit code $LastExitCode" | ||
| } | ||
| } | ||
| } | ||
|
|
||
| Function Ensure-Qt | ||
| { | ||
| if ( Test-Path -Path $QtDir ) | ||
| { | ||
| echo "Using Qt installation from previous run (actions/cache)" | ||
| return | ||
| } | ||
|
|
||
| echo "Install Qt..." | ||
| # Install Qt | ||
| pip install "aqtinstall==$AqtinstallVersion" | ||
| if ( !$? ) | ||
| { | ||
| throw "pip install aqtinstall failed with exit code $LastExitCode" | ||
| } | ||
|
|
||
| echo "Get Qt 64 bit..." | ||
| Install-Qt "${Qt64Version}" "${Msvc64Version}" | ||
|
|
||
| echo "Get Qt 32 bit..." | ||
| Install-Qt "${Qt32Version}" "${Msvc32Version}" | ||
| } | ||
|
|
||
| Function Ensure-jom | ||
| { | ||
| choco install --no-progress -y jom --version "${JomVersion}" | ||
| } | ||
|
|
||
| Function Ensure-JACK | ||
| { | ||
| if ( $BuildOption -ne "jackonwindows" ) | ||
| { | ||
| return | ||
| } | ||
|
|
||
| echo "Install JACK2 64-bit..." | ||
| # Install JACK2 64-bit | ||
| choco install --no-progress -y jack --version "${JackVersion}" | ||
| if ( !$? ) | ||
| { | ||
| throw "64bit jack installation failed with exit code $LastExitCode" | ||
| } | ||
|
|
||
| echo "Install JACK2 32-bit..." | ||
| # Install JACK2 32-bit (need to force choco install as it detects 64 bits as installed) | ||
| choco install --no-progress -y -f --forcex86 jack --version "${JackVersion}" | ||
| if ( !$? ) | ||
| { | ||
| throw "32bit jack installation failed with exit code $LastExitCode" | ||
| } | ||
| } | ||
|
|
||
| Function Build-App-With-Installer | ||
| { | ||
| echo "Build app and create installer..." | ||
| $ExtraArgs = @() | ||
| if ( $BuildOption -ne "" ) | ||
| { | ||
| $ExtraArgs += ("-BuildOption", $BuildOption) | ||
| } | ||
| powershell ".\windows\deploy_windows.ps1" "C:\Qt\5.15.2" "C:\Qt\5.15.2" @ExtraArgs | ||
| if ( !$? ) | ||
| { | ||
| throw "deploy_windows.ps1 failed with exit code $LastExitCode" | ||
| } | ||
| } | ||
|
|
||
| Function Pass-Artifact-to-Job | ||
| { | ||
| # Add $BuildOption as artifact file name suffix. Shorten "jackonwindows" to just "jack": | ||
| $ArtifactSuffix = switch -Regex ( $BuildOption ) | ||
| { | ||
| "jackonwindows" { "_jack"; break } | ||
| "^\S+$" { "_${BuildOption}"; break } | ||
| default { "" } | ||
| } | ||
|
|
||
| $artifact_deploy_filename = "jamulus_${JamulusVersion}_win${ArtifactSuffix}.exe" | ||
|
|
||
| echo "Copying artifact to ${artifact_deploy_filename}" | ||
| cp ".\deploy\Jamulus*installer-win.exe" ".\deploy\${artifact_deploy_filename}" | ||
|
Comment on lines
+138
to
+139
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe the deploy script could be adapted to create the correct name (but that's for another PR) |
||
| if ( !$? ) | ||
| { | ||
| throw "cp failed with exit code $LastExitCode" | ||
| } | ||
| echo "Setting Github step output name=artifact_1::${artifact_deploy_filename}" | ||
| echo "::set-output name=artifact_1::${artifact_deploy_filename}" | ||
| } | ||
|
|
||
| switch ( $Stage ) | ||
| { | ||
| "setup" | ||
| { | ||
| choco config set cacheLocation $ChocoCacheDir | ||
| Ensure-Qt | ||
| Ensure-jom | ||
| Ensure-JACK | ||
| } | ||
| "build" | ||
| { | ||
| Build-App-With-Installer | ||
| } | ||
| "get-artifacts" | ||
| { | ||
| Pass-Artifact-to-Job | ||
| } | ||
| default | ||
| { | ||
| throw "Unknown stage ${Stage}" | ||
| } | ||
| } | ||
This file contains hidden or 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
104 changes: 0 additions & 104 deletions
104
autobuild/windows/autobuild_windowsinstaller_1_prepare.ps1
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.