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-eoan, ubuntu-focal ]
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
44 - name: Check out source code
45 uses: actions/checkout@v2
49 run: echo "::set-output name=timestamp::$(date -u "+%F-%R")"
52 uses: actions/cache@v2
54 path: ${{ github.workspace }}/ccache
55 key: ${{ matrix.dist }}-ccache-${{ steps.get-timestamp.outputs.timestamp }}
57 ${{ matrix.dist }}-ccache-
59 - name: Zero ccache stats
65 cd build && cmake $GITHUB_WORKSPACE \
67 -DCMAKE_BUILD_TYPE=Release \
70 ${{ matrix.with-kde }} \
71 ${{ matrix.extra-options }}
74 run: cd build && ninja
77 run: cd build && ctest
80 run: cd build && DESTDIR=$GITHUB_WORKSPACE/image ninja install
82 - name: Print ccache stats
85 # ------------------------------------------------------------------------------------------------------------------------------------------
90 CCACHE_BASEDIR: ${{ github.workspace }}
91 CCACHE_DIR: ${{ github.workspace }}/ccache
95 - name: Check out source code
96 uses: actions/checkout@v2
98 fetch-depth: 0 # so git-describe works
100 - name: Fetch tag information
101 if: startsWith(github.ref, 'refs/tags/')
102 run: git fetch -f origin $GITHUB_REF:$GITHUB_REF
104 - name: Install dependencies
105 # Skip "brew update" as it can trigger 50+ minutes of updating.
106 # GitHub Actions intentionally disables the default auto-update on their
107 # macOS CI images (and macOS CI images usually update once a week).
109 # See https://github.com/actions/virtual-environments/issues/2173
110 # > We've set no auto-update intentionally here [...]
111 # And https://github.com/microsoft/appcenter/issues/293
113 # If Homebrew begins failing in the future due to out-of-date versions,
114 # it can be re-enabled here as follows...
115 # run: brew update && [below command]
116 run: brew install boost ccache ninja qca qt5
118 - name: Get timestamp
120 run: echo "::set-output name=timestamp::$(date -u "+%F-%R")"
123 uses: actions/cache@v2
125 path: ${{ github.workspace }}/ccache
126 key: macos-ccache-${{ steps.get-timestamp.outputs.timestamp }}
130 - name: Zero ccache stats
136 cd build && cmake $GITHUB_WORKSPACE \
138 -DCMAKE_PREFIX_PATH=/usr/local/opt/qt/lib/cmake \
139 -DCMAKE_BUILD_TYPE=Release \
141 -DFATAL_WARNINGS=OFF \
147 # Deploy scripts require qmake in the path
148 export PATH=$PATH:/usr/local/opt/qt5/bin
152 run: cd build && ctest
155 run: cd build && DESTDIR=$GITHUB_WORKSPACE/image ninja install
157 - name: Print ccache stats
160 - name: Upload artifacts
161 uses: actions/upload-artifact@v2
164 path: ${{ github.workspace }}/build/*.dmg
166 # ------------------------------------------------------------------------------------------------------------------------------------------
169 runs-on: windows-latest
171 WORKSPACE: ${{ github.workspace }}
172 CRAFT: /C/CraftMaster/windows-msvc2019_64-cl/craft/bin/craft.py
175 - name: Check out source code
176 uses: actions/checkout@v2
178 fetch-depth: 0 # so git-describe works
180 - name: Fetch tag information
181 if: startsWith(github.ref, 'refs/tags/')
182 run: git fetch -f origin $GITHUB_REF:$GITHUB_REF
184 - name: Clone CraftMaster
185 run: git clone --depth=1 https://invent.kde.org/kde/craftmaster.git /C/CraftMaster/CraftMaster
187 - name: Configure CraftMaster
188 run: python /C/CraftMaster/CraftMaster/CraftMaster.py --config $WORKSPACE/.craftsettings.ini --variables "WORKSPACE=$WORKSPACE"
190 - name: Add Quassel blueprint
191 run: python $CRAFT --add-blueprint-repository https://github.com/quassel/craft-blueprints-quassel.git
194 run: python $CRAFT dev-utils/nsis
196 - name: Install dependencies
197 run: python $CRAFT --install-deps quassel/quassel
200 run: python $CRAFT --no-cache --src-dir $WORKSPACE quassel/quassel
203 run: python $CRAFT --no-cache --src-dir $WORKSPACE --test quassel/quassel
206 run: python $CRAFT --no-cache --src-dir $WORKSPACE --package quassel/quassel
208 - name: Upload artifacts
209 uses: actions/upload-artifact@v2
212 path: ${{ github.workspace }}/packages/*
214 # ------------------------------------------------------------------------------------------------------------------------------------------
217 runs-on: ubuntu-latest
218 needs: [ build-linux, build-macos, build-windows ]
220 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
223 - name: Check out source code
224 uses: actions/checkout@v2
226 - name: Fetch tag information
227 if: startsWith(github.ref, 'refs/tags/')
228 run: git fetch -f origin $GITHUB_REF:$GITHUB_REF
230 - name: Download artifacts
231 uses: actions/download-artifact@v2
235 - name: List artifacts
236 run: ls -lhR artifacts
238 - name: Check artifacts
240 # Sanity check: We should have exactly 5 files matching the given patterns
241 [[ 5 -eq $(find artifacts/ \( -type f -name 'Quassel*.dmg' -o -name 'quassel*.exe' -o -name 'quassel*.7z' \) -printf '.' | wc -c) ]]
243 - name: Create release notes
244 if: startsWith(github.ref, 'refs/tags/')
246 # Use the tag's annotation as release notes
247 TAGNAME=$(git rev-parse --abbrev-ref $GITHUB_REF)
248 MESSAGE=$(git tag -l --format='%(contents)' $TAGNAME | perl -ne 'print if not /-----BEGIN PGP SIGNATURE-----/../-----END PGP SIGNATURE-----/')
249 echo -e "Quassel $TAGNAME\n\n$MESSAGE" > release_notes.txt
251 - name: Prepare source archive
252 if: startsWith(github.ref, 'refs/tags/')
255 TAGNAME=$(git rev-parse --abbrev-ref $GITHUB_REF)
256 git archive --format=tar --prefix=quassel-$TAGNAME/ $TAGNAME | xz > assets/quassel-$TAGNAME.tar.xz
258 - name: Prepare packages for release
259 if: startsWith(github.ref, 'refs/tags/')
261 TAGNAME=$(git rev-parse --abbrev-ref $GITHUB_REF)
262 for type in Client Core Mono; do
263 mv artifacts/macOS/Quassel$type*.dmg assets/Quassel$type-macOS-$TAGNAME.dmg
265 mv artifacts/Windows/quassel-*.exe assets/quassel-windows-setup-$TAGNAME.exe
266 mv artifacts/Windows/quassel-*.7z assets/quassel-windows-$TAGNAME.7z
268 - name: Create checksums for release assets
269 if: startsWith(github.ref, 'refs/tags/')
270 run: find assets/ -type f -execdir sh -c 'sha256sum "$1" > "$1.sha256sum"' _ {} \;
272 - name: Create draft release
273 if: startsWith(github.ref, 'refs/tags/')
275 # The stock upload-release-asset action can only handle single files
276 # Instead, use the hub utility so we can upload all assets at once
278 for asset in assets/*; do assets+=("-a" "$asset"); done
279 hub release create -d "${assets[@]}" -F release_notes.txt `git rev-parse --abbrev-ref $GITHUB_REF`