mirror of
https://github.com/Serial-Studio/Serial-Studio.git
synced 2025-01-15 05:22:53 +08:00
299 lines
8.8 KiB
YAML
299 lines
8.8 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
|
|
|
|
workflow_dispatch:
|
|
|
|
#--------------------------------------------------------------------------------
|
|
# Define application name & version
|
|
#--------------------------------------------------------------------------------
|
|
|
|
env:
|
|
VERSION: "1.0.24"
|
|
EXECUTABLE: "SerialStudio"
|
|
APPLICATION: "Serial Studio"
|
|
QMAKE_PROJECT: "Serial-Studio.pro"
|
|
QML_DIR_NIX: "assets/qml"
|
|
QML_DIR_WIN: "assets\\qml"
|
|
QT_VERSION: 6.2.0
|
|
|
|
#--------------------------------------------------------------------------------
|
|
# Workflow jobs (GNU/Linux, macOS & Windows)
|
|
#--------------------------------------------------------------------------------
|
|
|
|
jobs:
|
|
|
|
|
|
# GNU/Linux build (we run on Ubuntu 16.04 to generate AppImage)
|
|
build-linux:
|
|
if: ${{ false }} # disable for now
|
|
runs-on: ubuntu-18.04
|
|
name: '🐧 Ubuntu 18.04'
|
|
steps:
|
|
|
|
- name: '🧰 Checkout'
|
|
uses: actions/checkout@v2
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: '⚙️ Cache Qt'
|
|
id: cache-qt
|
|
uses: actions/cache@v1
|
|
with:
|
|
path: ../Qt
|
|
key: ${{runner.os}}-QtCache-5.12.2
|
|
|
|
- name: '⚙️ Install Qt'
|
|
uses: jurplel/install-qt-action@v2
|
|
with:
|
|
version: ${{env.QT_VERSION}}
|
|
cached: ${{steps.cache-qt.outputs.cache-hit}}
|
|
|
|
# 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
|
|
|
|
- name: '🚧 Compile application'
|
|
run: |
|
|
qmake ${{env.QMAKE_PROJECT}} CONFIG+=release PREFIX=/usr
|
|
make -j8
|
|
|
|
- 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="${{env.QML_DIR_NIX}}"
|
|
|
|
# Rename AppImage to match "%AppName%-%Version%-Linux.AppImage" format
|
|
mv *.AppImage ${{env.EXECUTABLE}}-${{env.VERSION}}-Linux.AppImage
|
|
|
|
- name: '📤 Upload artifact: AppImage'
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: ${{env.EXECUTABLE}}-${{env.VERSION}}-Linux.AppImage
|
|
path: ${{env.EXECUTABLE}}-${{env.VERSION}}-Linux.AppImage
|
|
|
|
|
|
# macOS build
|
|
build-mac:
|
|
runs-on: macos-latest
|
|
name: '🍎 macOS'
|
|
steps:
|
|
|
|
- name: '🧰 Checkout'
|
|
uses: actions/checkout@v2
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: '⚙️ Cache Qt'
|
|
id: cache-qt
|
|
uses: actions/cache@v1
|
|
with:
|
|
path: ../Qt
|
|
key: ${{runner.os}}-QtCache-5.12.2
|
|
|
|
- name: '⚙️ Install Qt'
|
|
uses: jurplel/install-qt-action@v2
|
|
with:
|
|
version: ${{env.QT_VERSION}}
|
|
modules: qtserialport
|
|
cached: ${{steps.cache-qt.outputs.cache-hit}}
|
|
|
|
- name: '🚧 Compile application'
|
|
run: |
|
|
qmake6 ${{env.QMAKE_PROJECT}} CONFIG+=release
|
|
make -j8
|
|
|
|
- name: '📦 Package application (macdeployqt and zipfile)'
|
|
run: |
|
|
macdeployqt ${{env.EXECUTABLE}}.app -qmldir="${{env.QML_DIR_NIX}}"
|
|
mv "${{env.EXECUTABLE}}.app" "${{env.APPLICATION}}.app"
|
|
|
|
# ZIP application "%AppName%-%Version%-macOS.zip"
|
|
# We use ditto instead of zip to use the same commands as Finder
|
|
ditto -c -k --sequesterRsrc --keepParent "${{env.APPLICATION}}.app" ${{env.EXECUTABLE}}-${{env.VERSION}}-macOS.zip
|
|
|
|
- name: '📤 Upload artifact: ZIP'
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: ${{env.EXECUTABLE}}-${{env.VERSION}}-macOS.zip
|
|
path: ${{env.EXECUTABLE}}-${{env.VERSION}}-macOS.zip
|
|
|
|
|
|
# Windows build
|
|
build-windows:
|
|
if: ${{ false }} # disable for now
|
|
runs-on: windows-latest
|
|
name: '🧊 Windows'
|
|
steps:
|
|
|
|
- name: '🧰 Checkout'
|
|
uses: actions/checkout@v2
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: '⚙️ Configure MSVC'
|
|
uses: ilammy/msvc-dev-cmd@v1
|
|
with:
|
|
arch: x64
|
|
spectre: true
|
|
|
|
- name: '⚙️ Cache Qt'
|
|
id: cache-qt
|
|
uses: actions/cache@v1
|
|
with:
|
|
path: ../Qt
|
|
key: ${{runner.os}}-QtCache-5.12.2
|
|
|
|
- name: '⚙️ Install Qt'
|
|
uses: jurplel/install-qt-action@v2
|
|
with:
|
|
version: ${{env.QT_VERSION}}
|
|
cached: ${{steps.cache-qt.outputs.cache-hit}}
|
|
|
|
- name: '⚙️ Install NSIS'
|
|
run: |
|
|
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
|
|
scoop bucket add extras
|
|
scoop install nsis
|
|
|
|
- name: '🚧 Compile application'
|
|
run: |
|
|
qmake ${{env.QMAKE_PROJECT}} CONFIG+=release
|
|
nmake
|
|
|
|
# Copy Qt DLLs, compiler runtime & application icon
|
|
- name: '📦 Package application (windeployqt)'
|
|
run: |
|
|
mkdir bin
|
|
move release/${{env.EXECUTABLE}}.exe bin
|
|
windeployqt bin/${{env.EXECUTABLE}}.exe -qmldir="${{env.QML_DIR_WIN}}" --compiler-runtime
|
|
mkdir "${{env.APPLICATION}}"
|
|
move bin "${{env.APPLICATION}}"
|
|
xcopy deploy\windows\resources\icon.ico "${{env.APPLICATION}}"
|
|
xcopy deploy\windows\openssl\*.dll "${{env.APPLICATION}}\bin"
|
|
|
|
- name: '📦 Make NSIS installer'
|
|
run: |
|
|
move "${{env.APPLICATION}}" deploy\windows\nsis\
|
|
cd deploy\windows\nsis
|
|
makensis /X"SetCompressor /FINAL lzma" setup.nsi
|
|
ren *.exe ${{env.EXECUTABLE}}-${{env.VERSION}}-Windows.exe
|
|
|
|
- name: '📤 Upload artifact: NSIS installer'
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: ${{env.EXECUTABLE}}-${{env.VERSION}}-Windows.exe
|
|
path: deploy/windows/nsis/${{env.EXECUTABLE}}-${{env.VERSION}}-Windows.exe
|
|
|
|
|
|
# Windows MSYS2 build
|
|
msys2-makepkg:
|
|
if: ${{ false }} # disable for now
|
|
runs-on: windows-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- { icon: '🟪', msystem: MINGW64, arch: x86_64 }
|
|
- { icon: '🟦', msystem: MINGW32, arch: i686 }
|
|
name: ${{ matrix.icon }} ${{ matrix.msystem }} | ${{ matrix.arch }} | makepkg
|
|
defaults:
|
|
run:
|
|
shell: msys2 {0}
|
|
steps:
|
|
|
|
- run: git config --global core.autocrlf input
|
|
shell: bash
|
|
|
|
- name: '🧰 Checkout'
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
submodules: recursive
|
|
|
|
- name: '${{ matrix.icon }} Setup MSYS2'
|
|
uses: msys2/setup-msys2@v2
|
|
with:
|
|
msystem: ${{ matrix.msystem }}
|
|
update: true
|
|
install: >
|
|
base-devel
|
|
mingw-w64-${{ matrix.arch }}-toolchain
|
|
|
|
- name: '🚧 Build'
|
|
run: |
|
|
cd msys2
|
|
tries=0
|
|
# Try building three times due to the arbitrary 'Bad address' error
|
|
while [ $tries -lt 3 ]; do
|
|
makepkg-mingw --noconfirm --noprogressbar -sCLf && break || tries=$((tries+1))
|
|
done
|
|
|
|
env:
|
|
MINGW_INSTALLS: ${{ matrix.msystem }}
|
|
|
|
- name: '📤 Upload artifact: MSYS2 ${{ matrix.arch }} package'
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: msys2-pkgs
|
|
path: msys2/*.zst
|
|
|
|
# Test Windows MSYS2 packages
|
|
msys2-test:
|
|
if: ${{ false }} # disable for now
|
|
needs: msys2-makepkg
|
|
runs-on: windows-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- { icon: '🟪', msystem: MINGW64, arch: x86_64 }
|
|
- { icon: '🟦', msystem: MINGW32, arch: i686 }
|
|
name: ${{ matrix.icon }} ${{ matrix.msystem }} | ${{ matrix.arch }} | Test
|
|
defaults:
|
|
run:
|
|
shell: msys2 {0}
|
|
steps:
|
|
|
|
- name: '${{ matrix.icon }} Setup MSYS2'
|
|
uses: msys2/setup-msys2@v2
|
|
with:
|
|
msystem: ${{ matrix.msystem }}
|
|
update: true
|
|
install: >
|
|
tree
|
|
tar
|
|
zstd
|
|
|
|
- name: '📥 Download artifacts: MSYS2 packages'
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: msys2-pkgs
|
|
|
|
- name: 'Install MSYS2 package'
|
|
run: |
|
|
pacman -U --noconfirm --noprogressbar *${{ matrix.arch }}*.zst
|
|
|
|
- name: 'List contents of package'
|
|
run: |
|
|
mkdir tmp
|
|
cd tmp
|
|
/usr/bin/tar xf ../*${{ matrix.arch }}*.zst
|
|
tree ${{ matrix.msystem }}
|