Update README.md #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
name: Build | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Visual Studio shell | |
uses: egor-tensin/vs-shell@v2 | |
with: | |
arch: x64 | |
- name: Install Qt | |
id: qt | |
uses: jurplel/install-qt-action@v4 | |
with: | |
version: '6.8.1' | |
add-tools-to-path: true | |
cache: true | |
modules: 'qtmultimedia' | |
- name: Install jom | |
id: jom-setup | |
shell: pwsh | |
run: | | |
$url = "https://download.qt.io/official_releases/jom/jom_1_1_4.zip" | |
$outputPath = "jom_1_1_4.zip" | |
Invoke-WebRequest -Uri $url -OutFile $outputPath | |
$extractPath = "jom" | |
if (-not (Test-Path $extractPath)) { | |
New-Item -ItemType Directory -Path $extractPath | Out-Null | |
} | |
Expand-Archive -Path $outputPath -DestinationPath $extractPath | |
$jomDir = "$(pwd)\jom" | |
$jomExe = "$jomDir\jom.exe" | |
if (Test-Path $jomExe) { | |
Write-Output "JOM Path: $jomDir" | |
Write-Output "::set-output name=jom_path::$jomDir" | |
} else { | |
Write-Error "jom.exe not found in $jomDir" | |
exit 1 | |
} | |
- name: Build with qmake and jom | |
shell: pwsh | |
run: | | |
mkdir build | |
cd build | |
qmake ..\Retr0Mine.pro CONFIG+=release | |
$jomPath = "${{ steps.jom-setup.outputs.jom_path }}" | |
& "$jomPath\jom.exe" | |
- name: Remove source and object files | |
shell: pwsh | |
run: | | |
$buildDir = "build/release" | |
if (Test-Path $buildDir) { | |
Get-ChildItem -Path $buildDir -Include *.cpp, *.h, *.obj, *.res, *.qm -Recurse | Remove-Item -Force | |
} else { | |
Write-Host "Directory not found: $buildDir" | |
} | |
- name: Deploy Qt | |
shell: pwsh | |
run: | | |
cd build | |
$windeployqtPath = "D:\a\Retr0Mine\Qt\6.8.1\msvc2022_64\bin\windeployqt6.exe" | |
$qmlDir = "D:\a\Retr0Mine\Retr0Mine\Resources\qml" | |
if (Test-Path $windeployqtPath) { | |
& $windeployqtPath ` | |
--skip-plugin-types designer,iconengines,qmllint,generic,networkinformation,help,imageformats,qmltooling,sqldrivers,tls,qmlls ` | |
--no-opengl-sw ` | |
--no-system-dxc-compiler ` | |
--no-compiler-runtime ` | |
--no-translations ` | |
--no-system-d3d-compiler ` | |
--qmldir $qmlDir ` | |
D:\a\Retr0Mine\Retr0Mine\build\release\Retr0Mine.exe | |
} else { | |
Write-Error "windeployqt not found at the expected path!" | |
exit 1 | |
} | |
- name: Rename release folder | |
shell: pwsh | |
run: | | |
$releaseDir = "build/release" | |
$newDir = "Retr0Mine" | |
if (Test-Path $releaseDir) { | |
Rename-Item -Path $releaseDir -NewName $newDir | |
} else { | |
Write-Error "Release folder not found!" | |
exit 1 | |
} | |
- name: Zip binaries folder | |
shell: pwsh | |
run: | | |
$zipFile = "build/Retr0Mine_msvc_64.zip" | |
$folder = "build/Retr0Mine" | |
Compress-Archive -Path $folder -DestinationPath $zipFile | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Retr0Mine_msvc_64 | |
path: build/Retr0Mine_msvc_64.zip | |
- name: Create Installer | |
shell: pwsh | |
run: | | |
$env:Path += ";${env:ProgramFiles(x86)}\Inno Setup 6" | |
iscc.exe installer.iss | |
- name: Upload Installer | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Retr0Mine_Installer | |
path: Output/Retr0Mine_Installer.exe | |
linux-build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Qt | |
uses: jurplel/install-qt-action@v4 | |
with: | |
version: '6.6.2' | |
host: 'linux' | |
add-tools-to-path: true | |
modules: 'qtmultimedia' | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y build-essential libgl1-mesa-dev fuse libfuse2 libwayland-dev qt6-wayland | |
# Configure FUSE for the current user | |
sudo modprobe fuse | |
sudo groupadd fuse || true | |
sudo usermod -a -G fuse $USER | |
- name: Build with qmake | |
run: | | |
mkdir build | |
cd build | |
qmake ../Retr0Mine.pro CONFIG+=release | |
make -j$(nproc) | |
- name: Create AppDir structure | |
run: | | |
mkdir -p AppDir/usr/bin | |
mkdir -p AppDir/usr/lib | |
mkdir -p AppDir/usr/share/applications | |
mkdir -p AppDir/usr/share/icons/hicolor/256x256/apps | |
cp build/Retr0Mine AppDir/usr/bin/ | |
# Create .desktop file | |
cat > AppDir/usr/share/applications/Retr0Mine.desktop << EOF | |
[Desktop Entry] | |
Name=Retr0Mine | |
Exec=Retr0Mine | |
Icon=Retr0Mine | |
Type=Application | |
Categories=Game; | |
Comment=Minesweeper game | |
EOF | |
# Copy application icon | |
cp Resources/icons/icon.png AppDir/usr/share/icons/hicolor/256x256/apps/Retr0Mine.png | |
- name: Download linuxdeploy and plugins | |
run: | | |
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage | |
wget https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage | |
chmod +x linuxdeploy*.AppImage | |
- name: Create AppImage | |
run: | | |
# Debug Qt installation | |
which qmake | |
which qmake6 | |
echo "Current PATH: $PATH" | |
# Set environment variables | |
export QMAKE=$(which qmake6) | |
export QML_SOURCES_PATHS=${{ github.workspace }}/Resources/qml | |
export OUTPUT="Retr0Mine-x86_64.AppImage" | |
echo "Using QMAKE: $QMAKE" | |
# Create AppImage | |
./linuxdeploy-x86_64.AppImage --appdir AppDir --plugin qt --output appimage | |
- name: Zip binary | |
run: | | |
cd build | |
zip Retr0Mine_linux_64.zip Retr0Mine | |
- name: Upload AppImage | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Retr0Mine_AppImage | |
path: Retr0Mine-x86_64.AppImage | |
- name: Upload plain binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Retr0Mine_linux_64 | |
path: build/Retr0Mine_linux_64.zip |