2021-01-13 18:09:15 -05:00

217 lines
6.2 KiB
YAML

#--------------------------------------------------------------------------------
# Workflow configuration
#--------------------------------------------------------------------------------
name: Build
on:
push: # Run on push
paths-ignore: # File patterns to ignore
- '**.md' # Ignore changes to *.md files
pull_request: # Run on pull-request
paths-ignore: # File-patterns to ignore
- '**.md' # Ignore changes to *.md files
#--------------------------------------------------------------------------------
# Define application name & version
#--------------------------------------------------------------------------------
env:
EXE_NAME: "SerialStudio"
PRO_FILE: "Serial-Studio.pro"
APP_NAME: "Serial Studio"
APP_VERSION: "1.0.6"
APP_QMLDIR: "assets/qml"
APP_QMLDIR_WINDOWS: "..\\..\\..\\assets\\qml"
#--------------------------------------------------------------------------------
# Workflow jobs (GNU/Linux, macOS & Windows)
#--------------------------------------------------------------------------------
jobs:
#
# GNU/Linux build (we run on Ubuntu 16.04 to generate AppImage)
#
build-linux:
runs-on: ubuntu-16.04
steps:
#
# Checkout the repository
#
- name: Checkout repository
uses: actions/checkout@v2
#
# Install Qt
#
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
modules: qtcharts
#
# Install additional dependencies, stolen from:
# https://github.com/mapeditor/tiled/blob/master/.github/workflows/packages.yml
#
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install libgl1-mesa-dev libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-render-util0 libxcb-xinerama0 libzstd-dev
#
# Compile the application
#
- name: Compile
run: |
qmake ${PRO_FILE} CONFIG+=release PREFIX=/usr
make -j8
#
# Create the AppImage
#
- name: Create AppImage
run: |
make INSTALL_ROOT=appdir install
wget -c -nv "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage" -O linuxdeployqt
chmod a+x linuxdeployqt
./linuxdeployqt appdir/usr/share/applications/*.desktop -appimage -bundle-non-qt-libs -extra-plugins=imageformats/libqsvg.so -qmldir=${APP_QMLDIR}
#
# Rename AppImage to match "%AppName%-%Version%-Linux.AppImage" format
#
- name: Rename AppImage
run: mv *.AppImage ${EXE_NAME}-${APP_VERSION}-Linux.AppImage
#
# Upload AppImage to build artifacts
#
- name: Upload AppImage
uses: actions/upload-artifact@v2
with:
name: ${{ env.EXE_NAME }}-${{ env.APP_VERSION }}-Linux.AppImage
path: ${{ env.EXE_NAME }}-${{ env.APP_VERSION }}-Linux.AppImage
#
# macOS build
#
build-mac:
runs-on: macos-latest
steps:
#
# Checkout the repository
#
- name: Checkout repository
uses: actions/checkout@v2
#
# Install Qt
#
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
modules: qtcharts
#
# Compile application
#
- name: Compile
run: |
qmake ${PRO_FILE} CONFIG+=release
make -j8
#
# Deploy application
#
- name: Deploy app
run: |
macdeployqt ${EXE_NAME}.app -qmldir=${APP_QMLDIR}
mv "${EXE_NAME}.app" "${APP_NAME}.app"
#
# ZIP application "%AppName%-%Version%-macOS.zip"
# We use ditto instead of zip to use the same commands as Finder
#
- name: Create ZIP file
run: |
ditto -c -k --sequesterRsrc --keepParent "${APP_NAME}.app" ${EXE_NAME}-${APP_VERSION}-macOS.zip
#
# Upload ZIP to build artifacts
#
- name: Upload ZIP
uses: actions/upload-artifact@v2
with:
name: ${{ env.EXE_NAME }}-${{ env.APP_VERSION }}-macOS.zip
path: ${{ env.EXE_NAME }}-${{ env.APP_VERSION }}-macOS.zip
#
# Windows build
#
build-windows:
runs-on: windows-latest
steps:
#
# Checkout the repository
#
- name: Checkout repository
uses: actions/checkout@v2
#
# Install Qt (win64_mingw81)
#
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
modules: qtcharts
arch: win64_mingw81
#
# Compile application
#
- name: Compile
run: |
qmake ${PRO_FILE} CONFIG+=release
mingw32-make -j8
#
# Create deploy directory and copy binary & NSIS files
#
- name: Deploy
run: |
mkdir "windeploy\\${APP_NAME}\\bin"
xcopy "release\\${EXE_NAME}.exe" "windeploy\\${APP_NAME}\\bin"
xcopy deploy\windows\nsis\setup.nsi windeploy
xcopy deploy\windows\nsis\license.txt windeploy
cd "windeploy\\${APP_NAME}\\bin"
windeployqt ${EXE_NAME}.exe -qmldir="${APP_QMLDIR_WINDOWS}"
cd ..
cd ..
#
# Install NSIS
#
- name: Install NSIS
run: |
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
scoop bucket add extras
scoop install nsis
#
# Create NSIS installer
#
- name: Make NSIS installer
run: |
makensis /X"SetCompressor /FINAL lzma" setup.nsi
ren *.exe ${EXE_NAME}-${APP_VERSION}-Windows.exe
move *.exe ../
cd ..
#
# Upload installer to build artifacts
#
- name: Upload NSIS installer
uses: actions/upload-artifact@v2
with:
name: ${{ env.EXE_NAME }}-${{ env.APP_VERSION }}-Windows.exe
path: ${{ env.EXE_NAME }}-${{ env.APP_VERSION }}-Windows.exe