-
Notifications
You must be signed in to change notification settings - Fork 6
170 lines (156 loc) · 6.64 KB
/
linux-ubuntu.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
#-----------------------------------------------------------------------------------------------------------------------
# .github/workflows/linux-ubuntu.yml is part of Brewken, and is copyright the following authors 2021-2024:
# • Artem Martynov <[email protected]>
# • Chris Speck <[email protected]>
# • Mattias Måhl <[email protected]>
# • Matt Young <[email protected]>
# • Mik Firestone <[email protected]>
#
# 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@v4
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
- 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