diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 691817850..7c3b81082 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,24 +15,32 @@ env: jobs: preBuild: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 + outputs: + version: ${{ steps.version.outputs.value }} steps: - - name: Remove artifacts - uses: geekyeggo/delete-artifact@v1 - with: - name: xswiftbus-thin-allos-${{ github.run_id }} - failOnError: false - 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: geekyeggo/delete-artifact@v1 + with: + name: xswiftbus-thin-allos-${{ steps.version.outputs.value }} + failOnError: false buildLinux: runs-on: ubuntu-16.04 @@ -76,25 +84,21 @@ jobs: env: VATSIM_ID: ${{ secrets.VATSIM_ID }} VATSIM_KEY: ${{ secrets.VATSIM_KEY }} - - name: Get version number - run: | - SWIFT_VERSION=$(ls swiftinstaller-* | grep -o -E '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+') - echo "::set-env name=swift_version::$SWIFT_VERSION" - name: Upload installer uses: actions/upload-artifact@v2 with: - name: swiftinstaller-linux-64-${{ env.swift_version }} + 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-${{ env.swift_version }} + name: swiftsymbols-allos-${{ needs.preBuild.outputs.version }} path: ${{ github.workspace }}/swiftsymbols-* - name: Upload xswiftbus uses: actions/upload-artifact@v2 with: - name: xswiftbus-thin-allos-${{ github.run_id }} + name: xswiftbus-thin-allos-${{ needs.preBuild.outputs.version }} path: ${{ github.workspace }}/xswiftbus-* buildWin64: @@ -110,7 +114,7 @@ jobs: version: 5.15.0 arch: "win64_msvc2019_64" aqtversion: ">=0.9.0" - - name: Install InstallBuilder + - 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") @@ -139,26 +143,21 @@ jobs: env: VATSIM_ID: ${{ secrets.VATSIM_ID }} VATSIM_KEY: ${{ secrets.VATSIM_KEY }} - - name: Get version number - shell: bash - run: | - SWIFT_VERSION=$(ls swiftinstaller-* | grep -o -E '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+') - echo "::set-env name=swift_version::$SWIFT_VERSION" - name: Upload installer uses: actions/upload-artifact@v2 with: - name: swiftinstaller-windows-64-${{ env.swift_version }} + 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-${{ env.swift_version }} + name: swiftsymbols-allos-${{ needs.preBuild.outputs.version }} path: ${{ github.workspace }}/swiftsymbols-* - name: Upload xswiftbus uses: actions/upload-artifact@v2 with: - name: xswiftbus-thin-allos-${{ github.run_id }} + name: xswiftbus-thin-allos-${{ needs.preBuild.outputs.version }} path: ${{ github.workspace }}/xswiftbus-* buildWin32: @@ -174,7 +173,7 @@ jobs: version: 5.15.0 arch: "win32_msvc2019" aqtversion: ">=0.9.0" - - name: Install InstallBuilder + - 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") @@ -203,26 +202,21 @@ jobs: env: VATSIM_ID: ${{ secrets.VATSIM_ID }} VATSIM_KEY: ${{ secrets.VATSIM_KEY }} - - name: Get version number - shell: bash - run: | - SWIFT_VERSION=$(ls swiftinstaller-* | grep -o -E '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+') - echo "::set-env name=swift_version::$SWIFT_VERSION" - name: Upload installer uses: actions/upload-artifact@v2 with: - name: swiftinstaller-windows-32-${{ env.swift_version }} + 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-${{ env.swift_version }} + name: swiftsymbols-allos-${{ needs.preBuild.outputs.version }} path: ${{ github.workspace }}/swiftsymbols-* - name: Upload xswiftbus uses: actions/upload-artifact@v2 with: - name: xswiftbus-thin-allos-${{ github.run_id }} + name: xswiftbus-thin-allos-${{ needs.preBuild.outputs.version }} path: ${{ github.workspace }}/xswiftbus-* buildMacOS: @@ -272,57 +266,51 @@ jobs: env: VATSIM_ID: ${{ secrets.VATSIM_ID }} VATSIM_KEY: ${{ secrets.VATSIM_KEY }} - - name: Get version number - run: | - SWIFT_VERSION=$(ls swiftinstaller-* | grep -o -E '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+') - echo "::set-env name=swift_version::$SWIFT_VERSION" - name: Upload installer uses: actions/upload-artifact@v2 with: - name: swiftinstaller-macos-64-${{ env.swift_version }} + 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-${{ env.swift_version }} + name: swiftsymbols-allos-${{ needs.preBuild.outputs.version }} path: ${{ github.workspace }}/swiftsymbols-* - name: Upload xswiftbus uses: actions/upload-artifact@v2 with: - name: xswiftbus-thin-allos-${{ github.run_id }} + name: xswiftbus-thin-allos-${{ needs.preBuild.outputs.version }} path: ${{ github.workspace }}/xswiftbus-* postBuild: - runs-on: ubuntu-latest - needs: [buildLinux, buildWin64, buildWin32, buildMacOS] + 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-${{ github.run_id }} + 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 - SWIFT_VERSION=$(ls xswiftbus-windows-32-*.7z | grep -o -E '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+') - echo "::set-env name=swift_version::$SWIFT_VERSION" - 7z a -y -mx=9 xswiftbus-fat-allos-${SWIFT_VERSION}.7z xswiftbus + 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-${{ env.swift_version }} + name: xswiftbus-fat-allos-${{ needs.preBuild.outputs.version }} path: xswiftbus-fat-allos-* - name: Remove xswiftbus-thin uses: geekyeggo/delete-artifact@v1 with: - name: xswiftbus-thin-allos-${{ github.run_id }} + name: xswiftbus-thin-allos-${{ needs.preBuild.outputs.version }} notify: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 needs: [preBuild, buildLinux, buildWin64, buildWin32, buildMacOS, postBuild] if: always() diff --git a/scripts/build.py b/scripts/build.py index 8e3e05b3f..598d145ab 100644 --- a/scripts/build.py +++ b/scripts/build.py @@ -37,6 +37,7 @@ class Builder: Build processes will be called with the environment modified by this function. """ print('Preparing environment ...') + self.make_cmd = self._get_make_cmd() os.environ['PATH'] += os.pathsep + self._get_qt_binary_path() self._specific_prepare() @@ -252,7 +253,6 @@ class Builder: self.qt_path = path.abspath(self.__config.get(platform.system(), 'qt_path')) self.dump_syms = path.abspath(self.__config.get(platform.system(), 'dump_syms')) - self.make_cmd = self._get_make_cmd() self.version = self.__get_swift_version() def __get_config_file(self): @@ -412,7 +412,7 @@ def print_help(): 'Windows': ['msvc', 'mingw'] } compiler_help = '|'.join(supported_compilers[platform.system()]) - print('build.py -c -w <32|64> -t <' + compiler_help + '> [-d] [-e ] [-q ]') + print('build.py -c -w <32|64> -t <' + compiler_help + '> [-v] [-d] [-e ] [-q ]') # Entry point if called as a standalone program @@ -427,12 +427,12 @@ def main(argv): qmake_args = [] try: - opts, args = getopt.getopt(argv, 'hc:w:t:j:due:q:', ['config=', 'wordsize=', 'toolchain=', 'jobs=', 'dev', 'upload', 'eol', 'qmake-arg=']) + opts, args = getopt.getopt(argv, 'hc:w:t:j:due:q:v', ['config=', 'wordsize=', 'toolchain=', 'jobs=', 'dev', 'upload', 'eol', 'qmake-arg=', 'version']) except getopt.GetoptError: print_help() sys.exit(2) - if len(opts) < 2: + if len(opts) == 0: print_help() sys.exit(2) @@ -440,6 +440,9 @@ def main(argv): if opt == '-h': print_help() sys.exit() + elif opt in ('-v', '--version'): + print(Builder(None, None).version) + sys.exit() elif opt in ('-c', '--config'): config_file = path.abspath(arg) if not os.path.exists(config_file):