ci: Upgrade macOS version #1160
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SPDX-FileCopyrightText: Copyright (C) swift Project Community / Contributors | |
# SPDX-License-Identifier: CC0-1.0 | |
name: Build swift | |
on: | |
push: | |
branches-ignore: | |
- stable/** | |
- nobuild/** | |
pull_request: | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
do_vatsim_key: ${{ github.event_name == 'push' }} | |
do_symbols: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
qt_version: 5.15.2 | |
bitrock_version: qt-professional-24.7.0 | |
bitrock_url: https://releases.installbuilder.com/installbuilder | |
externals: swift-project/externals | |
externals_sha: 53e671fc3ba76f2036b9130314507776d161c6e0 | |
use_externals: ${{ secrets.EXTERNALS_PAT != '' }} | |
jobs: | |
preBuild: | |
runs-on: ubuntu-22.04 | |
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository }} | |
outputs: | |
version: ${{ steps.version.outputs.value }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get version number | |
id: version | |
run: | | |
echo "value=$(python3 -u scripts/utils.py --version)" >>$GITHUB_OUTPUT | |
- name: Remove artifacts | |
uses: swift-project/delete-artifact@swift | |
with: | |
name: | | |
xswiftbus-thin-* | |
xswiftbus-fat-* | |
swiftsymbols-* | |
swiftinstaller-* | |
failOnError: false | |
warnIfNotFound: false | |
checks: | |
runs-on: ubuntu-22.04 | |
needs: preBuild | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Run clang-format | |
run: | | |
scripts/run_clang_format.py | |
- uses: Trass3r/setup-cpp@1b63900ecf3f0b7c60ee53aa7be122f2c4fe7a2c | |
- name: Run cppcheck | |
run: | | |
sudo apt-get -y install cppcheck | |
cppcheck --template=gcc --inline-suppr --std=c++17 --enable=style,unusedFunction \ | |
-i src/plugins/weatherdata/gfs/g2clib -DCPPCHECK --force --suppressions-list=cppcheck.supp \ | |
--library=qt.cfg --library=posix.cfg . | |
- name: Run doxygen | |
working-directory: docs | |
run: | | |
sudo apt-get -y install doxygen graphviz | |
doxygen Doxyfile | |
env: | |
DOXY_SRC_ROOT: .. | |
- name: Upload doxygen | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: docs/html/ | |
buildLinux: | |
runs-on: ubuntu-20.04 | |
needs: [preBuild, checks] | |
env: | |
BACKTRACE_SYMBOL_TOKEN: ${{ secrets.BACKTRACE_SYMBOL_TOKEN }} | |
BACKTRACE_MINIDUMP_TOKEN: ${{ secrets.BACKTRACE_MINIDUMP_TOKEN }} | |
BITROCK_BUILDER: ~/installbuilder/bin/builder | |
steps: | |
- name: Install Qt | |
uses: jurplel/install-qt-action@v4 | |
with: | |
version: ${{ env.qt_version }} | |
cache: true | |
- name: Cache InstallBuilder | |
id: cache-bitrock | |
uses: actions/cache@v4 | |
with: | |
path: ~/installbuilder.run | |
key: installbuilder-${{ env.bitrock_version }}-linux-x64 | |
- name: Download InstallBuilder | |
if: steps.cache-bitrock.outputs.cache-hit != 'true' | |
run: | | |
wget --retry-connrefused -t 10 -w 10 -T 60 -O ~/installbuilder.run ${{ env.bitrock_url }}/installbuilder-${{ env.bitrock_version }}-linux-x64-installer.run | |
- name: Install InstallBuilder | |
run: | | |
chmod 700 ~/installbuilder.run | |
~/installbuilder.run --mode unattended --prefix ~/installbuilder | |
cat >~/license.xml <<EOF | |
$BITROCK_LICENSE | |
EOF | |
env: | |
BITROCK_LICENSE: ${{ secrets.BITROCK_LICENSE }} | |
- name: Install dependencies | |
run: | | |
sudo apt-get -y install dbus-x11 libglu1-mesa-dev libopus-dev libsodium-dev libpulse-dev libdbus-1-dev libevent-dev libpng-dev ninja-build | |
pip3 install requests | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- name: Checkout externals | |
if: ${{ env.use_externals == 'true' }} | |
uses: actions/checkout@v4 | |
env: | |
EXTERNALS_PAT: ${{ secrets.EXTERNALS_PAT }} | |
with: | |
repository: ${{ env.externals }} | |
ref: ${{ env.externals_sha }} | |
token: ${{ env.EXTERNALS_PAT }} | |
path: 'third_party/externals' | |
- name: Start DBus session bus | |
run: | | |
dbus-launch --sh-syntax | tee session.sh | |
eval $(cat session.sh) | |
echo "DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS" >>$GITHUB_ENV | |
- name: Create Vatsim key file | |
if: ${{ env.do_vatsim_key == 'true' }} | |
run: | | |
cat >vatsim.json <<EOF | |
{ "vatsim": { "id": "$VATSIM_ID", "key": "$VATSIM_KEY" } } | |
EOF | |
env: | |
VATSIM_ID: ${{ secrets.VATSIM_ID }} | |
VATSIM_KEY: ${{ secrets.VATSIM_KEY }} | |
- uses: Trass3r/setup-cpp@1b63900ecf3f0b7c60ee53aa7be122f2c4fe7a2c | |
- name: Build swift (without symbols) | |
if: ${{ env.do_symbols != 'true' }} | |
run: | | |
python3 -u scripts/build.py -w 64 -t gcc | |
- name: Build swift (with symbols) | |
if: ${{ env.do_symbols == 'true' }} | |
run: | | |
python3 -u scripts/build.py -w 64 -t gcc --upload-symbols | |
- name: Upload installer | |
uses: actions/upload-artifact@v4 | |
with: | |
name: swiftinstaller-linux-64-${{ needs.preBuild.outputs.version }} | |
path: ${{ github.workspace }}/swiftinstaller-* | |
- name: Upload symbols | |
uses: actions/upload-artifact@v4 | |
if: ${{ env.do_symbols == 'true' }} | |
with: | |
name: swiftsymbols-linux-64-${{ needs.preBuild.outputs.version }} | |
path: ${{ github.workspace }}/swiftsymbols-* | |
- name: Upload xswiftbus | |
uses: actions/upload-artifact@v4 | |
with: | |
name: xswiftbus-thin-linux-64-${{ needs.preBuild.outputs.version }} | |
path: ${{ github.workspace }}/xswiftbus-* | |
buildWin64: | |
runs-on: windows-2022 | |
needs: [preBuild, checks] | |
env: | |
BACKTRACE_SYMBOL_TOKEN: ${{ secrets.BACKTRACE_SYMBOL_TOKEN }} | |
BACKTRACE_MINIDUMP_TOKEN: ${{ secrets.BACKTRACE_MINIDUMP_TOKEN }} | |
BITROCK_BUILDER: "~/installbuilder/bin/builder-cli.exe" | |
steps: | |
- name: Install Qt | |
uses: jurplel/install-qt-action@v3 | |
with: | |
version: ${{ env.qt_version }} | |
arch: win64_msvc2019_64 | |
cache: true | |
- name: Install Qt debug info | |
uses: jurplel/install-qt-action@v3 | |
with: | |
version: ${{ env.qt_version }} | |
arch: win64_msvc2019_64 | |
cache: true | |
modules: debug_info | |
extra: --archives qtbase | |
- name: Cache InstallBuilder | |
id: cache-bitrock | |
uses: actions/cache@v4 | |
with: | |
path: C:\installbuilder.exe | |
key: installbuilder-${{ env.bitrock_version }}-windows-x64 | |
- name: Download InstallBuilder | |
if: steps.cache-bitrock.outputs.cache-hit != 'true' | |
shell: C:\msys64\usr\bin\bash.exe -le {0} | |
run: | | |
wget --retry-connrefused -t 10 -w 10 -T 60 -O /c/installbuilder.exe ${{ env.bitrock_url }}/installbuilder-${{ env.bitrock_version }}-windows-x64-installer.exe | |
env: | |
MSYSTEM: MSYS2 | |
- name: Install InstallBuilder | |
run: | | |
start -wait "C:\installbuilder.exe" @("--mode", "unattended", "--prefix", "$HOME\installbuilder") | |
echo >$HOME\license.xml @" | |
$env:BITROCK_LICENSE | |
"@ | |
env: | |
BITROCK_LICENSE: ${{ secrets.BITROCK_LICENSE }} | |
- name: Install dependencies | |
run: | | |
pip install requests PyInstaller | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- name: Checkout externals | |
if: ${{ env.use_externals == 'true' }} | |
uses: actions/checkout@v4 | |
env: | |
EXTERNALS_PAT: ${{ secrets.EXTERNALS_PAT }} | |
with: | |
repository: ${{ env.externals }} | |
ref: ${{ env.externals_sha }} | |
token: ${{ env.EXTERNALS_PAT }} | |
path: 'third_party/externals' | |
- name: Create Vatsim key file | |
if: ${{ env.do_vatsim_key == 'true' }} | |
run: | | |
echo >vatsim.json @" | |
{ "vatsim": { "id": "$env:VATSIM_ID", "key": "$env:VATSIM_KEY" } } | |
"@ | |
env: | |
VATSIM_ID: ${{ secrets.VATSIM_ID }} | |
VATSIM_KEY: ${{ secrets.VATSIM_KEY }} | |
- uses: Trass3r/setup-cpp@1b63900ecf3f0b7c60ee53aa7be122f2c4fe7a2c | |
- name: Build swift (without symbols) | |
if: ${{ env.do_symbols != 'true' }} | |
run: | | |
python -u scripts/build.py -w 64 -t msvc | |
- name: Build swift (with symbols) | |
if: ${{ env.do_symbols == 'true' }} | |
run: | | |
python -u scripts/build.py -w 64 -t msvc --upload-symbols | |
- name: Upload installer | |
uses: actions/upload-artifact@v4 | |
with: | |
name: swiftinstaller-windows-64-${{ needs.preBuild.outputs.version }} | |
path: ${{ github.workspace }}/swiftinstaller-* | |
- name: Upload symbols | |
uses: actions/upload-artifact@v4 | |
if: ${{ env.do_symbols == 'true' }} | |
with: | |
name: swiftsymbols-windows-64-${{ needs.preBuild.outputs.version }} | |
path: ${{ github.workspace }}/swiftsymbols-* | |
- name: Upload xswiftbus | |
uses: actions/upload-artifact@v4 | |
with: | |
name: xswiftbus-thin-windows-64-${{ needs.preBuild.outputs.version }} | |
path: ${{ github.workspace }}/xswiftbus-* | |
buildMacOS: | |
runs-on: macos-13 | |
needs: [preBuild, checks] | |
env: | |
BACKTRACE_SYMBOL_TOKEN: ${{ secrets.BACKTRACE_SYMBOL_TOKEN }} | |
BACKTRACE_MINIDUMP_TOKEN: ${{ secrets.BACKTRACE_MINIDUMP_TOKEN }} | |
BITROCK_BUILDER: /Applications/installbuilder/bin/Builder.app/Contents/MacOS/installbuilder.sh | |
steps: | |
- name: Install Qt | |
uses: jurplel/install-qt-action@v3 | |
with: | |
version: ${{ env.qt_version }} | |
cache: true | |
- name: Cache InstallBuilder | |
id: cache-bitrock | |
uses: actions/cache@v4 | |
with: | |
path: ~/installbuilder.dmg | |
key: installbuilder-${{ env.bitrock_version }}-osx | |
- name: Download InstallBuilder | |
if: steps.cache-bitrock.outputs.cache-hit != 'true' | |
run: | | |
wget --retry-connrefused -t 10 -w 10 -T 60 -O $HOME/installbuilder.dmg ${{ env.bitrock_url }}/installbuilder-${{ env.bitrock_version }}-osx-installer.dmg | |
- name: Install InstallBuilder | |
run: | | |
chmod 700 $HOME/installbuilder.dmg | |
sudo hdiutil attach $HOME/installbuilder.dmg | |
sudo cp -rf "/Volumes/InstallBuilder Qt/installbuilder-${{ env.bitrock_version }}-osx-installer.app" /Applications | |
sudo hdiutil detach "/Volumes/InstallBuilder Qt" | |
sudo spctl --master-disable | |
sudo chmod -R +x /Applications/installbuilder-${{ env.bitrock_version }}-osx-installer.app | |
sudo xattr -r -d com.apple.quarantine /Applications/installbuilder-${{ env.bitrock_version }}-osx-installer.app | |
sudo /Applications/installbuilder-${{ env.bitrock_version }}-osx-installer.app/Contents/MacOs/installbuilder.sh --mode unattended --prefix /Applications/installbuilder | |
cat >~/license.xml <<EOF | |
$BITROCK_LICENSE | |
EOF | |
env: | |
BITROCK_LICENSE: ${{ secrets.BITROCK_LICENSE }} | |
- name: Install dependencies | |
run: | | |
pip3 install requests | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- name: Checkout externals | |
if: ${{ env.use_externals == 'true' }} | |
uses: actions/checkout@v4 | |
env: | |
EXTERNALS_PAT: ${{ secrets.EXTERNALS_PAT }} | |
with: | |
repository: ${{ env.externals }} | |
ref: ${{ env.externals_sha }} | |
token: ${{ env.EXTERNALS_PAT }} | |
path: 'third_party/externals' | |
- name: Create Vatsim key file | |
if: ${{ env.do_vatsim_key == 'true' }} | |
run: | | |
cat >vatsim.json <<EOF | |
{ "vatsim": { "id": "$VATSIM_ID", "key": "$VATSIM_KEY" } } | |
EOF | |
env: | |
VATSIM_ID: ${{ secrets.VATSIM_ID }} | |
VATSIM_KEY: ${{ secrets.VATSIM_KEY }} | |
- uses: Trass3r/setup-cpp@1b63900ecf3f0b7c60ee53aa7be122f2c4fe7a2c | |
- name: Build swift (without symbols) | |
if: ${{ env.do_symbols != 'true' }} | |
run: | | |
python3 -u scripts/build.py -w 64 -t clang | |
- name: Build swift (with symbols) | |
if: ${{ env.do_symbols == 'true' }} | |
run: | | |
python3 -u scripts/build.py -w 64 -t clang --upload-symbols | |
- name: Upload installer | |
uses: actions/upload-artifact@v4 | |
with: | |
name: swiftinstaller-macos-64-${{ needs.preBuild.outputs.version }} | |
path: ${{ github.workspace }}/swiftinstaller-* | |
- name: Upload symbols | |
uses: actions/upload-artifact@v4 | |
if: ${{ env.do_symbols == 'true' }} | |
with: | |
name: swiftsymbols-macos-64-${{ needs.preBuild.outputs.version }} | |
path: ${{ github.workspace }}/swiftsymbols-* | |
- name: Upload xswiftbus | |
uses: actions/upload-artifact@v4 | |
with: | |
name: xswiftbus-thin-macos-64-${{ needs.preBuild.outputs.version }} | |
path: ${{ github.workspace }}/xswiftbus-* | |
postBuild: | |
runs-on: ubuntu-22.04 | |
needs: [preBuild, checks, buildLinux, buildWin64, buildMacOS] | |
steps: | |
- name: Download xswiftbus-thin | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: xswiftbus-thin-* | |
merge-multiple: true | |
- name: Repackage xswiftbus | |
run: | | |
7z x -y xswiftbus-windows-64-*.7z | |
7z x -y xswiftbus-linux-64-*.7z | |
7z x -y xswiftbus-macos-64-*.7z | |
7z a -y -mx=9 xswiftbus-fat-allos-${{ needs.preBuild.outputs.version }}.7z xswiftbus | |
- name: Upload xswiftbus-fat | |
uses: actions/upload-artifact@v4 | |
with: | |
name: xswiftbus-fat-allos-${{ needs.preBuild.outputs.version }} | |
path: xswiftbus-fat-allos-* | |
- name: Remove xswiftbus-thin artifacts | |
uses: swift-project/delete-artifact@swift | |
with: | |
name: xswiftbus-thin-* | |
release: | |
runs-on: ubuntu-22.04 | |
needs: [preBuild, postBuild] | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
outputs: | |
id: ${{ steps.create.outputs.release_id }} | |
permissions: | |
id-token: write | |
contents: write | |
pages: write | |
environment: github-pages | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
- name: Flatten directories | |
run: | | |
mv swiftinstaller-*/* . | |
mv xswiftbus-*/* . | |
mkdir swiftsymbols | |
mv swiftsymbols-*/* swiftsymbols | |
- name: Create release | |
uses: swift-project/[email protected] | |
id: create | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: v${{ needs.preBuild.outputs.version }} | |
commitish: ${{ github.sha }} | |
body: Version ${{ needs.preBuild.outputs.version }} | |
draft: true | |
prerelease: true | |
gzip: folders | |
files: > | |
swiftinstaller-linux-64-${{ needs.preBuild.outputs.version }}.run | |
swiftinstaller-windows-64-${{ needs.preBuild.outputs.version }}.exe | |
swiftinstaller-macos-64-${{ needs.preBuild.outputs.version }}.dmg | |
xswiftbus-fat-allos-${{ needs.preBuild.outputs.version }}.7z | |
swiftsymbols-allos-${{ needs.preBuild.outputs.version }}:swiftsymbols | |
- name: Publish doxygen | |
uses: actions/deploy-pages@v4 | |
notify: | |
runs-on: ubuntu-22.04 | |
needs: [preBuild, checks, buildLinux, buildWin64, buildMacOS, postBuild, release] | |
if: always() | |
steps: | |
- name: Install dependencies | |
run: | | |
sudo apt-get -y install jo jq | |
- name: Query GitHub annotations | |
uses: octokit/[email protected] | |
id: checkruns | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
route: GET /repos/swift-project/pilotclient/commits/${{ github.sha }}/check-runs | |
- name: Prepare Discord build message | |
run: | | |
result=SKIPPED | |
${{ contains(needs.*.result, 'success') }} && result=SUCCESS | |
for run in $CHECK_RUNS; do | |
curl -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" \ | |
"https://api.github.com/repos/swift-project/pilotclient/check-runs/$run/annotations" \ | |
| jq -e 'any(.[].annotation_level; . == "warning" or . == "error")' && result=WARNING | |
done | |
${{ contains(needs.*.result, 'cancelled') }} && result=CANCELLED | |
${{ contains(needs.*.result, 'failure') }} && result=FAILED | |
[[ $result = SKIPPED ]] && emoji=repeat | |
[[ $result = SUCCESS ]] && emoji=white_check_mark | |
[[ $result = WARNING ]] && emoji=warning | |
[[ $result = CANCELLED ]] && emoji=grey_question | |
[[ $result = FAILED ]] && emoji=x | |
echo "result=$result" >>$GITHUB_ENV | |
echo "emoji=$emoji" >>$GITHUB_ENV | |
env: | |
CHECK_RUNS: ${{ join(fromJson(steps.checkruns.outputs.data).check_runs.*.id, ' ') }} | |
TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Prepare Discord release message | |
uses: octokit/[email protected] | |
if: ${{ needs.release.result == 'success' }} | |
id: release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
route: GET /repos/swift-project/pilotclient/releases/${{ needs.release.outputs.id }} | |
- name: Send Discord build message | |
run: | | |
cat >message <<EOF | |
> :${{ env.emoji }}: \`${{ github.ref }}\` | |
> **${{ env.result }}** (triggered by ${{ github.event_name }}) | |
> <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}> | |
EOF | |
jo content=@message | curl -i -H "Accept: application/json" -H "Content-Type: application/json" $WEBHOOK -d @- | |
env: | |
WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
- name: Send Discord release message | |
if: ${{ needs.release.result == 'success' }} | |
run: | | |
cat >message <<EOF | |
> :package: Created draft release \`v${{ needs.preBuild.outputs.version }}\` | |
> <${{ fromJson(steps.release.outputs.data).html_url }}> | |
EOF | |
jo content=@message | curl -i -H "Accept: application/json" -H "Content-Type: application/json" $WEBHOOK -d @- | |
env: | |
WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} |