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.
6 on: [ push, pull_request ]
14 # ------------------------------------------------------------------------------------------------------------------------------------------
17 runs-on: ubuntu-latest
18 container: quassel/quassel-build-env:${{ matrix.dist }}
22 dist: [ debian-stable, debian-testing, ubuntu-xenial, ubuntu-bionic, ubuntu-focal, ubuntu-groovy ]
23 cxx: [ 'g++', 'clang++' ]
24 with-kde: [ -DWITH_KDE=ON ]
25 extra-options: [ -DWITH_WEBENGINE=ON ]
27 # Baseline, test more combinations
29 with-kde: -DWITH_KDE=OFF
30 extra-options: -DWITH_WEBKIT=ON
32 with-kde: -DWITH_KDE=ON
33 extra-options: -DWITH_WEBKIT=ON
35 # QtWebEngine is not available on Xenial
37 extra-options: -DWITH_WEBENGINE=ON
39 CCACHE_BASEDIR: ${{ github.workspace }}
40 CCACHE_DIR: ${{ github.workspace }}/ccache
42 CXX: ${{ matrix.cxx }}
45 - name: Check out source code
46 uses: actions/checkout@v2
50 run: echo "::set-output name=timestamp::$(date -u "+%F-%R")"
53 uses: actions/cache@v2
55 path: ${{ github.workspace }}/ccache
56 key: ${{ matrix.dist }}-ccache-${{ steps.get-timestamp.outputs.timestamp }}
58 ${{ matrix.dist }}-ccache-
60 - name: Zero ccache stats
66 cd build && cmake $GITHUB_WORKSPACE \
68 -DCMAKE_BUILD_TYPE=Release \
71 ${{ matrix.with-kde }} \
72 ${{ matrix.extra-options }}
75 run: cd build && ninja
78 run: cd build && ctest
81 run: cd build && DESTDIR=$GITHUB_WORKSPACE/image ninja install
83 - name: Print ccache stats
86 # ------------------------------------------------------------------------------------------------------------------------------------------
91 CCACHE_BASEDIR: ${{ github.workspace }}
92 CCACHE_DIR: ${{ github.workspace }}/ccache
96 - name: Select Xcode version
97 uses: maxim-lobanov/setup-xcode@v1
99 # Newer Xcode versions may not officially be supported by Qt
100 # Check https://doc.qt.io/qt-5/macos.html
101 xcode-version: '12.4.0'
103 - name: Check out source code
104 uses: actions/checkout@v2
106 fetch-depth: 0 # so git-describe works
108 - name: Fetch tag information
109 if: startsWith(github.ref, 'refs/tags/')
110 run: git fetch -f origin $GITHUB_REF:$GITHUB_REF
112 - name: Install dependencies
113 # Skip "brew update" as it can trigger 50+ minutes of updating.
114 # GitHub Actions intentionally disables the default auto-update on their
115 # macOS CI images (and macOS CI images usually update once a week).
117 # See https://github.com/actions/virtual-environments/issues/2173
118 # > We've set no auto-update intentionally here [...]
119 # And https://github.com/microsoft/appcenter/issues/293
121 # If Homebrew begins failing in the future due to out-of-date versions,
122 # it can be re-enabled here as follows...
123 # run: brew update && [below command]
124 run: brew install boost ccache ninja qca qt@5
126 - name: Get timestamp
128 run: echo "::set-output name=timestamp::$(date -u "+%F-%R")"
131 uses: actions/cache@v2
133 path: ${{ github.workspace }}/ccache
134 key: macos-ccache-${{ steps.get-timestamp.outputs.timestamp }}
138 - name: Zero ccache stats
144 cd build && cmake $GITHUB_WORKSPACE \
149 -DCMAKE_PREFIX_PATH=$(brew --prefix)/opt/qt@5 \
150 -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/bundles \
151 -DCMAKE_BUILD_TYPE=Release \
153 -DFATAL_WARNINGS=OFF \
154 -DENABLE_SHARED=OFF \
158 run: cd build && ninja
161 run: cd build && ctest
164 run: cd build && ninja install
166 - name: Print ccache stats
169 - name: Upload artifacts
170 uses: actions/upload-artifact@v2
173 path: ${{ github.workspace }}/bundles/*.dmg
175 # ------------------------------------------------------------------------------------------------------------------------------------------
178 runs-on: windows-latest
180 WORKSPACE: ${{ github.workspace }}
181 CRAFT: /C/CraftMaster/windows-msvc2019_64-cl/craft/bin/craft.py
184 - name: Check out source code
185 uses: actions/checkout@v2
187 fetch-depth: 0 # so git-describe works
189 - name: Fetch tag information
190 if: startsWith(github.ref, 'refs/tags/')
191 run: git fetch -f origin $GITHUB_REF:$GITHUB_REF
193 - name: Clone CraftMaster
194 run: git clone --depth=1 https://invent.kde.org/kde/craftmaster.git /C/CraftMaster/CraftMaster
196 - name: Configure CraftMaster
197 run: python /C/CraftMaster/CraftMaster/CraftMaster.py --config $WORKSPACE/.craftsettings.ini --variables "WORKSPACE=$WORKSPACE"
199 - name: Add Quassel blueprint
200 run: python $CRAFT --add-blueprint-repository https://github.com/quassel/craft-blueprints-quassel.git
203 run: python $CRAFT dev-utils/nsis
205 - name: Install dependencies
206 run: python $CRAFT --install-deps quassel/quassel
209 run: python $CRAFT --no-cache --src-dir $WORKSPACE quassel/quassel
212 run: python $CRAFT --no-cache --src-dir $WORKSPACE --test quassel/quassel
215 run: python $CRAFT --no-cache --src-dir $WORKSPACE --package quassel/quassel
217 - name: Upload artifacts
218 uses: actions/upload-artifact@v2
221 path: ${{ github.workspace }}/packages/*
223 # ------------------------------------------------------------------------------------------------------------------------------------------
226 runs-on: ubuntu-latest
227 needs: [ build-linux, build-macos, build-windows ]
229 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
232 - name: Check out source code
233 uses: actions/checkout@v2
235 - name: Fetch tag information
236 if: startsWith(github.ref, 'refs/tags/')
237 run: git fetch -f origin $GITHUB_REF:$GITHUB_REF
239 - name: Download artifacts
240 uses: actions/download-artifact@v2
244 - name: List artifacts
245 run: ls -lhR artifacts
247 - name: Check artifacts
249 # Sanity check: We should have exactly 5 files matching the given patterns
250 [[ 5 -eq $(find artifacts/ \( -type f -name 'Quassel*.dmg' -o -name 'quassel*.exe' -o -name 'quassel*.7z' \) -printf '.' | wc -c) ]]
252 - name: Create release notes
253 if: startsWith(github.ref, 'refs/tags/')
255 # Use the tag's annotation as release notes
256 TAGNAME=$(git rev-parse --abbrev-ref $GITHUB_REF)
257 MESSAGE=$(git tag -l --format='%(contents)' $TAGNAME | perl -ne 'print if not /-----BEGIN PGP SIGNATURE-----/../-----END PGP SIGNATURE-----/')
258 echo -e "Quassel $TAGNAME\n\n$MESSAGE" > release_notes.txt
260 - name: Prepare source archive
261 if: startsWith(github.ref, 'refs/tags/')
264 TAGNAME=$(git rev-parse --abbrev-ref $GITHUB_REF)
265 git archive --format=tar --prefix=quassel-$TAGNAME/ $TAGNAME | xz > assets/quassel-$TAGNAME.tar.xz
267 - name: Prepare packages for release
268 if: startsWith(github.ref, 'refs/tags/')
270 TAGNAME=$(git rev-parse --abbrev-ref $GITHUB_REF)
271 for type in Client Core Mono; do
272 mv artifacts/macOS/Quassel$type*.dmg assets/Quassel$type-macOS-$TAGNAME.dmg
274 mv artifacts/Windows/quassel-*.exe assets/quassel-windows-setup-$TAGNAME.exe
275 mv artifacts/Windows/quassel-*.7z assets/quassel-windows-$TAGNAME.7z
277 - name: Create checksums for release assets
278 if: startsWith(github.ref, 'refs/tags/')
279 run: find assets/ -type f -execdir sh -c 'sha256sum "$1" > "$1.sha256sum"' _ {} \;
281 - name: Create draft release
282 if: startsWith(github.ref, 'refs/tags/')
284 # The stock upload-release-asset action can only handle single files
285 # Instead, use the hub utility so we can upload all assets at once
287 for asset in assets/*; do assets+=("-a" "$asset"); done
288 hub release create -d "${assets[@]}" -F release_notes.txt `git rev-parse --abbrev-ref $GITHUB_REF`