217 lines
6.2 KiB
YAML
Raw Normal View History

2021-01-11 00:18:30 -05:00
#--------------------------------------------------------------------------------
# Workflow configuration
#--------------------------------------------------------------------------------
2020-12-25 00:02:06 -06:00
name: Build
2021-01-10 22:39:23 -05:00
on:
2021-01-11 00:18:30 -05:00
push: # Run on push
paths-ignore: # File patterns to ignore
- '**.md' # Ignore changes to *.md files
2021-01-10 22:39:23 -05:00
2021-01-11 00:18:30 -05:00
pull_request: # Run on pull-request
paths-ignore: # File-patterns to ignore
- '**.md' # Ignore changes to *.md files
#--------------------------------------------------------------------------------
# Define application name & version
#--------------------------------------------------------------------------------
env:
2021-01-13 18:09:15 -05:00
EXE_NAME: "SerialStudio"
2021-01-12 00:23:03 -05:00
PRO_FILE: "Serial-Studio.pro"
2021-01-13 18:09:15 -05:00
APP_NAME: "Serial Studio"
APP_VERSION: "1.0.6"
2021-01-12 00:23:03 -05:00
APP_QMLDIR: "assets/qml"
APP_QMLDIR_WINDOWS: "..\\..\\..\\assets\\qml"
2021-01-11 00:18:30 -05:00
#--------------------------------------------------------------------------------
# Workflow jobs (GNU/Linux, macOS & Windows)
#--------------------------------------------------------------------------------
2020-12-24 23:29:05 -06:00
jobs:
2021-01-11 00:18:30 -05:00
#
# GNU/Linux build (we run on Ubuntu 16.04 to generate AppImage)
#
2020-12-24 23:34:12 -06:00
build-linux:
2021-01-10 22:39:23 -05:00
runs-on: ubuntu-16.04
2020-12-24 23:29:05 -06:00
steps:
2021-01-11 00:18:30 -05:00
#
# Checkout the repository
#
2021-01-10 23:01:02 -05:00
- name: Checkout repository
uses: actions/checkout@v2
2020-12-24 23:54:11 -06:00
2021-01-11 00:18:30 -05:00
#
# Install Qt
#
2020-12-24 23:54:11 -06:00
- name: Install Qt
uses: jurplel/install-qt-action@v2
2021-01-10 23:04:49 -05:00
with:
modules: qtcharts
2021-01-10 22:39:23 -05:00
2021-01-11 00:18:30 -05:00
#
# Install additional dependencies, stolen from:
# https://github.com/mapeditor/tiled/blob/master/.github/workflows/packages.yml
#
2021-01-10 22:39:23 -05:00
- name: Install dependencies
2021-01-10 23:01:02 -05:00
run: |
sudo apt-get update
2021-01-10 22:50:50 -05:00
sudo apt-get install libgl1-mesa-dev libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-render-util0 libxcb-xinerama0 libzstd-dev
2020-12-24 23:54:11 -06:00
2021-01-11 00:18:30 -05:00
#
# Compile the application
#
2021-01-10 23:01:02 -05:00
- name: Compile
run: |
2021-01-11 00:20:43 -05:00
qmake ${PRO_FILE} CONFIG+=release PREFIX=/usr
2021-01-10 23:10:42 -05:00
make -j8
2021-01-10 23:01:02 -05:00
2021-01-11 00:18:30 -05:00
#
# Create the AppImage
#
2021-01-10 23:01:02 -05:00
- name: Create AppImage
run: |
2021-01-10 23:10:42 -05:00
make INSTALL_ROOT=appdir install
2021-01-10 22:50:50 -05:00
wget -c -nv "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage" -O linuxdeployqt
chmod a+x linuxdeployqt
2021-01-11 00:28:26 -05:00
./linuxdeployqt appdir/usr/share/applications/*.desktop -appimage -bundle-non-qt-libs -extra-plugins=imageformats/libqsvg.so -qmldir=${APP_QMLDIR}
2021-01-11 00:18:30 -05:00
#
# Rename AppImage to match "%AppName%-%Version%-Linux.AppImage" format
#
- name: Rename AppImage
2021-01-13 18:09:15 -05:00
run: mv *.AppImage ${EXE_NAME}-${APP_VERSION}-Linux.AppImage
2021-01-11 00:18:30 -05:00
#
2021-01-12 01:58:31 -05:00
# Upload AppImage to build artifacts
2021-01-11 00:18:30 -05:00
#
2021-01-12 01:58:31 -05:00
- name: Upload AppImage
2021-01-10 22:39:23 -05:00
uses: actions/upload-artifact@v2
with:
2021-01-13 18:09:15 -05:00
name: ${{ env.EXE_NAME }}-${{ env.APP_VERSION }}-Linux.AppImage
path: ${{ env.EXE_NAME }}-${{ env.APP_VERSION }}-Linux.AppImage
2021-01-10 22:39:23 -05:00
2021-01-11 00:18:30 -05:00
#
# macOS build
#
2020-12-25 21:17:44 -06:00
build-mac:
runs-on: macos-latest
steps:
2021-01-11 00:18:30 -05:00
#
# Checkout the repository
#
2021-01-10 23:01:02 -05:00
- name: Checkout repository
uses: actions/checkout@v2
2020-12-25 21:17:44 -06:00
2021-01-11 00:18:30 -05:00
#
# Install Qt
#
2020-12-25 21:17:44 -06:00
- name: Install Qt
uses: jurplel/install-qt-action@v2
2021-01-10 23:04:49 -05:00
with:
modules: qtcharts
2021-01-11 00:18:30 -05:00
#
# Compile application
#
2020-12-25 21:17:44 -06:00
- name: Compile
2021-01-10 23:01:02 -05:00
run: |
2021-01-11 00:20:43 -05:00
qmake ${PRO_FILE} CONFIG+=release
2021-01-11 00:18:30 -05:00
make -j8
2021-01-12 01:11:23 -05:00
#
# Deploy application
#
- name: Deploy app
run: |
2021-01-13 18:09:15 -05:00
macdeployqt ${EXE_NAME}.app -qmldir=${APP_QMLDIR}
mv "${EXE_NAME}.app" "${APP_NAME}.app"
2021-01-11 00:18:30 -05:00
#
2021-01-12 01:33:12 -05:00
# ZIP application "%AppName%-%Version%-macOS.zip"
# We use ditto instead of zip to use the same commands as Finder
2021-01-11 00:18:30 -05:00
#
2021-01-12 01:33:12 -05:00
- name: Create ZIP file
2021-01-11 23:49:42 -05:00
run: |
2021-01-13 18:09:15 -05:00
ditto -c -k --sequesterRsrc --keepParent "${APP_NAME}.app" ${EXE_NAME}-${APP_VERSION}-macOS.zip
2021-01-11 00:18:30 -05:00
#
2021-01-12 01:50:26 -05:00
# Upload ZIP to build artifacts
2021-01-11 00:18:30 -05:00
#
2021-01-12 01:50:26 -05:00
- name: Upload ZIP
2021-01-10 22:39:23 -05:00
uses: actions/upload-artifact@v2
with:
2021-01-13 18:09:15 -05:00
name: ${{ env.EXE_NAME }}-${{ env.APP_VERSION }}-macOS.zip
path: ${{ env.EXE_NAME }}-${{ env.APP_VERSION }}-macOS.zip
#
# Windows build
#
build-windows:
2021-01-13 17:22:19 -05:00
runs-on: windows-latest
steps:
#
# Checkout the repository
#
- name: Checkout repository
uses: actions/checkout@v2
#
2021-01-13 16:44:26 -05:00
# Install Qt (win64_mingw81)
#
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
modules: qtcharts
2021-01-13 16:44:26 -05:00
arch: win64_mingw81
#
# Compile application
#
- name: Compile
run: |
qmake ${PRO_FILE} CONFIG+=release
2021-01-13 17:22:19 -05:00
mingw32-make -j8
#
2021-01-13 16:33:44 -05:00
# Create deploy directory and copy binary & NSIS files
#
2021-01-13 16:33:44 -05:00
- name: Deploy
run: |
2021-01-13 18:09:15 -05:00
mkdir "windeploy\\${APP_NAME}\\bin"
xcopy "release\\${EXE_NAME}.exe" "windeploy\\${APP_NAME}\\bin"
2021-01-13 18:04:02 -05:00
xcopy deploy\windows\nsis\setup.nsi windeploy
xcopy deploy\windows\nsis\license.txt windeploy
2021-01-13 18:09:15 -05:00
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
2021-01-13 18:09:15 -05:00
ren *.exe ${EXE_NAME}-${APP_VERSION}-Windows.exe
2021-01-13 17:39:12 -05:00
move *.exe ../
2021-01-13 17:49:47 -05:00
cd ..
#
# Upload installer to build artifacts
#
2021-01-13 16:33:44 -05:00
- name: Upload NSIS installer
uses: actions/upload-artifact@v2
with:
2021-01-13 18:09:15 -05:00
name: ${{ env.EXE_NAME }}-${{ env.APP_VERSION }}-Windows.exe
path: ${{ env.EXE_NAME }}-${{ env.APP_VERSION }}-Windows.exe