name: Build swift on: push: branches-ignore: - master - nobuild/** env: do_symbols: ${{ startsWith(github.ref, 'refs/heads/develop/') }} eol_months: 12 BASH_KEY_ARGS: -q 'SWIFT_CONFIG.vatsim.id=$$(VATSIM_ID)' -q 'SWIFT_CONFIG.vatsim.key=$$(VATSIM_KEY)' PWSH_KEY_ARGS: --% -q "SWIFT_CONFIG.vatsim.id=$$(VATSIM_ID)" -q "SWIFT_CONFIG.vatsim.key=$$(VATSIM_KEY)" jobs: preBuild: runs-on: ubuntu-20.04 outputs: version: ${{ steps.version.outputs.value }} steps: - name: Checkout repository uses: actions/checkout@v2 with: submodules: true fetch-depth: 0 - name: Get version number id: version run: | pip3 install tee echo "::set-output name=value::$(python3 -u scripts/build.py --version)" - name: Run cppcheck run: | sudo apt install cppcheck cppcheck --template=gcc --inline-suppr --std=c++14 --enable=style,unusedFunction -i externals \ --suppressions-list=cppcheck.supp --library=qt.cfg --library=posix.cfg . | tee error.log ls -l error.log - name: Remove artifacts uses: swift-project/delete-artifact@swift with: name: xswiftbus-thin-allos-${{ steps.version.outputs.value }} failOnError: false warnIfNotFound: false buildLinux: runs-on: ubuntu-16.04 needs: preBuild env: BITROCK_BUILDER: ~/installbuilder/bin/builder steps: - name: Install Qt uses: jurplel/install-qt-action@v2 with: version: 5.15.0 aqtversion: ==0.8 - name: Download InstallBuilder run: | wget -O ~/installbuilder.run https://installbuilder.com/installbuilder-qt-professional-20.4.0-linux-x64-installer.run chmod 700 ~/installbuilder.run ~/installbuilder.run --mode unattended --prefix ~/installbuilder - name: Install dependencies run: | sudo apt install doxygen graphviz libglu1-mesa-dev libopus-dev libsodium-dev libpulse-dev libdbus-1-dev libevent-dev pip3 install tee - name: Checkout repository uses: actions/checkout@v2 with: submodules: true fetch-depth: 0 - name: Build swift (without symbols) if: ${{ ! env.do_symbols }} run: | python3 -u scripts/build.py -w 64 -t gcc -d -j2 -e $eol_months $BASH_KEY_ARGS ls -l error.log env: VATSIM_ID: ${{ secrets.VATSIM_ID }} VATSIM_KEY: ${{ secrets.VATSIM_KEY }} - name: Build swift (with symbols) if: ${{ env.do_symbols }} run: | python3 -u scripts/build.py -w 64 -t gcc -d -j2 -e $eol_months $BASH_KEY_ARGS --upload ls -l error.log env: VATSIM_ID: ${{ secrets.VATSIM_ID }} VATSIM_KEY: ${{ secrets.VATSIM_KEY }} - 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 }} 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: BITROCK_BUILDER: "$(USERPROFILE)/installbuilder/bin/builder-cli.exe" steps: - name: Install Qt uses: jurplel/install-qt-action@v2 with: version: 5.15.0 arch: "win64_msvc2019_64" aqtversion: ">=0.9.0" - name: Download InstallBuilder run: | curl.exe --output "$HOME\installbuilder.exe" -L --url https://installbuilder.com/installbuilder-qt-professional-20.4.0-windows-x64-installer.exe start -wait "$HOME\installbuilder.exe" @("--mode", "unattended", "--prefix", "$HOME\installbuilder") - name: Install dependencies run: | choco install jom --yes pip install tee - name: Checkout repository uses: actions/checkout@v2 with: submodules: true fetch-depth: 0 - name: Build swift (without symbols) if: ${{ ! env.do_symbols }} run: | python.exe -u scripts\build.py -w 64 -t msvc -d -e $env:eol_months ${{ env.PWSH_KEY_ARGS }} dir error.log env: VATSIM_ID: ${{ secrets.VATSIM_ID }} VATSIM_KEY: ${{ secrets.VATSIM_KEY }} - name: Build swift (with symbols) if: ${{ env.do_symbols }} run: | python.exe -u scripts\build.py -w 64 -t msvc -d -e $env:eol_months ${{ env.PWSH_KEY_ARGS }} --upload dir error.log env: VATSIM_ID: ${{ secrets.VATSIM_ID }} VATSIM_KEY: ${{ secrets.VATSIM_KEY }} - 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 }} 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: BITROCK_BUILDER: "$(USERPROFILE)/installbuilder/bin/builder-cli.exe" steps: - name: Install Qt uses: jurplel/install-qt-action@v2 with: version: 5.15.0 arch: "win32_msvc2019" aqtversion: ">=0.9.0" - name: Download InstallBuilder run: | curl.exe --output "$HOME\installbuilder.exe" -L --url https://installbuilder.com/installbuilder-qt-professional-20.4.0-windows-installer.exe start -wait "$HOME\installbuilder.exe" @("--mode", "unattended", "--prefix", "$HOME\installbuilder") - name: Install dependencies run: | choco install jom --yes pip install tee - name: Checkout repository uses: actions/checkout@v2 with: submodules: true fetch-depth: 0 - name: Build swift (without symbols) if: ${{ ! env.do_symbols }} run: | python.exe -u scripts\build.py -w 32 -t msvc -d -e $env:eol_months ${{ env.PWSH_KEY_ARGS }} dir error.log env: VATSIM_ID: ${{ secrets.VATSIM_ID }} VATSIM_KEY: ${{ secrets.VATSIM_KEY }} - name: Build swift (with symbols) if: ${{ env.do_symbols }} run: | python.exe -u scripts\build.py -w 32 -t msvc -d -e $env:eol_months ${{ env.PWSH_KEY_ARGS }} --upload dir error.log env: VATSIM_ID: ${{ secrets.VATSIM_ID }} VATSIM_KEY: ${{ secrets.VATSIM_KEY }} - 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 }} 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-* buildMacOS: runs-on: macos-10.15 needs: preBuild env: BITROCK_BUILDER: /Applications/installbuilder/bin/Builder.app/Contents/MacOS/installbuilder.sh steps: - name: Install Qt uses: jurplel/install-qt-action@v2 with: version: 5.15.0 - name: Download InstallBuilder run: | wget -O $HOME/installbuilder.dmg https://installbuilder.com/installbuilder-qt-professional-20.4.0-osx-installer.dmg chmod 700 $HOME/installbuilder.dmg sudo hdiutil attach $HOME/installbuilder.dmg sudo cp -rf "/Volumes/InstallBuilder Qt/installbuilder-qt-professional-20.4.0-osx-installer.app" /Applications sudo hdiutil detach "/Volumes/InstallBuilder Qt" sudo spctl --master-disable sudo chmod -R +x /Applications/installbuilder-qt-professional-20.4.0-osx-installer.app sudo xattr -r -d com.apple.quarantine /Applications/installbuilder-qt-professional-20.4.0-osx-installer.app sudo /Applications/installbuilder-qt-professional-20.4.0-osx-installer.app/Contents/MacOs/installbuilder.sh --mode unattended --prefix /Applications/installbuilder - name: Install dependencies run: | pip3 install requests pip3 install tee - name: Checkout repository uses: actions/checkout@v2 with: submodules: true fetch-depth: 0 - name: Build swift (without symbols) if: ${{ ! env.do_symbols }} run: | python3 -u scripts/build.py -w 64 -t clang -d -j2 -e $eol_months $BASH_KEY_ARGS ls -l error.log env: VATSIM_ID: ${{ secrets.VATSIM_ID }} VATSIM_KEY: ${{ secrets.VATSIM_KEY }} - name: Build swift (with symbols) if: ${{ env.do_symbols }} run: | python3 -u scripts/build.py -w 64 -t clang -d -j2 -e $eol_months $BASH_KEY_ARGS --upload ls -l error.log env: VATSIM_ID: ${{ secrets.VATSIM_ID }} VATSIM_KEY: ${{ secrets.VATSIM_KEY }} - 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 }} 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, 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-32-*.7z 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 }} notify: runs-on: ubuntu-20.04 needs: [preBuild, buildLinux, buildWin64, buildWin32, buildMacOS, postBuild] if: always() steps: - name: Prepare Discord message run: | result=SUCCESS echo ${{ join(needs.*.result, ' ') }} | grep -q cancel && result=CANCELLED echo ${{ join(needs.*.result, ' ') }} | grep -q fail && result=FAILED [[ $result = SUCCESS ]] && emoji=white_check_mark [[ $result = CANCELLED ]] && emoji=grey_question [[ $result = FAILED ]] && emoji=x echo "::set-env name=result::$result" echo "::set-env name=emoji::$emoji" - name: Send Discord message uses: appleboy/discord-action@0.0.3 with: webhook_id: ${{ secrets.DISCORD_ID }} webhook_token: ${{ secrets.DISCORD_TOKEN }} message: | > `${{ github.ref }}` > :${{ env.emoji }}: **${{ env.result }}** (triggered by ${{ github.event_name }}) >