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 }}
21 dist: [ debian-stable, debian-testing, ubuntu-xenial, ubuntu-bionic, ubuntu-eoan, ubuntu-focal ]
23 with-kde: [ -DWITH_KDE=ON ]
24 extra-options: [ -DWITH_WEBENGINE=ON ]
26 # Baseline, test more combinations
28 with-kde: -DWITH_KDE=OFF
29 extra-options: -DWITH_WEBKIT=ON
31 with-kde: -DWITH_KDE=ON
32 extra-options: -DWITH_WEBKIT=ON
34 # QtWebEngine is not available on Xenial
36 extra-options: -DWITH_WEBENGINE=ON
38 CCACHE_BASEDIR: ${{ github.workspace }}
39 CCACHE_DIR: ${{ github.workspace }}/ccache
43 - name: Check out source code
44 uses: actions/checkout@v2
48 run: echo "::set-output name=timestamp::$(date -u "+%F-%R")"
51 uses: actions/cache@v2
53 path: ${{ github.workspace }}/ccache
54 key: ${{ matrix.dist }}-ccache-${{ steps.get-timestamp.outputs.timestamp }}
56 ${{ matrix.dist }}-ccache-
58 - name: Zero ccache stats
64 cd build && cmake $GITHUB_WORKSPACE \
66 -DCMAKE_BUILD_TYPE=Release \
69 ${{ matrix.with-kde }} \
70 ${{ matrix.extra-options }}
73 run: cd build && ninja
76 run: cd build && ctest
79 run: cd build && DESTDIR=$GITHUB_WORKSPACE/image ninja install
81 - name: Print ccache stats
84 # ------------------------------------------------------------------------------------------------------------------------------------------
89 CCACHE_BASEDIR: ${{ github.workspace }}
90 CCACHE_DIR: ${{ github.workspace }}/ccache
94 - name: Check out source code
95 uses: actions/checkout@v2
97 fetch-depth: 0 # so git-describe works
99 - name: Fetch tag information
100 if: startsWith(github.ref, 'refs/tags/')
101 run: git fetch -f origin $GITHUB_REF:$GITHUB_REF
103 - name: Install dependencies
104 run: brew update && brew install boost ccache ninja qca qt5
106 - name: Get timestamp
108 run: echo "::set-output name=timestamp::$(date -u "+%F-%R")"
111 uses: actions/cache@v2
113 path: ${{ github.workspace }}/ccache
114 key: macos-ccache-${{ steps.get-timestamp.outputs.timestamp }}
118 - name: Zero ccache stats
124 cd build && cmake $GITHUB_WORKSPACE \
126 -DCMAKE_PREFIX_PATH=/usr/local/opt/qt/lib/cmake \
127 -DCMAKE_BUILD_TYPE=Release \
129 -DFATAL_WARNINGS=OFF \
135 # Deploy scripts require qmake in the path
136 export PATH=$PATH:/usr/local/opt/qt5/bin
140 run: cd build && ctest
143 run: cd build && DESTDIR=$GITHUB_WORKSPACE/image ninja install
145 - name: Print ccache stats
148 - name: Upload artifacts
149 uses: actions/upload-artifact@v2
152 path: ${{ github.workspace }}/build/*.dmg
154 # ------------------------------------------------------------------------------------------------------------------------------------------
157 runs-on: windows-latest
159 WORKSPACE: ${{ github.workspace }}
160 CRAFT: /C/CraftMaster/windows-msvc2019_64-cl/craft/bin/craft.py
163 - name: Check out source code
164 uses: actions/checkout@v2
166 fetch-depth: 0 # so git-describe works
168 - name: Fetch tag information
169 if: startsWith(github.ref, 'refs/tags/')
170 run: git fetch -f origin $GITHUB_REF:$GITHUB_REF
172 - name: Clone CraftMaster
173 run: git clone --depth=1 https://invent.kde.org/kde/craftmaster.git /C/CraftMaster/CraftMaster
175 - name: Configure CraftMaster
176 run: python /C/CraftMaster/CraftMaster/CraftMaster.py --config $WORKSPACE/.craftsettings.ini --variables "WORKSPACE=$WORKSPACE"
178 - name: Add Quassel blueprint
179 run: python $CRAFT --add-blueprint-repository https://github.com/quassel/craft-blueprints-quassel.git
182 run: python $CRAFT dev-utils/nsis
184 - name: Install dependencies
185 run: python $CRAFT --install-deps quassel/quassel
188 run: python $CRAFT --no-cache --src-dir $WORKSPACE quassel/quassel
191 run: python $CRAFT --no-cache --src-dir $WORKSPACE --test quassel/quassel
194 run: python $CRAFT --no-cache --src-dir $WORKSPACE --package quassel/quassel
196 - name: Upload artifacts
197 uses: actions/upload-artifact@v2
200 path: ${{ github.workspace }}/packages/*
202 # ------------------------------------------------------------------------------------------------------------------------------------------
205 runs-on: ubuntu-latest
206 needs: [ build-linux, build-macos, build-windows ]
208 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
211 - name: Check out source code
212 uses: actions/checkout@v2
214 - name: Fetch tag information
215 if: startsWith(github.ref, 'refs/tags/')
216 run: git fetch -f origin $GITHUB_REF:$GITHUB_REF
218 - name: Download artifacts
219 uses: actions/download-artifact@v2
223 - name: List artifacts
224 run: ls -lhR artifacts
226 - name: Check artifacts
227 continue-on-error: true # macOS packaging is unreliable
229 # Sanity check: We should have exactly 5 files matching the given patterns
230 [[ 5 -eq $(find artifacts/ \( -type f -name 'Quassel*.dmg' -o -name 'quassel*.exe' -o -name 'quassel*.7z' \) -printf '.' | wc -c) ]]
232 - name: Create release notes
233 if: startsWith(github.ref, 'refs/tags/')
235 # Use the tag's annotation as release notes
236 TAGNAME=$(git rev-parse --abbrev-ref $GITHUB_REF)
237 MESSAGE=$(git tag -l --format='%(contents)' $TAGNAME | perl -ne 'print if not /-----BEGIN PGP SIGNATURE-----/../-----END PGP SIGNATURE-----/')
238 echo -e "Quassel $TAGNAME\n\n$MESSAGE" > release_notes.txt
240 - name: Prepare source archive
241 if: startsWith(github.ref, 'refs/tags/')
244 TAGNAME=$(git rev-parse --abbrev-ref $GITHUB_REF)
245 git archive --format=tar --prefix=quassel-$TAGNAME/ $TAGNAME | xz > assets/quassel-$TAGNAME.tar.xz
247 - name: Prepare packages for release
248 if: startsWith(github.ref, 'refs/tags/')
250 TAGNAME=$(git rev-parse --abbrev-ref $GITHUB_REF)
251 for type in Client Core Mono; do
252 mv artifacts/macOS/Quassel$type*.dmg assets/Quassel$type-macOS-$TAGNAME.dmg
254 mv artifacts/Windows/quassel-*.exe assets/quassel-windows-setup-$TAGNAME.exe
255 mv artifacts/Windows/quassel-*.7z assets/quassel-windows-$TAGNAME.7z
257 - name: Create checksums for release assets
258 if: startsWith(github.ref, 'refs/tags/')
259 run: find assets/ -type f -execdir sh -c 'sha256sum "$1" > "$1.sha256sum"' _ {} \;
261 - name: Create draft release
262 if: startsWith(github.ref, 'refs/tags/')
264 # The stock upload-release-asset action can only handle single files
265 # Instead, use the hub utility so we can upload all assets at once
267 for asset in assets/*; do assets+=("-a" "$asset"); done
268 hub release create -d "${assets[@]}" -F release_notes.txt `git rev-parse --abbrev-ref $GITHUB_REF`