From b89e9052c01a5472b512ac373fa2065a1c020770 Mon Sep 17 00:00:00 2001 From: Steven Powell Date: Thu, 23 Feb 2023 12:53:00 -0800 Subject: [PATCH 1/3] CI: cleanup building --- .github/workflows/bump-version.yml | 2 +- .github/workflows/linux.yml | 5 ++-- .github/workflows/macos.yml | 8 ++---- .github/workflows/tag-and-release.yml | 24 +++-------------- .github/workflows/windows.yml | 14 ++-------- Makefile | 17 +++++++++++- minikube.pro | 2 ++ scripts/bundle-windows.ps1 | 39 +++++++++++++++++++++++++++ scripts/windows-publish.ps1 | 30 --------------------- 9 files changed, 67 insertions(+), 74 deletions(-) create mode 100644 scripts/bundle-windows.ps1 delete mode 100644 scripts/windows-publish.ps1 diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml index 11d25b9..0915a9a 100644 --- a/.github/workflows/bump-version.yml +++ b/.github/workflows/bump-version.yml @@ -10,7 +10,7 @@ jobs: - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c - name: Bump Version run: | - sed -i 's/VERSION = .*/VERSION = ${{ github.event.inputs.version }}/' Makefile + export VERSION=${{ github.event.inputs.version }} make bump-version - name: Create PR uses: peter-evans/create-pull-request@2b011faafdcbc9ceb11414d64d0573f37c774b04 diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 5ab0eed..5aae1b0 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -15,9 +15,8 @@ jobs: cache: true - name: build run: | - qmake - make + make build-linux - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce with: name: minikube-gui-linux - path: ./minikube + path: ./minikube-gui-linux.tar.gz diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index cc81648..751e7a7 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -15,12 +15,8 @@ jobs: cache: true - name: build run: | - qmake - make - - name: package - run: | - macdeployqt ./minikube.app -qmldir=. -verbose=1 -dmg + make build-macos - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce with: name: minikube-gui-macos - path: ./minikube.dmg + path: ./minikube-gui-macos.dmg diff --git a/.github/workflows/tag-and-release.yml b/.github/workflows/tag-and-release.yml index 51661bd..31e4edd 100644 --- a/.github/workflows/tag-and-release.yml +++ b/.github/workflows/tag-and-release.yml @@ -20,9 +20,7 @@ jobs: cache: true - name: build run: | - qmake - make - tar -czvf minikube-gui-linux.tar.gz ./minikube + make build-linux - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce with: name: minikube-gui-linux-release @@ -36,12 +34,7 @@ jobs: cache: true - name: build run: | - qmake - make - - name: package - run: | - macdeployqt ./minikube.app -qmldir=. -verbose=1 -dmg - mv ./minikube.dmg ./minikube-gui-macos.dmg + make build-macos - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce with: name: minikube-gui-macos-release @@ -54,20 +47,9 @@ jobs: with: cache: true - name: build - shell: cmd - run: | - call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 - qmake - nmake - echo winSdkDir=%WindowsSdkDir% >> %GITHUB_ENV% - echo winSdkVer=%WindowsSdkVersion% >> %GITHUB_ENV% - echo vcToolsInstallDir=%VCToolsInstallDir% >> %GITHUB_ENV% - echo vcToolsRedistDir=%VCToolsRedistDir% >> %GITHUB_ENV% - - name: package shell: pwsh run: | - & scripts\windows-publish.ps1 minikube-gui-windows minikube.exe - Compress-Archive -Path minikube-gui-windows minikube-gui-windows.zip + make build-windows - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce with: name: minikube-gui-windows-release diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 8b8d905..dc28d27 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -16,18 +16,8 @@ jobs: - name: build shell: cmd run: | - call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 - qmake - nmake - echo winSdkDir=%WindowsSdkDir% >> %GITHUB_ENV% - echo winSdkVer=%WindowsSdkVersion% >> %GITHUB_ENV% - echo vcToolsInstallDir=%VCToolsInstallDir% >> %GITHUB_ENV% - echo vcToolsRedistDir=%VCToolsRedistDir% >> %GITHUB_ENV% - - name: package - shell: pwsh - run: | - & scripts\windows-publish.ps1 minikube-gui-windows minikube.exe + make build-windows - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce with: name: minikube-gui-windows - path: ./minikube-gui-windows + path: ./minikube-gui-windows.zip diff --git a/Makefile b/Makefile index dce50a2..fb4a98c 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,22 @@ # See the License for the specific language governing permissions and # limitations under the License. -VERSION = 0.0.2 +.PHONY: build-linux +build-linux: + qmake + make + tar -czvf minikube-gui-linux.tar.gz -C ./bin ./minikube-gui + +.PHONY: build-macos +build-macos: + qmake + make + (cd ./bin && macdeployqt ./minikube-gui.app -qmldir=. -verbose=1 -dmg) + mv ./bin/minikube-gui.dmg ./minikube-gui-macos.dmg + +.PHONY: build-windows +build-windows: + scripts\build-windows.cmd .PHONY: bump-version bump-version: diff --git a/minikube.pro b/minikube.pro index cdc93e1..39dafed 100644 --- a/minikube.pro +++ b/minikube.pro @@ -38,6 +38,8 @@ SOURCES = src/main.cpp \ src/window.cpp RESOURCES = minikube.qrc ICON = resources/images/minikube.icns +TARGET = minikube-gui +DESTDIR = bin QT += widgets network requires(qtConfig(combobox)) diff --git a/scripts/bundle-windows.ps1 b/scripts/bundle-windows.ps1 new file mode 100644 index 0000000..c5eeec8 --- /dev/null +++ b/scripts/bundle-windows.ps1 @@ -0,0 +1,39 @@ +# Copyright 2023 The Kubernetes Authors All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +[CmdletBinding()] +param ( + [string] $archiveName, [string] $targetName +) + +$scriptDir = $PSScriptRoot +$currentDir = Get-Location +Write-Host "currentDir" $currentDir +Write-Host "scriptDir" $scriptDir + +function Main() { + New-Item -ItemType Directory $archiveName + Copy-Item bin\$targetName $archiveName\ + windeployqt --qmldir . --plugindir $archiveName\plugins --no-translations --compiler-runtime $archiveName\$targetName + $excludeList = @("*.qmlc", "*.ilk", "*.exp", "*.lib", "*.pdb") + Remove-Item -Path $archiveName -Include $excludeList -Recurse -Force + $redistDll="{0}{1}\*.CRT\*.dll" -f $env:VCToolsRedistDir.Trim(),$env:msvcArch + Copy-Item $redistDll $archiveName\ + $sdkDll="{0}Redist\{1}ucrt\DLLs\{2}\*.dll" -f $env:WindowsSdkDir.Trim(),$env:WindowsSdkVersion.Trim(),$env:msvcArch + Copy-Item $sdkDll $archiveName\ + Compress-Archive -Path minikube-gui-windows minikube-gui-windows.zip +} +Main + + diff --git a/scripts/windows-publish.ps1 b/scripts/windows-publish.ps1 deleted file mode 100644 index 1c4ed3b..0000000 --- a/scripts/windows-publish.ps1 +++ /dev/null @@ -1,30 +0,0 @@ -[CmdletBinding()] -param ( - [string] $archiveName, [string] $targetName -) - -$scriptDir = $PSScriptRoot -$currentDir = Get-Location -Write-Host "currentDir" $currentDir -Write-Host "scriptDir" $scriptDir - -function Main() { - - New-Item -ItemType Directory $archiveName - Copy-Item release\$targetName $archiveName\ - windeployqt --qmldir . --plugindir $archiveName\plugins --no-translations --compiler-runtime $archiveName\$targetName - $excludeList = @("*.qmlc", "*.ilk", "*.exp", "*.lib", "*.pdb") - Remove-Item -Path $archiveName -Include $excludeList -Recurse -Force - $redistDll="{0}{1}\*.CRT\*.dll" -f $env:vcToolsRedistDir.Trim(),$env:msvcArch - Copy-Item $redistDll $archiveName\ - $sdkDll="{0}Redist\{1}ucrt\DLLs\{2}\*.dll" -f $env:winSdkDir.Trim(),$env:winSdkVer.Trim(),$env:msvcArch - Copy-Item $sdkDll $archiveName\ -} - -if ($null -eq $archiveName || $null -eq $targetName) { - Write-Host "args missing, archiveName is" $archiveName ", targetName is" $targetName - return -} -Main - - From abce33421a694d94c321c0e431500c69d9ee7fac Mon Sep 17 00:00:00 2001 From: Steven Powell Date: Thu, 23 Feb 2023 12:54:35 -0800 Subject: [PATCH 2/3] update shell --- .github/workflows/tag-and-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tag-and-release.yml b/.github/workflows/tag-and-release.yml index 31e4edd..d315976 100644 --- a/.github/workflows/tag-and-release.yml +++ b/.github/workflows/tag-and-release.yml @@ -47,7 +47,7 @@ jobs: with: cache: true - name: build - shell: pwsh + shell: cmd run: | make build-windows - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce From 58e35e52b5f3b25066470c3da727d8aaadae9bee Mon Sep 17 00:00:00 2001 From: Steven Powell Date: Thu, 23 Feb 2023 12:55:58 -0800 Subject: [PATCH 3/3] add cmd file --- .gitignore | 1 - scripts/build-windows.cmd | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 scripts/build-windows.cmd diff --git a/.gitignore b/.gitignore index ed3318f..854db16 100644 --- a/.gitignore +++ b/.gitignore @@ -27,7 +27,6 @@ qrc_*.cpp ui_*.h *.qmlc *.jsc -*build-* *.qm *.prl diff --git a/scripts/build-windows.cmd b/scripts/build-windows.cmd new file mode 100644 index 0000000..63b0962 --- /dev/null +++ b/scripts/build-windows.cmd @@ -0,0 +1,4 @@ +call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 +qmake +nmake +powershell scripts\bundle-windows.ps1 minikube-gui-windows minikube-gui.exe