2021-01-12 00:57:20 -05:00

145 lines
4.4 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:
APP_NAME: "SerialStudio"
PRO_FILE: "Serial-Studio.pro"
NICE_APP_NAME: "Serial Studio"
APP_VERSION: "1.0.5"
APP_QMLDIR: "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 ${APP_NAME}-${APP_VERSION}-Linux.AppImage
#
# Upload AppImage to build artifacts
#
- name: Upload AppImage
uses: actions/upload-artifact@v2
with:
name: ${{ env.APP_NAME }}-${{ env.APP_VERSION }}-Linux.AppImage
path: ${{ env.APP_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
#
# Install "create-dmg" with homebrew, we need it later
#
- name: Install create-dmg
run: brew install create-dmg
#
# Compile application
#
- name: Compile
run: |
qmake ${PRO_FILE} CONFIG+=release
make -j8
#
# Create DMG file & rename it to "%AppName%-%Version%-macOS.dmg"
#
- name: Create DMG
run: |
macdeployqt ${APP_NAME}.app -qmldir=${APP_QMLDIR}
mv "${APP_NAME}.app" "${NICE_APP_NAME}.app"
create-dmg --volname ${APP_NAME} --background deploy/macOS/dmg_bg.png --icon ${APP_NAME} 150 218 --window-pos 200 120 --window-size 600 450 --icon-size 100 --hdiutil-quiet --app-drop-link 450 218 ${APP_NAME} "${NICE_APP_NAME}"
mv *.dmg ${APP_NAME}-${APP_VERSION}-macOS.dmg
#
# Upload DMG to build artifacts
#
- name: Upload DMG
uses: actions/upload-artifact@v2
with:
name: ${{ env.APP_NAME }}-${{ env.APP_VERSION }}-macOS.dmg
path: ${{ env.APP_NAME }}-${{ env.APP_VERSION }}-macOS.dmg