Skip to content

Commit

Permalink
Github actions to provide builds for MacOS & Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
ExplosBlue committed Jul 23, 2023
1 parent ebd7ff4 commit 7533972
Show file tree
Hide file tree
Showing 7 changed files with 171 additions and 30 deletions.
170 changes: 141 additions & 29 deletions .github/workflows/BuildAndRelease.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
name: Build and Release

on:
workflow_dispatch:
push:
branches:
- 'master'
pull_request:
branches:
- 'master'

env:
SOURCE_DIR: ${{ github.workspace }}
Expand All @@ -21,7 +19,7 @@ jobs:
defaults:
run:
shell: cmd

steps:
- name: Checkout repo
uses: actions/checkout@v3
Expand All @@ -35,19 +33,19 @@ jobs:
arch: win64_msvc2019_64
dir: ${{ runner.temp }}
cache: 'true'
cache-key-prefix: 'install-qt-action'
cache-key-prefix: 'install-qt-action-win'
setup-python: false

- name: Download JOM
uses: suisei-cn/[email protected]
with:
url: http://download.qt.io/official_releases/jom/jom.zip
url: http://download.qt.io/official_releases/jom/jom.zip
target: ${{ runner.temp }}\

- name: Unzip JOM
working-directory: ${{ runner.temp }}
run: |
7z x jom.zip -ojom
run: |
7z x jom.zip -ojom
- name: Set up Visual Studio shell
uses: egor-tensin/vs-shell@v2
Expand All @@ -56,56 +54,170 @@ jobs:

- name: Build
working-directory: ${{ runner.temp }}
run: |
mkdir build
cd build
qmake -r ${{ env.SOURCE_DIR }}\CoinKiller.pro
${{ runner.temp }}\jom\jom
run: |
mkdir build
cd build
qmake -r ${{ env.SOURCE_DIR }}\CoinKiller.pro
${{ runner.temp }}\jom\jom
- name: Deploy
working-directory: ${{ runner.temp }}
run: |
mkdir deploy
cd deploy
windeployqt --dir . ${{ runner.temp }}\build\release\CoinKiller.exe --release --no-translations --no-compiler-runtime
xcopy ${{ runner.temp }}\build\release\CoinKiller.exe .
xcopy ${{ env.SOURCE_DIR }}\coinkiller_data coinkiller_data\ /E
xcopy ${{ env.SOURCE_DIR }}\README.md .
xcopy ${{ env.SOURCE_DIR }}\LICENSE .
run: |
mkdir deploy
cd deploy
windeployqt --dir . ${{ runner.temp }}\build\release\CoinKiller.exe --release --no-translations --no-compiler-runtime
xcopy ${{ runner.temp }}\build\release\CoinKiller.exe .
xcopy ${{ env.SOURCE_DIR }}\coinkiller_data coinkiller_data\ /E
xcopy ${{ env.SOURCE_DIR }}\README.md .
xcopy ${{ env.SOURCE_DIR }}\LICENSE .
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: CoinKiller-Windows
path: ${{ runner.temp }}\deploy\

build-macos:
runs-on: macos-latest
defaults:
run:
shell: bash

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ env.QT_VERSION }}
host: mac
target: desktop
arch: clang_64
dir: ${{ runner.temp }}
cache: 'true'
cache-key-prefix: 'install-qt-action-macos'
setup-python: false

- name: Setup xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable

- name: Build
working-directory: ${{ runner.temp }}
run: |
mkdir build
cd build
qmake -r ${{ env.SOURCE_DIR }}/CoinKiller.pro QMAKE_APPLE_DEVICE_ARCHS="x86_64 arm64"
make -j1
- name: Deploy
working-directory: ${{ runner.temp }}/build/
run: |
cp -R ${{ env.SOURCE_DIR }}/coinkiller_data CoinKiller.app/Contents/MacOS/coinkiller_data
macdeployqt CoinKiller.app -dmg
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: CoinKiller-Macos
path: ${{ runner.temp }}/build/CoinKiller.dmg

