mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
489 lines
19 KiB
YAML
489 lines
19 KiB
YAML
name: Build swift
|
|
|
|
on:
|
|
push:
|
|
branches-ignore:
|
|
- master
|
|
- nobuild/**
|
|
pull_request:
|
|
|
|
env:
|
|
do_vatsim_key: ${{ github.event_name == 'push' }}
|
|
do_symbols: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/develop/') }}
|
|
eol_months: 12
|
|
qt_version: 5.15.0
|
|
bitrock_version: qt-professional-20.6.0
|
|
|
|
jobs:
|
|
|
|
preBuild:
|
|
runs-on: ubuntu-20.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@v2
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Get version number
|
|
id: version
|
|
run: |
|
|
echo "::set-output name=value::$(python3 -u scripts/build.py --version)"
|
|
- name: Remove artifacts
|
|
uses: swift-project/delete-artifact@swift
|
|
with:
|
|
name: |
|
|
xswiftbus-thin-allos-${{ steps.version.outputs.value }}
|
|
xswiftbus-fat-allos-${{ steps.version.outputs.value }}
|
|
swiftsymbols-allos-${{ steps.version.outputs.value }}
|
|
swiftinstaller-linux-64-${{ steps.version.outputs.value }}
|
|
swiftinstaller-windows-64-${{ steps.version.outputs.value }}
|
|
swiftinstaller-windows-32-${{ steps.version.outputs.value }}
|
|
swiftinstaller-macos-64-${{ steps.version.outputs.value }}
|
|
failOnError: false
|
|
warnIfNotFound: false
|
|
|
|
checks:
|
|
runs-on: ubuntu-20.04
|
|
needs: preBuild
|
|
outputs:
|
|
warnings: ${{ steps.cppcheck.outputs.warnings }}
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v2
|
|
with:
|
|
submodules: true
|
|
- name: Run cppcheck
|
|
id: cppcheck
|
|
run: |
|
|
sudo apt install cppcheck
|
|
sudo cpan Path::Class
|
|
cppcheck --template=gcc --inline-suppr --std=c++14 --enable=style,unusedFunction -i externals \
|
|
--suppressions-list=cppcheck.supp --library=qt.cfg --library=posix.cfg . 2> >(tee error.log >&2)
|
|
perl scripts/warnings.pl error.log
|
|
|
|
buildLinux:
|
|
runs-on: ubuntu-16.04
|
|
needs: preBuild
|
|
env:
|
|
BACKTRACE_TOKEN: ${{ secrets.BACKTRACE_TOKEN }}
|
|
BITROCK_BUILDER: ~/installbuilder/bin/builder
|
|
QDOC_PATH: $(GITHUB_WORKSPACE)/../Qt/Docs/Qt-$(qt_version)
|
|
outputs:
|
|
warnings: ${{ steps.warnings.outputs.warnings }}
|
|
|
|
steps:
|
|
- name: Install Qt
|
|
uses: swift-project/install-qt-action@swift
|
|
with:
|
|
version: ${{ env.qt_version }}
|
|
aqtversion: ==0.9.2
|
|
doc: true
|
|
- name: Download InstallBuilder
|
|
run: |
|
|
wget -O ~/installbuilder.run https://installbuilder.com/installbuilder-${{ env.bitrock_version }}-linux-x64-installer.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 install doxygen graphviz libglu1-mesa-dev libopus-dev libsodium-dev libpulse-dev libdbus-1-dev libevent-dev
|
|
sudo cpan Path::Class
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v2
|
|
with:
|
|
submodules: true
|
|
fetch-depth: 0
|
|
- name: Create Vatsim key file
|
|
if: ${{ env.do_vatsim_key == 'true' }}
|
|
run: |
|
|
cat >vatsim.json <<EOF
|
|
{ "vatsim": { "id": "$VATSIM_ID", "key": "$VATSIM_KEY" } }
|
|
EOF
|
|
echo "::set-env name=vatsim_key_file::vatsim.json"
|
|
env:
|
|
VATSIM_ID: ${{ secrets.VATSIM_ID }}
|
|
VATSIM_KEY: ${{ secrets.VATSIM_KEY }}
|
|
- name: Build swift (without symbols)
|
|
if: ${{ env.do_symbols != 'true' }}
|
|
run: |
|
|
python3 -u scripts/build.py -w 64 -t gcc -d -j2 -e $eol_months -q "SWIFT_CONFIG_JSON+=$vatsim_key_file" 2> >(tee error.log >&2)
|
|
- name: Build swift (with symbols)
|
|
if: ${{ env.do_symbols == 'true' }}
|
|
run: |
|
|
python3 -u scripts/build.py -w 64 -t gcc -d -j2 -e $eol_months -q "SWIFT_CONFIG_JSON+=$vatsim_key_file" --upload 2> >(tee error.log >&2)
|
|
- name: Check warnings
|
|
id: warnings
|
|
run: |
|
|
perl scripts/warnings.pl error.log
|
|
- name: Upload installer
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: swiftinstaller-linux-64-${{ needs.preBuild.outputs.version }}
|
|
path: ${{ github.workspace }}/swiftinstaller-*
|
|
- name: Upload symbols
|
|
uses: actions/upload-artifact@v2
|
|
if: ${{ env.do_symbols == 'true' }}
|
|
with:
|
|
name: swiftsymbols-allos-${{ needs.preBuild.outputs.version }}
|
|
path: ${{ github.workspace }}/swiftsymbols-*
|
|
- name: Upload xswiftbus
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: xswiftbus-thin-allos-${{ needs.preBuild.outputs.version }}
|
|
path: ${{ github.workspace }}/xswiftbus-*
|
|
|
|
buildWin64:
|
|
runs-on: windows-2019
|
|
needs: preBuild
|
|
env:
|
|
BACKTRACE_TOKEN: ${{ secrets.BACKTRACE_TOKEN }}
|
|
BITROCK_BUILDER: "$(USERPROFILE)/installbuilder/bin/builder-cli.exe"
|
|
outputs:
|
|
warnings: ${{ steps.warnings.outputs.warnings }}
|
|
|
|
steps:
|
|
- name: Install Qt
|
|
uses: jurplel/install-qt-action@v2
|
|
with:
|
|
version: ${{ env.qt_version }}
|
|
arch: win64_msvc2019_64
|
|
aqtversion: ==0.9.2
|
|
- name: Install Qt debug info
|
|
uses: jurplel/install-qt-action@v2
|
|
with:
|
|
version: ${{ env.qt_version }}
|
|
arch: win64_msvc2019_64
|
|
aqtversion: ==0.9.2
|
|
modules: debug_info
|
|
extra: --archives qtbase
|
|
- name: Download InstallBuilder
|
|
run: |
|
|
curl.exe --output "$HOME\installbuilder.exe" -L --url https://installbuilder.com/installbuilder-${{ env.bitrock_version }}-windows-x64-installer.exe
|
|
start -wait "$HOME\installbuilder.exe" @("--mode", "unattended", "--prefix", "$HOME\installbuilder")
|
|
echo >$HOME\license.xml @"
|
|
$env:BITROCK_LICENSE
|
|
"@
|
|
env:
|
|
BITROCK_LICENSE: ${{ secrets.BITROCK_LICENSE }}
|
|
- name: Install dependencies
|
|
run: |
|
|
choco install jom --yes
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v2
|
|
with:
|
|
submodules: true
|
|
fetch-depth: 0
|
|
- name: Create Vatsim key file
|
|
if: ${{ env.do_vatsim_key == 'true' }}
|
|
run: |
|
|
echo >vatsim.json @"
|
|
{ "vatsim": { "id": "$env:VATSIM_ID", "key": "$env:VATSIM_KEY" } }
|
|
"@
|
|
echo "::set-env name=vatsim_key_file::vatsim.json"
|
|
env:
|
|
VATSIM_ID: ${{ secrets.VATSIM_ID }}
|
|
VATSIM_KEY: ${{ secrets.VATSIM_KEY }}
|
|
- name: Build swift (without symbols)
|
|
if: ${{ env.do_symbols != 'true' }}
|
|
shell: bash
|
|
run: |
|
|
python -u scripts/build.py -w 64 -t msvc -d -e $eol_months -q "SWIFT_CONFIG_JSON+=$vatsim_key_file" 2>&1 | tee error.log
|
|
- name: Build swift (with symbols)
|
|
if: ${{ env.do_symbols == 'true' }}
|
|
shell: bash
|
|
run: |
|
|
python -u scripts/build.py -w 64 -t msvc -d -e $eol_months -q "SWIFT_CONFIG_JSON+=$vatsim_key_file" --upload 2>&1 | tee error.log
|
|
- name: Check warnings
|
|
id: warnings
|
|
run: |
|
|
perl.exe scripts\warnings.pl error.log
|
|
- name: Upload installer
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: swiftinstaller-windows-64-${{ needs.preBuild.outputs.version }}
|
|
path: ${{ github.workspace }}/swiftinstaller-*
|
|
- name: Upload symbols
|
|
uses: actions/upload-artifact@v2
|
|
if: ${{ env.do_symbols == 'true' }}
|
|
with:
|
|
name: swiftsymbols-allos-${{ needs.preBuild.outputs.version }}
|
|
path: ${{ github.workspace }}/swiftsymbols-*
|
|
- name: Upload xswiftbus
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: xswiftbus-thin-allos-${{ needs.preBuild.outputs.version }}
|
|
path: ${{ github.workspace }}/xswiftbus-*
|
|
|
|
buildWin32:
|
|
runs-on: windows-2019
|
|
needs: preBuild
|
|
env:
|
|
BACKTRACE_TOKEN: ${{ secrets.BACKTRACE_TOKEN }}
|
|
BITROCK_BUILDER: "$(USERPROFILE)/installbuilder/bin/builder-cli.exe"
|
|
outputs:
|
|
warnings: ${{ steps.warnings.outputs.warnings }}
|
|
|
|
steps:
|
|
- name: Install Qt
|
|
uses: jurplel/install-qt-action@v2
|
|
with:
|
|
version: ${{ env.qt_version }}
|
|
arch: win32_msvc2019
|
|
aqtversion: ==0.9.2
|
|
- name: Install Qt debug info
|
|
uses: jurplel/install-qt-action@v2
|
|
with:
|
|
version: ${{ env.qt_version }}
|
|
arch: win32_msvc2019
|
|
aqtversion: ==0.9.2
|
|
modules: debug_info
|
|
extra: --archives qtbase
|
|
- name: Download InstallBuilder
|
|
run: |
|
|
curl.exe --output "$HOME\installbuilder.exe" -L --url https://installbuilder.com/installbuilder-${{ env.bitrock_version }}-windows-installer.exe
|
|
start -wait "$HOME\installbuilder.exe" @("--mode", "unattended", "--prefix", "$HOME\installbuilder")
|
|
echo >$HOME\license.xml @"
|
|
$env:BITROCK_LICENSE
|
|
"@
|
|
env:
|
|
BITROCK_LICENSE: ${{ secrets.BITROCK_LICENSE }}
|
|
- name: Install dependencies
|
|
run: |
|
|
choco install jom --yes
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v2
|
|
with:
|
|
submodules: true
|
|
fetch-depth: 0
|
|
- name: Create Vatsim key file
|
|
if: ${{ env.do_vatsim_key == 'true' }}
|
|
run: |
|
|
echo >vatsim.json @"
|
|
{ "vatsim": { "id": "$env:VATSIM_ID", "key": "$env:VATSIM_KEY" } }
|
|
"@
|
|
echo "::set-env name=vatsim_key_file::vatsim.json"
|
|
env:
|
|
VATSIM_ID: ${{ secrets.VATSIM_ID }}
|
|
VATSIM_KEY: ${{ secrets.VATSIM_KEY }}
|
|
- name: Build swift (without symbols)
|
|
if: ${{ env.do_symbols != 'true' }}
|
|
shell: bash
|
|
run: |
|
|
python -u scripts/build.py -w 32 -t msvc -d -e $eol_months -q "SWIFT_CONFIG_JSON+=$vatsim_key_file" 2>&1 | tee error.log
|
|
- name: Build swift (with symbols)
|
|
if: ${{ env.do_symbols == 'true' }}
|
|
shell: bash
|
|
run: |
|
|
python -u scripts/build.py -w 32 -t msvc -d -e $eol_months -q "SWIFT_CONFIG_JSON+=$vatsim_key_file" --upload 2>&1 | tee error.log
|
|
- name: Check warnings
|
|
id: warnings
|
|
run: |
|
|
perl.exe scripts\warnings.pl error.log
|
|
- name: Upload installer
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: swiftinstaller-windows-32-${{ needs.preBuild.outputs.version }}
|
|
path: ${{ github.workspace }}/swiftinstaller-*
|
|
- name: Upload symbols
|
|
uses: actions/upload-artifact@v2
|
|
if: ${{ env.do_symbols == 'true' }}
|
|
with:
|
|
name: swiftsymbols-allos-${{ needs.preBuild.outputs.version }}
|
|
path: ${{ github.workspace }}/swiftsymbols-*
|
|
|
|
buildMacOS:
|
|
runs-on: macos-10.15
|
|
needs: preBuild
|
|
env:
|
|
BACKTRACE_TOKEN: ${{ secrets.BACKTRACE_TOKEN }}
|
|
BITROCK_BUILDER: /Applications/installbuilder/bin/Builder.app/Contents/MacOS/installbuilder.sh
|
|
outputs:
|
|
warnings: ${{ steps.warnings.outputs.warnings }}
|
|
|
|
steps:
|
|
- name: Install Qt
|
|
uses: jurplel/install-qt-action@v2
|
|
with:
|
|
version: ${{ env.qt_version }}
|
|
aqtversion: ==0.9.2
|
|
- name: Download InstallBuilder
|
|
run: |
|
|
wget -O $HOME/installbuilder.dmg https://installbuilder.com/installbuilder-${{ env.bitrock_version }}-osx-installer.dmg
|
|
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
|
|
cpan Path::Class
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v2
|
|
with:
|
|
submodules: true
|
|
fetch-depth: 0
|
|
- name: Create Vatsim key file
|
|
if: ${{ env.do_vatsim_key == 'true' }}
|
|
run: |
|
|
cat >vatsim.json <<EOF
|
|
{ "vatsim": { "id": "$VATSIM_ID", "key": "$VATSIM_KEY" } }
|
|
EOF
|
|
echo "::set-env name=vatsim_key_file::vatsim.json"
|
|
env:
|
|
VATSIM_ID: ${{ secrets.VATSIM_ID }}
|
|
VATSIM_KEY: ${{ secrets.VATSIM_KEY }}
|
|
- name: Build swift (without symbols)
|
|
if: ${{ env.do_symbols != 'true' }}
|
|
run: |
|
|
python3 -u scripts/build.py -w 64 -t clang -d -j2 -e $eol_months -q "SWIFT_CONFIG_JSON+=$vatsim_key_file" 2> >(tee error.log >&2)
|
|
- name: Build swift (with symbols)
|
|
if: ${{ env.do_symbols == 'true' }}
|
|
run: |
|
|
python3 -u scripts/build.py -w 64 -t clang -d -j2 -e $eol_months -q "SWIFT_CONFIG_JSON+=$vatsim_key_file" --upload 2> >(tee error.log >&2)
|
|
- name: Check warnings
|
|
id: warnings
|
|
run: |
|
|
perl scripts/warnings.pl error.log
|
|
- name: Upload installer
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: swiftinstaller-macos-64-${{ needs.preBuild.outputs.version }}
|
|
path: ${{ github.workspace }}/swiftinstaller-*
|
|
- name: Upload symbols
|
|
uses: actions/upload-artifact@v2
|
|
if: ${{ env.do_symbols == 'true' }}
|
|
with:
|
|
name: swiftsymbols-allos-${{ needs.preBuild.outputs.version }}
|
|
path: ${{ github.workspace }}/swiftsymbols-*
|
|
- name: Upload xswiftbus
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: xswiftbus-thin-allos-${{ needs.preBuild.outputs.version }}
|
|
path: ${{ github.workspace }}/xswiftbus-*
|
|
|
|
postBuild:
|
|
runs-on: ubuntu-20.04
|
|
needs: [preBuild, checks, buildLinux, buildWin64, buildWin32, buildMacOS]
|
|
|
|
steps:
|
|
- name: Download xswiftbus-thin
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: xswiftbus-thin-allos-${{ needs.preBuild.outputs.version }}
|
|
- 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@v2
|
|
with:
|
|
name: xswiftbus-fat-allos-${{ needs.preBuild.outputs.version }}
|
|
path: xswiftbus-fat-allos-*
|
|
- name: Remove xswiftbus-thin
|
|
uses: swift-project/delete-artifact@swift
|
|
with:
|
|
name: xswiftbus-thin-allos-${{ needs.preBuild.outputs.version }}
|
|
|
|
release:
|
|
runs-on: ubuntu-20.04
|
|
needs: [preBuild, postBuild]
|
|
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/develop/') }}
|
|
outputs:
|
|
id: ${{ steps.create.outputs.release_id }}
|
|
|
|
steps:
|
|
- name: Download artifacts
|
|
uses: actions/download-artifact@v2
|
|
- name: Flatten directories
|
|
run: |
|
|
mv swiftinstaller-*/* .
|
|
mv xswiftbus-*/* .
|
|
- name: Create release
|
|
uses: meeDamian/github-release@2.0
|
|
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: false
|
|
files: >
|
|
swiftinstaller-linux-64-${{ needs.preBuild.outputs.version }}.run
|
|
swiftinstaller-windows-64-${{ needs.preBuild.outputs.version }}.exe
|
|
swiftinstaller-windows-32-${{ needs.preBuild.outputs.version }}.exe
|
|
swiftinstaller-macos-64-${{ needs.preBuild.outputs.version }}.dmg
|
|
xswiftbus-fat-allos-${{ needs.preBuild.outputs.version }}.7z
|
|
|
|
notify:
|
|
runs-on: ubuntu-20.04
|
|
needs: [preBuild, checks, buildLinux, buildWin64, buildWin32, buildMacOS, postBuild, release]
|
|
if: always()
|
|
|
|
steps:
|
|
- name: Prepare Discord build message
|
|
run: |
|
|
result=SKIPPED
|
|
${{ contains(needs.*.result, 'success') }} && result=SUCCESS
|
|
${{ contains(needs.*.outputs.warnings, 'true') }} && result=WARNING
|
|
${{ 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 "::set-env name=result::$result"
|
|
echo "::set-env name=emoji::$emoji"
|
|
- name: Prepare Discord release message
|
|
uses: satackey/action-js-inline@v0.0.2
|
|
if: ${{ needs.release.result == 'success' }}
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
script: |
|
|
const core = require('@actions/core');
|
|
const github = require('@actions/github');
|
|
const octokit = github.getOctokit(process.env.GITHUB_TOKEN);
|
|
const query = { owner: 'swift-project', repo: 'pilotclient', release_id: ${{ needs.release.outputs.id }} };
|
|
const release = await octokit.repos.getRelease(query);
|
|
core.exportVariable('url', release.data.html_url);
|
|
- name: Send Discord build message
|
|
uses: appleboy/discord-action@0.0.3
|
|
with:
|
|
webhook_id: ${{ secrets.DISCORD_ID }}
|
|
webhook_token: ${{ secrets.DISCORD_TOKEN }}
|
|
message: |
|
|
> :${{ env.emoji }}: `${{ github.ref }}`
|
|
> **${{ env.result }}** (triggered by ${{ github.event_name }})
|
|
> <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}>
|
|
- name: Send Discord release message
|
|
uses: appleboy/discord-action@0.0.3
|
|
if: ${{ needs.release.result == 'success' }}
|
|
with:
|
|
webhook_id: ${{ secrets.DISCORD_ID }}
|
|
webhook_token: ${{ secrets.DISCORD_TOKEN }}
|
|
message: |
|
|
> :package: Created draft release `v${{ needs.preBuild.outputs.version }}`
|
|
> <${{ env.url }}>
|