Skip to content

Commit

Permalink
make it buildable with Qt6 and setup github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
mhogomchungu committed May 9, 2024
1 parent 59450cc commit 9bba456
Show file tree
Hide file tree
Showing 17 changed files with 1,541 additions and 136 deletions.
210 changes: 210 additions & 0 deletions .github/workflows/buildGit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
name: buildGit

on:
push:
branches:
- main
tags-ignore:
- '*'

env:
QT5_VERSION: "5.15.2"
MINGW5_VERSION: "win32_mingw81"
MINGW5_PATH: "mingw81_32"
QT6_VERSION: "6.6.2"
MINGW6_VERSION: "win64_mingw"
MINGW6_PATH: "mingw_64"
BUILD_TYPE: Release

jobs:
buildGitEvent:
runs-on: windows-latest
steps:
-
uses: actions/checkout@v4
with:
path: SiriKali
-
name: Install mingw
uses: msys2/setup-msys2@v2
with:
install: mingw-w64-i686-gcc
msystem: mingw32
location: ${{github.workspace}}
-
name: update env for Qt5
run: echo "${{github.workspace}}/msys64/mingw32/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
-
name: Check GCC version and path for Qt5
run: |
Write-Output (Get-Command c++.exe).Path
c++.exe --version
-
name: Install Qt5
uses: jurplel/install-qt-action@v3
with:
version: ${{ env.QT5_VERSION }}
arch: ${{ env.MINGW5_VERSION }}
dir: "${{github.workspace}}/qt5"
install-deps: "true"
host: 'windows'
target: 'desktop'
-
name: Set Build time
run: |
$now = (Get-Date)
$then = (Get-Date -Year 2024 -Month 5 -Day 3 -Hour 0 -Minute 0)
echo "CURRENT_TIME=$($now.ToString())" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
$All = (New-TimeSpan -start $then -end $now)
$Days=$All.Days.ToString()
$Hours=$All.Hours.ToString()
$Minutes=$All.Minutes.ToString()
if($Hours.Length -eq 1){ $Hours = "0" + $Hours }
if($Minutes.Length -eq 1){ $Minutes = "0" + $Minutes }
$Version=$Days+$Hours+$Minutes
$Version=$Version.TrimStart("0")
echo "GIT_VERSION_NUMBER=$Version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
-
name: Configure CMake for Qt5
env:
CMAKE_PREFIX_PATH: "${{github.workspace}}/qt5/Qt/${{ env.QT5_VERSION }}"
msystem: MINGW32
run: cmake -DOUTPUT_BASE_NAME=SiriKaliQt5 -DBUILD_WITH_QT6=false -DLIBRARIES_LOCATION=${{github.workspace}}\SiriKali.git\ -DOUTPUT_PATH=${{github.workspace}}\ -DSOURCE_PATH=${{github.workspace}}\SiriKali\ -DCMAKE_VERBOSE_MAKEFILE=FALSE -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -G "CodeBlocks - MinGW Makefiles" -S ${{github.workspace}}/SiriKali/ -B ${{github.workspace}}/SiriKali/build5
-
name: Print installer script for Qt5
run : get-content ${{github.workspace}}\SiriKali\build5\sirikali_windows_installer_Qt5.iss
-
name: Update version.h for Qt5
run: |
$content = [System.IO.File]::ReadAllText("${{github.workspace}}\SiriKali\build5\version.h").Replace("git_tag",${{ env.GIT_VERSION_NUMBER }})
[System.IO.File]::WriteAllText("${{github.workspace}}\SiriKali\build5\version.h",$content )
-
name: Build Project for Qt5
run: cmake --build ${{github.workspace}}/SiriKali/build5
-
name: Prepare release date
run: |
$data = [System.IO.File]::ReadAllText("${{github.workspace}}\SiriKali\build5\version.h")
$versionInfoLines = $data.Split([Environment]::NewLine, [System.StringSplitOptions]::RemoveEmptyEntries)
$versionInfoFirstLine = $versionInfoLines[1]
$versionInfo = $versionInfoFirstLine.Split(" ",[System.StringSplitOptions]::RemoveEmptyEntries)[2]
echo "BUILD_VERSION=$versionInfo" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
-
name: Create SiriKali.git.exe.zip
run: |
New-Item -ItemType Directory -Path ${{github.workspace}}\SiriKali.git
New-Item -ItemType Directory -Path ${{github.workspace}}\SiriKali.git/local
Copy-Item -Path ${{github.workspace}}\SiriKali\translations -Destination ${{github.workspace}}\SiriKali.git -Recurse
Copy-Item -Path ${{github.workspace}}\SiriKali\build5\sirikali.exe -Destination ${{github.workspace}}\SiriKali.git
Set-Location ${{github.workspace}}\SiriKali.git
${{github.workspace}}/qt5/Qt/${{ env.QT5_VERSION }}/${{ env.MINGW5_PATH }}/bin/windeployqt.exe ${{github.workspace}}\SiriKali.git\sirikali.exe
$bb = ${{ env.BUILD_VERSION }}
$bb = $bb.Trim()
echo "$bb" | Out-File -FilePath ${{github.workspace}}\SiriKali.git\version_info.txt -Encoding utf8 -Append
Compress-Archive -Path ${{github.workspace}}\SiriKali.git -DestinationPath ${{github.workspace}}\SiriKaliQt5.git.exe.zip
Remove-Item -Path ${{github.workspace}}\SiriKali.git\local
Remove-Item -Path ${{github.workspace}}\SiriKali.git\version_info.txt
-
name: Make installer for Qt5
uses: Minionguyjpro/[email protected]
with:
path: SiriKali/build5/sirikali_windows_installer_Qt5.iss
-
name: Install Qt6
uses: jurplel/install-qt-action@v3
with:
version: ${{ env.QT6_VERSION }}
arch: ${{ env.MINGW6_VERSION }}
dir: "${{github.workspace}}/qt6"
install-deps: "true"
host: 'windows'
target: 'desktop'
tools: 'tools_mingw1310'
-
name: update env for Qt6
run: echo "${{github.workspace}}/qt6/Qt/Tools/mingw1310_64/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
-
name: Check GCC version and path for Qt6
run: |
Write-Output (Get-Command c++.exe).Path
c++.exe --version
-
name: Configure CMake for Qt6
env:
CMAKE_PREFIX_PATH: "${{github.workspace}}/qt6/Qt/${{ env.QT6_VERSION }}"
msystem: MINGW32
run: cmake -DOUTPUT_BASE_NAME=SiriKaliQt6 -DLIBRARIES_LOCATION=${{github.workspace}}\SiriKaliQt6.git\ -DOUTPUT_PATH=${{github.workspace}}\ -DSOURCE_PATH=${{github.workspace}}\SiriKali\ -DBUILD_WITH_QT6=true -DCMAKE_VERBOSE_MAKEFILE=FALSE -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -G "CodeBlocks - MinGW Makefiles" -S ${{github.workspace}}/SiriKali/ -B ${{github.workspace}}/SiriKali/build6
-
name: Print installer script for Qt6
run : get-content ${{github.workspace}}\SiriKali\build6\sirikali_windows_installer_Qt6.iss
-
name: Update version.h for Qt6
run: |
$content = [System.IO.File]::ReadAllText("${{github.workspace}}\SiriKali\build6\version.h").Replace("git_tag",${{ env.GIT_VERSION_NUMBER }})
[System.IO.File]::WriteAllText("${{github.workspace}}\SiriKali\build6\version.h",$content )
-
name: Build Project for Qt6
run: cmake --build ${{github.workspace}}/SiriKali/build6
-
name: Create SiriKaliQt6.git.exe.zip
run: |
New-Item -ItemType Directory -Path ${{github.workspace}}\SiriKaliQt6.git
New-Item -ItemType Directory -Path ${{github.workspace}}\SiriKaliQt6.git/local
Copy-Item -Path ${{github.workspace}}\SiriKali\translations -Destination ${{github.workspace}}\SiriKaliQt6.git -Recurse
Copy-Item -Path ${{github.workspace}}\SiriKali\build6\sirikali.exe -Destination ${{github.workspace}}\SiriKaliQt6.git
Set-Location ${{github.workspace}}\SiriKaliQt6.git
${{github.workspace}}/qt6/Qt/${{ env.QT6_VERSION }}/${{ env.MINGW6_PATH }}/bin/windeployqt6.exe ${{github.workspace}}\SiriKaliQt6.git\sirikali.exe
$bb = ${{ env.BUILD_VERSION }}
$bb = $bb.Trim()
echo "$bb" | Out-File -FilePath ${{github.workspace}}\SiriKaliQt6.git\version_info.txt -Encoding utf8 -Append
Compress-Archive -Path ${{github.workspace}}\SiriKaliQt6.git -DestinationPath ${{github.workspace}}\SiriKaliQt6.git.exe.zip
Remove-Item -Path ${{github.workspace}}\SiriKaliQt6.git\local
Remove-Item -Path ${{github.workspace}}\SiriKaliQt6.git\version_info.txt
-
name: Make installer for Qt6
uses: Minionguyjpro/[email protected]
with:
path: SiriKali/build6/sirikali_windows_installer_Qt6.iss
-
name: Rename installers
run: |
Rename-Item -Path ${{github.workspace}}\SiriKaliQt5.exe -NewName ${{github.workspace}}\SiriKaliQt5.git.setup.exe
Rename-Item -Path ${{github.workspace}}\SiriKaliQt6.exe -NewName ${{github.workspace}}\SiriKaliQt6.git.setup.exe
-
name: Post Releases
uses: ncipollo/release-action@v1
with:
artifacts: ${{github.workspace}}\SiriKaliQt5.git.setup.exe,${{github.workspace}}\SiriKaliQt6.git.setup.exe,${{github.workspace}}\SiriKaliQt6.git.exe.zip,${{github.workspace}}\SiriKaliQt5.git.exe.zip
tag: "1.5.2"
commit: "main"
allowUpdates: true
body: "Build date and time: ${{ env.CURRENT_TIME }}\nBuild version: ${{ env.BUILD_VERSION }}"
Loading

0 comments on commit 9bba456

Please sign in to comment.