build-linux:
runs-on: ubuntu-latest
defaults:
run:
shell: bash

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Install dependencies
run: |
sudo apt-get update
sudo add-apt-repository universe
sudo apt-get install -y qt6-base-dev libfuse2
- name: Setup Qt
run: |
qtchooser -install qt6 $(which qmake6)
sudo mv ~/.config/qtchooser/qt6.conf /usr/share/qtchooser/qt6.conf
sudo mkdir -p /usr/lib/$(uname -p)-linux-gnu/qt-default/qtchooser
sudo ln -n /usr/share/qtchooser/qt6.conf /usr/lib/$(uname -p)-linux-gnu/qt-default/qtchooser/default.conf
- name: Build
working-directory: ${{ runner.temp }}
run: |
mkdir build
cd build
qmake -r ${{ env.SOURCE_DIR }}/CoinKiller.pro
make -j$(nproc)
make install INSTALL_ROOT=AppDir
- name: Deploy
working-directory: ${{ runner.temp }}
run: |
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
chmod +x linuxdeploy-x86_64.AppImage
wget https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage
chmod +x linuxdeploy-plugin-qt-x86_64.AppImage
./linuxdeploy-x86_64.AppImage --appdir ${{ runner.temp }}/build/AppDir --plugin qt --output appimage
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: CoinKiller-Linux
path: ${{ runner.temp }}/CoinKiller-x86_64.AppImage

create-release:
runs-on: ubuntu-latest
needs: build-windows
needs: [build-windows, build-macos, build-linux]
defaults:
run:
shell: bash

steps:
- name: Download artifact
- name: Download artifacts (Windows)
uses: actions/download-artifact@v3
with:
name: CoinKiller-Windows
path: ${{ runner.temp }}/CoinKiller-Windows

- name: Download artifacts (Macos)
uses: actions/download-artifact@v3
with:
name: CoinKiller-Macos
path: ${{ runner.temp }}/CoinKiller-Macos

- name: Download artifacts (Linux)
uses: actions/download-artifact@v3
with:
name: CoinKiller-Linux
path: ${{ runner.temp }}/CoinKiller-Linux

- name: Create timestamp
run: |
echo "TIMESTAMP=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
run: |
echo "TIMESTAMP=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Zip artifact
working-directory: ${{ runner.temp }}
run: |
7z a CoinKiller-Windows-${{ env.TIMESTAMP }}.zip ${{ runner.temp }}/CoinKiller-Windows/* -r
run: |
7z a CoinKiller-Windows-x86_64-${{ env.TIMESTAMP }}.zip ${{ runner.temp }}/CoinKiller-Windows/* -r
- name: Rename output Files
run: |
mv ${{ runner.temp }}/CoinKiller-Macos/CoinKiller.dmg ${{ runner.temp }}/CoinKiller-Macos/CoinKiller-MacOS-Universal-${{ env.TIMESTAMP }}.dmg
mv ${{ runner.temp }}/CoinKiller-Linux/CoinKiller-x86_64.AppImage ${{ runner.temp }}/CoinKiller-Linux/CoinKiller-Linux-x86_64-${{ env.TIMESTAMP }}.AppImage
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: Automated-${{ env.TIMESTAMP }}
generate_release_notes: true
body: Automated release created on ${{ env.TIMESTAMP }}
files: ${{ runner.temp }}/*.zip

files: |
${{ runner.temp }}/*.zip
${{ runner.temp }}/CoinKiller-Macos/*.dmg
${{ runner.temp }}/CoinKiller-Linux/*.AppImage
22 changes: 21 additions & 1 deletion CoinKiller.pro
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,29 @@ greaterThan(QT_MAJOR_VERSION, 5) {
}

TARGET = CoinKiller
RC_FILE = ck_icon.rc
RC_FILE = resource/ck_icon.rc
ICON = resource/app.icns
TEMPLATE = app

linux-g++ {
isEmpty(PREFIX) {
PREFIX = /usr
}
target.path = $$PREFIX/bin

ck_data.path = $$PREFIX/bin/coinkiller_data
ck_data.files += coinkiller_data/*
desktop.path = $$PREFIX/share/applications/
desktop.files += resource/coinkiller.desktop
icon512.path = $$PREFIX/share/icons/hicolor/512x512/apps
icon512.files += resource/ck_icon.png

INSTALLS += icon512
INSTALLS += desktop
INSTALLS += ck_data
INSTALLS += target
}

SOURCES += main.cpp\
eventeditorwidget.cpp \
mainwindow.cpp \
Expand Down
Binary file added resource/app.icns
Binary file not shown.
File renamed without changes.
File renamed without changes
File renamed without changes.
9 changes: 9 additions & 0 deletions resource/coinkiller.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Desktop Entry]
Type=Application
Name=CoinKiller
Comment=A level editor for New Super Mario Bros. 2
Exec=CoinKiller
Icon=ck_icon
Terminal=false
Categories=Development;
Keywords=nsmb2;level-editor;mario;

0 comments on commit 7533972

Please sign in to comment.