Linux #814
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#----------------------------------------------------------------------------------------------------------------------- | |
# .github/workflows/linux-ubuntu.yml is part of Brewken, and is copyright the following authors 2021-2024: | |
# • Artem Martynov <martynov-a@polyplastic.by> | |
# • Chris Speck <cgspeck@gmail.com> | |
# • Mattias Måhl <mattias@kejsarsten.com> | |
# • Matt Young <mfsy@yahoo.com> | |
# • Mik Firestone <mikfire@gmail.com> | |
# | |
# Brewken is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License | |
# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later | |
# version. | |
# | |
# Brewken is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied | |
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | |
# details. | |
# | |
# You should have received a copy of the GNU General Public License along with this program. If not, see | |
# <http://www.gnu.org/licenses/>. | |
#----------------------------------------------------------------------------------------------------------------------- | |
name: Linux | |
on: | |
push: | |
branches: | |
- develop | |
- "stable/**" | |
pull_request: | |
branches: | |
- develop | |
schedule: | |
- cron: "0 2 * * *" | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
# | |
# See https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources | |
# for info on runner images | |
# | |
# Usually "ubuntu-latest" is the most recent LTS version of Ubuntu, but there can be a bit of lag between a new | |
# LTS release and the update of ubuntu-latest (eg in October 2022, it was still Ubuntu 20.04 rather than 22.04). | |
# So we explicitly specify here which versions we want to build on. | |
# | |
os: [ubuntu-22.04, ubuntu-24.04] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
# | |
# See https://github.com/Brewken/brewken/wiki/Development:-Getting-Started for more on what is needed to build | |
# the software. Most of this is now automated in 'bt setup all'. | |
# | |
# Some of the things that the bt script installs could be installed via actions (eg jurplel/install-qt-action@v3) | |
# and some are already installed by default for GitHub actions (eg cmake, git, debhelper, rpm) but there's an | |
# advantage, where we can, in doing the exact same steps that give as instructions to developers to set up their | |
# build environment. | |
# | |
# Of course, since 'bt' is a Python script, it can't install Python, so we need to do that first. We need Python | |
# 3.10 or newer, which means you can't just use `sudo apt install` on older Ubuntus. (Eg Ubuntu 18.04 packages | |
# have only Python 3.6.7 and Ubuntu 20.04 only have Python 3.8.2. However Ubuntu 22.04 has Python 3.10.6.) There | |
# are ways to get around this, but, in this context, it's simplest to use a canned GitHub action. | |
# | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install Frameworks and Libraries, and set up Meson build environment | |
working-directory: ${{github.workspace}} | |
shell: bash | |
run: | | |
pwd | |
./bt -v setup all | |
- name: Create CMake build environment | |
run: cmake -E make_directory ${{github.workspace}}/build | |
- name: Configure CMake | |
shell: bash | |
working-directory: ${{github.workspace}}/build | |
run: | | |
umask 022 | |
cmake \ | |
DESTDIR=/usr \ | |
-DDO_RELEASE_BUILD=ON \ | |
-DNO_MESSING_WITH_FLAGS=ON \ | |
$GITHUB_WORKSPACE | |
- name: Build (with Meson) | |
working-directory: ${{github.workspace}}/mbuild | |
shell: bash | |
run: | | |
pwd | |
meson compile | |
# The 'export QT_DEBUG_PLUGINS=1' give us diagnostics in the event that there are problems initialising QT | |
# The 'export QT_QPA_PLATFORM=offscreen' stops Qt's xcb sub-module trying to connect to a non-existent display | |
# (which would cause the test runner to abort before running any tests). | |
- name: Test (via Meson) | |
working-directory: ${{github.workspace}}/mbuild | |
shell: bash | |
run: | | |
export QT_DEBUG_PLUGINS=1 | |
export QT_QPA_PLATFORM=offscreen | |
meson test | |
- name: Build (with CMake) | |
working-directory: ${{github.workspace}}/build | |
shell: bash | |
run: | | |
make | |
# | |
# On Linux, currently CMake | |
# | |
#- name: Test (via CMake) | |
# working-directory: ${{github.workspace}}/build | |
# shell: bash | |
# env: | |
# CTEST_OUTPUT_ON_FAILURE: TRUE | |
# QT_QPA_PLATFORM: minimal | |
# run: | | |
# make test | |
# Note that, although we continue to support CMake for local builds and installs, we no longer support packaging | |
# with CPack/CMake. The bt build script packaging gives us better control over the packaging process. | |
- name: Package | |
working-directory: ${{github.workspace}}/mbuild | |
shell: bash | |
run: | | |
umask 022 | |
../bt package | |
- name: Upload Linux Packages (Installers) | |
if: ${{ success() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: brewken-${{matrix.os}} | |
path: | | |
mbuild/packages/source/brewken*.tar.xz | |
mbuild/packages/source/brewken*.tar.xz.sha256sum | |
mbuild/packages/linux/brewken*.deb | |
mbuild/packages/linux/brewken*.deb.sha256sum | |
mbuild/packages/linux/brewken*.rpm | |
mbuild/packages/linux/brewken*.rpm.sha256sum | |
retention-days: 7 | |
- name: Recover Debris Artifacts (CMake) | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-results-${{matrix.os}} | |
path: build | |
retention-days: 1 | |
- name: Recover Debris Artifacts (Meson) | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: mbuild-results-${{matrix.os}} | |
path: mbuild | |
retention-days: 1 | |
# Meson test doesn't show log output on the terminal, but puts it straight to a log file. We don't want to have | |
# to download the whole compressed mbuild tree just to see the log in event of a test failure, so we show it here | |
# (provided it exists). | |
- name: Show Meson test logs | |
if: ${{ failure() }} | |
working-directory: ${{github.workspace}} | |
shell: bash | |
run: | | |
if [[ -f mbuild/meson-logs/testlog.txt ]]; then cat mbuild/meson-logs/testlog.txt; fi |