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 # Skip "brew update" as it can trigger 50+ minutes of updating.
105 # GitHub Actions intentionally disables the default auto-update on their
106 # macOS CI images (and macOS CI images usually update once a week).
108 # See https://github.com/actions/virtual-environments/issues/2173
109 # > We've set no auto-update intentionally here [...]
110 # And https://github.com/microsoft/appcenter/issues/293
112 # If Homebrew begins failing in the future due to out-of-date versions,
113 # it can be re-enabled here as follows...
114 # run: brew update && [below command]
115 run: brew install boost ccache ninja qca qt5
117 - name: Get timestamp
119 run: echo "::set-output name=timestamp::$(date -u "+%F-%R")"
122 uses: actions/cache@v2
124 path: ${{ github.workspace }}/ccache
125 key: macos-ccache-${{ steps.get-timestamp.outputs.timestamp }}
129 - name: Zero ccache stats
135 cd build && cmake $GITHUB_WORKSPACE \
137 -DCMAKE_PREFIX_PATH=/usr/local/opt/qt/lib/cmake \
138 -DCMAKE_BUILD_TYPE=Release \
140 -DFATAL_WARNINGS=OFF \
146 # Deploy scripts require qmake in the path
147 export PATH=$PATH:/usr/local/opt/qt5/bin
151 run: cd build && ctest
154 run: cd build && DESTDIR=$GITHUB_WORKSPACE/image ninja install
156 - name: Print ccache stats
159 - name: Upload artifacts
160 uses: actions/upload-artifact@v2
163 path: ${{ github.workspace }}/build/*.dmg
165 # ------------------------------------------------------------------------------------------------------------------------------------------
168 runs-on: windows-latest
170 WORKSPACE: ${{ github.workspace }}
171 CRAFT: /C/CraftMaster/windows-msvc2019_64-cl/craft/bin/craft.py
174 - name: Check out source code
175 uses: actions/checkout@v2
177 fetch-depth: 0 # so git-describe works
179 - name: Fetch tag information
180 if: startsWith(github.ref, 'refs/tags/')
181 run: git fetch -f origin $GITHUB_REF:$GITHUB_REF
183 - name: Clone CraftMaster
184 run: git clone --depth=1 https://invent.kde.org/kde/craftmaster.git /C/CraftMaster/CraftMaster
186 - name: Configure CraftMaster
187 run: python /C/CraftMaster/CraftMaster/CraftMaster.py --config $WORKSPACE/.craftsettings.ini --variables "WORKSPACE=$WORKSPACE"
189 - name: Add Quassel blueprint
190 run: python $CRAFT --add-blueprint-repository https://github.com/quassel/craft-blueprints-quassel.git
193 run: python $CRAFT dev-utils/nsis
195 - name: Install dependencies
196 run: python $CRAFT --install-deps quassel/quassel
199 run: python $CRAFT --no-cache --src-dir $WORKSPACE quassel/quassel
202 run: python $CRAFT --no-cache --src-dir $WORKSPACE --test quassel/quassel
205 run: python $CRAFT --no-cache --src-dir $WORKSPACE --package quassel/quassel
207 - name: Upload artifacts
208 uses: actions/upload-artifact@v2
211 path: ${{ github.workspace }}/packages/*
213 # ------------------------------------------------------------------------------------------------------------------------------------------
216 runs-on: ubuntu-latest
217 needs: [ build-linux, build-macos, build-windows ]
219 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
222 - name: Check out source code
223 uses: actions/checkout@v2
225 - name: Fetch tag information
226 if: startsWith(github.ref, 'refs/tags/')
227 run: git fetch -f origin $GITHUB_REF:$GITHUB_REF
229 - name: Download artifacts
230 uses: actions/download-artifact@v2
234 - name: List artifacts
235 run: ls -lhR artifacts
237 - name: Check artifacts
239 # Sanity check: We should have exactly 5 files matching the given patterns
240 [[ 5 -eq $(find artifacts/ \( -type f -name 'Quassel*.dmg' -o -name 'quassel*.exe' -o -name 'quassel*.7z' \) -printf '.' | wc -c) ]]
242 - name: Create release notes
243 if: startsWith(github.ref, 'refs/tags/')
245 # Use the tag's annotation as release notes
246 TAGNAME=$(git rev-parse --abbrev-ref $GITHUB_REF)
247 MESSAGE=$(git tag -l --format='%(contents)' $TAGNAME | perl -ne 'print if not /-----BEGIN PGP SIGNATURE-----/../-----END PGP SIGNATURE-----/')
248 echo -e "Quassel $TAGNAME\n\n$MESSAGE" > release_notes.txt
250 - name: Prepare source archive
251 if: startsWith(github.ref, 'refs/tags/')
254 TAGNAME=$(git rev-parse --abbrev-ref $GITHUB_REF)
255 git archive --format=tar --prefix=quassel-$TAGNAME/ $TAGNAME | xz > assets/quassel-$TAGNAME.tar.xz
257 - name: Prepare packages for release
258 if: startsWith(github.ref, 'refs/tags/')
260 TAGNAME=$(git rev-parse --abbrev-ref $GITHUB_REF)
261 for type in Client Core Mono; do
262 mv artifacts/macOS/Quassel$type*.dmg assets/Quassel$type-macOS-$TAGNAME.dmg
264 mv artifacts/Windows/quassel-*.exe assets/quassel-windows-setup-$TAGNAME.exe
265 mv artifacts/Windows/quassel-*.7z assets/quassel-windows-$TAGNAME.7z
267 - name: Create checksums for release assets
268 if: startsWith(github.ref, 'refs/tags/')
269 run: find assets/ -type f -execdir sh -c 'sha256sum "$1" > "$1.sha256sum"' _ {} \;
271 - name: Create draft release
272 if: startsWith(github.ref, 'refs/tags/')
274 # The stock upload-release-asset action can only handle single files
275 # Instead, use the hub utility so we can upload all assets at once
277 for asset in assets/*; do assets+=("-a" "$asset"); done
278 hub release create -d "${assets[@]}" -F release_notes.txt `git rev-parse --abbrev-ref $GITHUB_REF`