Skip to content

Commit

Permalink
Merge pull request #228 from mhitza/consolidate-ci-pipelines
Browse files Browse the repository at this point in the history
Consolidate CI pipelines
  • Loading branch information
slspencer committed Jun 6, 2020
2 parents 965ab61 + 4f1f80f commit c19066e
Show file tree
Hide file tree
Showing 10 changed files with 307 additions and 400 deletions.
84 changes: 0 additions & 84 deletions #1#travis.log

This file was deleted.

47 changes: 47 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# GitHub Workflows Overview

There are three distinct GitHub workflows:

[build-weekly-release.yml](build-weekly-release.yml) - triggers on a cron schedule (every Monday at 00:00/12 AM) and creates a `weekly-*` tag, then proceeds to build the application and packages.

[build-release-assets](build-release-assets.yml) - triggers when a release is created manually, or through an API. Does not trigger for the release created by the `build-weekly-release.yml` workflow. That is because a release created by a workflow does not emit by design events which could trigger other workflows. Switching from the GITHUB\_TOKEN to a personal action token should disable this behavior.

[pull-request.yml](pull-request.yml) - triggers as a pull request check, builds, and tests on the `ubuntu-latest` runner.


---
1. Setup
1.1 `actions/create-release` - outputs the upload url for the new release
1.3 [Install Qt](#iq)
1.4 [Enable Developer Command Prompt](#edcp)
2. Packaging & Distribution
2.1 [AppImages](#ai)
2.2 [Nullsoft Scriptable Install System](#nsis)
2.3 Code Signing - signs the windows installer using `signtool.exe`
2.4 `actions/upload-release-asset` - annoyingly can't infer the content type by itself

## Setup

### <a id="iq"></a>[Install Qt](https://github.com/marketplace/actions/install-qt)

Referenced as `jurplel/install-qt-action`, installs the Qt platform across all the three different runners (ubuntu-latest, macos-latest, windows-latest) consistently. Internally it uses the [aqtinstall](jurplel/install-qt-action@v2) installer written in Python. Worth knowing if those errors propagate up through the GitHub action.

### <a id="edcp"></a>[Enable Developer Command Prompt](https://github.com/marketplace/actions/enable-developer-command-prompt)

Referenced as `ilammy/msvc-dev-cmd`, sets up the command line environment on the windows-latest runner (`PATH` and such) to expose Microsoft Visual C++.

## Packaging & Distribution

### <a id="ai"></a>AppImages

To build [Linux AppImages](https://appimage.org/) this project uses [linuxdeployqt](https://github.com/probonopd/linuxdeployqt).

However, `linuxdeployqt` enforces a strict Glibc version on the target system it's running on (for portability reasons)[1]. At this moment that specific version is the same as the version on Ubuntu 16.04. While there is a Ubuntu 16.04 runner in GitHub, for consistency the workflows run on ubuntu-latest (Ubuntu 18.04 at this point). And to run the `linuxdeployqt` library, a docker container is used, built from the following [Dockerfile](https://github.com/mhitza/docker-linuxdeployqt/blob/master/Dockerfile).

The container is pulled from the docker registry instead of building it during the run for performance reasons. In the grand scheme of things, it might save a minute or two within the workflow, which seems insignificant when the builds take over 20 minutes on average. If this makes maintenance harder, it should be switched over.

### <a id="nsis"></a>[Nullsoft Scriptable Install System](https://nsis.sourceforge.io/Main_Page)

Or NSIS for short, builds the Windows installer using the [seamly2d-installer.nsi](/dist/seamly2d-installer.nsi) script file. As of this moment, the script includes steps for setting up a start menu group and configuration necessary to provide an uninstaller.


179 changes: 179 additions & 0 deletions .github/workflows/build-release-assets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
name: Build release assets

on:
release:
types: [ published ]

env:
UPLOAD_URL: ${{ github.event.release.upload_url }}

QT_SELECT: 5

# See https://wiki.qt.io/Qt_5.13_Release
# The project is currently incompatible with Qt-5.15/5.14.2
# When chaning the version information in this file be sure to change it in
# pull-request.yml, build-weekly-release as well
QT_VERSION: '5.13.2' # quotes required or YAML parser will interpret as float


jobs:
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: jurplel/install-qt-action@v2
with:
version: ${{ env.QT_VERSION }}

- name: build
run: |
mkdir /home/runner/local
qmake PREFIX=/home/runner/local Seamly2D.pro -r CONFIG+=no_ccache CONFIG+=noDebugSymbols
make
make install
- name: tar.gz package
run: |
tar cfz linux.tar.gz /home/runner/local
- name: upload linux.tar.gz
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: ./linux.tar.gz
asset_name: linux-build.tar.gz
asset_content_type: application/gzip


# the AppImage bundler relies on fuse during packaging
- name: install AppImage system dependency
run: |
sudo apt update
sudo apt install fuse
- name: AppImages
run: |
mkdir -p /home/runner/local/share/applications /home/runner/local/share/icons/hicolor/256x256
cp dist/seamly2d.desktop /home/runner/local/share/applications/
cp share/img/Seamly2D_logo_254x254.png /home/runner/local/share/icons/hicolor/256x256/seamly2d.png
docker run --cap-add SYS_ADMIN --device /dev/fuse \
--security-opt apparmor:unconfined --security-opt seccomp=unconfined \
-v /home/runner/local:/app/usr \
--rm mhitza/linuxdeployqt:5.13.2
mv /home/runner/local/Seamly2D*.AppImage Seamly2D.AppImage
cp share/img/Seamly2D_logo_254x254.png /home/runner/local/share/icons/hicolor/256x256/seamlyme.png
rm /home/runner/local/share/applications/seamly2d.desktop
cp dist/seamlyme.desktop /home/runner/local/share/applications
docker run --cap-add SYS_ADMIN --device /dev/fuse \
--security-opt apparmor:unconfined --security-opt seccomp=unconfined \
-v /home/runner/local:/app/usr \
--rm mhitza/linuxdeployqt:5.13.2
mv /home/runner/local/SeamlyMe*.AppImage SeamlyMe.AppImage
- name: upload Seamly2D.AppImage
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: ./Seamly2D.AppImage
asset_name: Seamly2D.AppImage
asset_content_type: application/octet-stream

- name: upload SeamlyMe.AppImage
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: ./SeamlyMe.AppImage
asset_name: SeamlyMe.AppImage
asset_content_type: application/octet-stream

macos:
runs-on: macos-latest

steps:
- uses: actions/checkout@v2
- uses: jurplel/install-qt-action@v2
with:
version: ${{ env.QT_VERSION }}

- name: build
run: |
qmake Seamly2D.pro -r CONFIG+=no_ccache CONFIG+=noDebugSymbols
make
- name: build dmg packages
run: |
hdiutil create -fs HFS+ -srcfolder src/app/seamly2d/bin/Seamly2D.app -volname "Seamly2D" Seamly2D.dmg
hdiutil create -fs HFS+ -srcfolder src/app/seamlyme/bin/seamlyme.app -volname "SeamlyME" SeamlyME.dmg
- name: upload Seamly2D.dmg
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: ./Seamly2D.dmg
asset_name: Seamly2D.dmg
asset_content_type: application/x-apple-diskimage

- name: upload SeamlyME.dmg
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: ./SeamlyME.dmg
asset_name: SeamlyME.dmg
asset_content_type: application/x-apple-diskimage

windows:
runs-on: windows-latest

steps:
- uses: actions/checkout@v2
- uses: ilammy/msvc-dev-cmd@v1
- uses: jurplel/install-qt-action@v2
with:
version: ${{ env.QT_VERSION }}

- name: build
run: |
qmake.exe Seamly2D.pro -r CONFIG+=no_ccache CONFIG+=noDebugSymbols
nmake
- name: create & code sign installer
run: |
mkdir ..\windows-build
Get-ChildItem -Recurse -Include *.exe,*.dll | % { Copy-Item $_.FullName -force -destination ..\windows-build }
windeployqt.exe --libdir ..\windows-build --plugindir ..\windows-build --release ..\windows-build\seamly2d.exe
windeployqt.exe --force --libdir ..\windows-build --plugindir ..\windows-build --release ..\windows-build\seamlyme.exe
copy .\dist\seamly2d-installer.nsi ..\windows-build\
copy .\dist\win\VC_redist.x86.exe ..\windows-build\
cd ..\windows-build\
& 'C:\Program Files (x86)\NSIS\makensis.exe' seamly2d-installer.nsi
echo "${{ secrets.PFX_BASE64 }}" > cert.pfx.base64
certutil -decode cert.pfx.base64 cert.pfx
& 'C:\Program Files (x86)\Windows Kits\10\bin\x86\signtool.exe' sign /f cert.pfx /p ${{ secrets.PFX_PASSWORD }} /fd sha256 /tr http://timestamp.comodoca.com/?td=sha256 /td sha256 /as /v .\seamly2d-installer.exe
- name: upload seamly2d-installer
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: ../windows-build/seamly2d-installer.exe
asset_name: seamly2d-installer.exe
asset_content_type: application/octet-stream

0 comments on commit c19066e

Please sign in to comment.