1 # Workflow that builds Quassel on various Linux distros, and creates packages for both Windows and macOS.
2 # For tagged pushes, a draft release is automatically created, using the tag message as release description
3 # and attaching Windows and macOS builds, as well as the source archive.
10 # * is a special character in YAML so you have to quote this string
11 # Run at 13:37 on the 14th of every month (odd time to reduce load)
12 - cron: '37 13 14 * *'
14 # Can't use simpler definition of [ push, pull_request, schedule ]
15 # See https://www.jeffgeerling.com/blog/2020/running-github-actions-workflow-on-schedule-and-other-events
23 # ------------------------------------------------------------------------------------------------------------------------------------------
26 runs-on: ubuntu-latest
27 container: quassel/quassel-build-env:${{ matrix.dist }}
31 dist: [ debian-stable, debian-testing, ubuntu-xenial, ubuntu-bionic, ubuntu-focal, ubuntu-groovy ]
32 cxx: [ 'g++', 'clang++' ]
33 with-kde: [ -DWITH_KDE=ON ]
34 extra-options: [ -DWITH_WEBENGINE=ON ]
36 # Baseline, test more combinations
38 with-kde: -DWITH_KDE=OFF
39 extra-options: -DWITH_WEBKIT=ON
41 with-kde: -DWITH_KDE=ON
42 extra-options: -DWITH_WEBKIT=ON
44 # QtWebEngine is not available on Xenial
46 extra-options: -DWITH_WEBENGINE=ON
48 CCACHE_BASEDIR: ${{ github.workspace }}
49 CCACHE_DIR: ${{ github.workspace }}/ccache
51 CXX: ${{ matrix.cxx }}
54 - name: Check out source code
55 uses: actions/checkout@v2
59 run: echo "::set-output name=timestamp::$(date -u "+%F-%R")"
62 uses: actions/cache@v2
64 path: ${{ github.workspace }}/ccache
65 key: ${{ matrix.dist }}-ccache-${{ steps.get-timestamp.outputs.timestamp }}
67 ${{ matrix.dist }}-ccache-
69 - name: Zero ccache stats
75 cd build && cmake $GITHUB_WORKSPACE \
77 -DCMAKE_BUILD_TYPE=Release \
80 ${{ matrix.with-kde }} \
81 ${{ matrix.extra-options }}
84 run: cd build && ninja
87 run: cd build && ctest
90 run: cd build && DESTDIR=$GITHUB_WORKSPACE/image ninja install
92 - name: Print ccache stats
95 # ------------------------------------------------------------------------------------------------------------------------------------------
100 CCACHE_BASEDIR: ${{ github.workspace }}
101 CCACHE_DIR: ${{ github.workspace }}/ccache
105 - name: Select Xcode version
106 uses: maxim-lobanov/setup-xcode@v1
108 # Newer Xcode versions may not officially be supported by Qt
109 # Check https://doc.qt.io/qt-5/macos.html
110 xcode-version: '12.4.0'
112 - name: Check out source code
113 uses: actions/checkout@v2
115 fetch-depth: 0 # so git-describe works
117 - name: Fetch tag information
118 if: startsWith(github.ref, 'refs/tags/')
119 run: git fetch -f origin $GITHUB_REF:$GITHUB_REF
121 - name: Install dependencies
122 # Skip "brew update" as it can trigger 50+ minutes of updating.
123 # GitHub Actions intentionally disables the default auto-update on their
124 # macOS CI images (and macOS CI images usually update once a week).
126 # See https://github.com/actions/virtual-environments/issues/2173
127 # > We've set no auto-update intentionally here [...]
128 # And https://github.com/microsoft/appcenter/issues/293
130 # If Homebrew begins failing in the future due to out-of-date versions,
131 # it can be re-enabled here as follows...
132 # run: brew update && [below command]
133 run: brew install boost ccache ninja qca qt@5
135 - name: Get timestamp
137 run: echo "::set-output name=timestamp::$(date -u "+%F-%R")"
140 uses: actions/cache@v2
142 path: ${{ github.workspace }}/ccache
143 key: macos-ccache-${{ steps.get-timestamp.outputs.timestamp }}
147 - name: Zero ccache stats
153 cd build && cmake $GITHUB_WORKSPACE \
158 -DCMAKE_PREFIX_PATH=$(brew --prefix)/opt/qt@5 \
159 -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/bundles \
160 -DCMAKE_BUILD_TYPE=Release \
162 -DFATAL_WARNINGS=OFF \
163 -DENABLE_SHARED=OFF \
167 run: cd build && ninja
170 run: cd build && ctest
173 run: cd build && ninja install
175 - name: Print ccache stats
178 - name: Upload artifacts
179 uses: actions/upload-artifact@v2
182 path: ${{ github.workspace }}/bundles/*.dmg
184 # ------------------------------------------------------------------------------------------------------------------------------------------
187 runs-on: windows-latest
189 WORKSPACE: ${{ github.workspace }}
190 CRAFT: /C/CraftMaster/windows-msvc2019_64-cl/craft/bin/craft.py
193 - name: Check out source code
194 uses: actions/checkout@v2
196 fetch-depth: 0 # so git-describe works
198 - name: Fetch tag information
199 if: startsWith(github.ref, 'refs/tags/')
200 run: git fetch -f origin $GITHUB_REF:$GITHUB_REF
202 - name: Clone CraftMaster
203 run: git clone --depth=1 https://invent.kde.org/kde/craftmaster.git /C/CraftMaster/CraftMaster
205 - name: Configure CraftMaster
206 run: python /C/CraftMaster/CraftMaster/CraftMaster.py --config $WORKSPACE/.craftsettings.ini --variables "WORKSPACE=$WORKSPACE"
208 - name: Add Quassel blueprint
209 run: python $CRAFT --add-blueprint-repository https://github.com/quassel/craft-blueprints-quassel.git
212 run: python $CRAFT dev-utils/nsis
214 - name: Install dependencies
215 run: python $CRAFT --install-deps quassel/quassel
218 run: python $CRAFT --no-cache --src-dir $WORKSPACE quassel/quassel
221 run: python $CRAFT --no-cache --src-dir $WORKSPACE --test quassel/quassel
224 run: python $CRAFT --no-cache --src-dir $WORKSPACE --package quassel/quassel
226 - name: Upload artifacts
227 uses: actions/upload-artifact@v2
230 path: ${{ github.workspace }}/packages/*
232 # ------------------------------------------------------------------------------------------------------------------------------------------
235 runs-on: ubuntu-latest
236 needs: [ build-linux, build-macos, build-windows ]
238 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
241 - name: Check out source code
242 uses: actions/checkout@v2
244 - name: Fetch tag information
245 if: startsWith(github.ref, 'refs/tags/')
246 run: git fetch -f origin $GITHUB_REF:$GITHUB_REF
248 - name: Download artifacts
249 uses: actions/download-artifact@v2
253 - name: List artifacts
254 run: ls -lhR artifacts
256 - name: Check artifacts
258 # Sanity check: We should have exactly 5 files matching the given patterns
259 [[ 5 -eq $(find artifacts/ \( -type f -name 'Quassel*.dmg' -o -name 'quassel*.exe' -o -name 'quassel*.7z' \) -printf '.' | wc -c) ]]
261 - name: Create release notes
262 if: startsWith(github.ref, 'refs/tags/')
264 # Use the tag's annotation as release notes
265 TAGNAME=$(git rev-parse --abbrev-ref $GITHUB_REF)
266 MESSAGE=$(git tag -l --format='%(contents)' $TAGNAME | perl -ne 'print if not /-----BEGIN PGP SIGNATURE-----/../-----END PGP SIGNATURE-----/')
267 echo -e "Quassel $TAGNAME\n\n$MESSAGE" > release_notes.txt
269 - name: Prepare source archive
270 if: startsWith(github.ref, 'refs/tags/')
273 TAGNAME=$(git rev-parse --abbrev-ref $GITHUB_REF)
274 git archive --format=tar --prefix=quassel-$TAGNAME/ $TAGNAME | xz > assets/quassel-$TAGNAME.tar.xz
276 - name: Prepare packages for release
277 if: startsWith(github.ref, 'refs/tags/')
279 TAGNAME=$(git rev-parse --abbrev-ref $GITHUB_REF)
280 for type in Client Core Mono; do
281 mv artifacts/macOS/Quassel$type*.dmg assets/Quassel$type-macOS-$TAGNAME.dmg
283 mv artifacts/Windows/quassel-*.exe assets/quassel-windows-setup-$TAGNAME.exe
284 mv artifacts/Windows/quassel-*.7z assets/quassel-windows-$TAGNAME.7z
286 - name: Create checksums for release assets
287 if: startsWith(github.ref, 'refs/tags/')
288 run: find assets/ -type f -execdir sh -c 'sha256sum "$1" > "$1.sha256sum"' _ {} \;
290 - name: Create draft release
291 if: startsWith(github.ref, 'refs/tags/')
293 # The stock upload-release-asset action can only handle single files
294 # Instead, use the hub utility so we can upload all assets at once
296 for asset in assets/*; do assets+=("-a" "$asset"); done
297 hub release create -d "${assets[@]}" -F release_notes.txt `git rev-parse --abbrev-ref $GITHUB_REF`