222 lines
6.3 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:
VERSION: "1.0.6"
EXECUTABLE: "SerialStudio"
APPLICATION: "Serial Studio"
QMAKE_PROJECT: "Serial-Studio.pro"
2021-01-13 21:50:34 -05:00
QML_DIR_NIX: "assets/qml"
QML_DIR_WIN: "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: |
qmake ${{env.QMAKE_PROJECT}} 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-13 21:50:34 -05:00
./linuxdeployqt appdir/usr/share/applications/*.desktop -appimage -bundle-non-qt-libs -extra-plugins=imageformats/libqsvg.so -qmldir="${{env.QML_DIR_NIX}}"
2021-01-11 00:18:30 -05:00
#
# Rename AppImage to match "%AppName%-%Version%-Linux.AppImage" format
#
- name: Rename AppImage
run: mv *.AppImage ${{env.EXECUTABLE}}-${{env.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:
name: ${{env.EXECUTABLE}}-${{env.VERSION}}-Linux.AppImage
path: ${{env.EXECUTABLE}}-${{env.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: |
qmake ${{env.QMAKE_PROJECT}} 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 21:50:34 -05:00
macdeployqt ${{env.EXECUTABLE}}.app -qmldir="${{env.QML_DIR_NIX}}"
mv "${{env.EXECUTABLE}}.app" "${{env.APPLICATION}}.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: |
ditto -c -k --sequesterRsrc --keepParent "${{env.APPLICATION}}.app" ${{env.EXECUTABLE}}-${{env.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:
name: ${{env.EXECUTABLE}}-${{env.VERSION}}-macOS.zip
path: ${{env.EXECUTABLE}}-${{env.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 21:03:17 -05:00
#
# Configure MSVC
#
- name: Configure MSVC
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
spectre: true
#
# Install Qt
#
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
modules: qtcharts
2021-01-13 18:34:22 -05:00
#
# 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
2021-01-13 21:03:17 -05:00
#
# Compile application
#
- name: Compile
run: |
2021-01-13 19:00:35 -05:00
qmake ${{env.QMAKE_PROJECT}} CONFIG+=release
2021-01-13 20:14:36 -05:00
nmake
#
2021-01-13 18:34:22 -05:00
# Deploy Qt DLLs to release directory
#
2021-01-13 16:33:44 -05:00
- name: Deploy
run: |
2021-01-13 21:24:51 -05:00
mkdir bin
2021-01-13 21:46:16 -05:00
move release/${{env.EXECUTABLE}}.exe bin
2021-01-13 21:50:34 -05:00
windeployqt bin/${{env.EXECUTABLE}}.exe -qmldir="${{env.QML_DIR_WIN}}" --compiler-runtime
mkdir "${{env.APPLICATION}}"
move bin "${{env.APPLICATION}}"
#
# Create NSIS installer
#
- name: Make NSIS installer
run: |
move "${{env.APPLICATION}}" deploy\windows\nsis\
2021-01-13 18:45:02 -05:00
cd deploy\windows\nsis
makensis /X"SetCompressor /FINAL lzma" setup.nsi
ren *.exe ${{env.EXECUTABLE}}-${{env.VERSION}}-Windows.exe
#
# Upload installer to build artifacts
#
2021-01-13 16:33:44 -05:00
- name: Upload NSIS installer
uses: actions/upload-artifact@v2
with:
name: ${{env.EXECUTABLE}}-${{env.VERSION}}-Windows.exe
2021-01-13 19:00:35 -05:00
path: deploy/windows/nsis/${{env.EXECUTABLE}}-${{env.VERSION}}-Windows.exe