[CI] Refactoring

This commit is contained in:
Mat Sutcliffe
2020-06-16 21:49:16 +01:00
parent 2b4f10a96d
commit 4a9e222733
2 changed files with 42 additions and 51 deletions

View File

@@ -15,24 +15,32 @@ env:
jobs: jobs:
preBuild: preBuild:
runs-on: ubuntu-latest runs-on: ubuntu-20.04
outputs:
version: ${{ steps.version.outputs.value }}
steps: steps:
- name: Remove artifacts
uses: geekyeggo/delete-artifact@v1
with:
name: xswiftbus-thin-allos-${{ github.run_id }}
failOnError: false
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
submodules: true 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 - name: Run cppcheck
run: | run: |
sudo apt install cppcheck sudo apt install cppcheck
cppcheck --template=gcc --inline-suppr --std=c++14 --enable=style,unusedFunction -i externals \ 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 --suppressions-list=cppcheck.supp --library=qt.cfg --library=posix.cfg . | tee error.log
ls -l 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: buildLinux:
runs-on: ubuntu-16.04 runs-on: ubuntu-16.04
@@ -76,25 +84,21 @@ jobs:
env: env:
VATSIM_ID: ${{ secrets.VATSIM_ID }} VATSIM_ID: ${{ secrets.VATSIM_ID }}
VATSIM_KEY: ${{ secrets.VATSIM_KEY }} 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 - name: Upload installer
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: swiftinstaller-linux-64-${{ env.swift_version }} name: swiftinstaller-linux-64-${{ needs.preBuild.outputs.version }}
path: ${{ github.workspace }}/swiftinstaller-* path: ${{ github.workspace }}/swiftinstaller-*
- name: Upload symbols - name: Upload symbols
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
if: ${{ env.do_symbols }} if: ${{ env.do_symbols }}
with: with:
name: swiftsymbols-allos-${{ env.swift_version }} name: swiftsymbols-allos-${{ needs.preBuild.outputs.version }}
path: ${{ github.workspace }}/swiftsymbols-* path: ${{ github.workspace }}/swiftsymbols-*
- name: Upload xswiftbus - name: Upload xswiftbus
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: xswiftbus-thin-allos-${{ github.run_id }} name: xswiftbus-thin-allos-${{ needs.preBuild.outputs.version }}
path: ${{ github.workspace }}/xswiftbus-* path: ${{ github.workspace }}/xswiftbus-*
buildWin64: buildWin64:
@@ -110,7 +114,7 @@ jobs:
version: 5.15.0 version: 5.15.0
arch: "win64_msvc2019_64" arch: "win64_msvc2019_64"
aqtversion: ">=0.9.0" aqtversion: ">=0.9.0"
- name: Install InstallBuilder - name: Download InstallBuilder
run: | run: |
curl.exe --output "$HOME\installbuilder.exe" -L --url https://installbuilder.com/installbuilder-qt-professional-20.4.0-windows-x64-installer.exe 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") start -wait "$HOME\installbuilder.exe" @("--mode", "unattended", "--prefix", "$HOME\installbuilder")
@@ -139,26 +143,21 @@ jobs:
env: env:
VATSIM_ID: ${{ secrets.VATSIM_ID }} VATSIM_ID: ${{ secrets.VATSIM_ID }}
VATSIM_KEY: ${{ secrets.VATSIM_KEY }} 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 - name: Upload installer
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: swiftinstaller-windows-64-${{ env.swift_version }} name: swiftinstaller-windows-64-${{ needs.preBuild.outputs.version }}
path: ${{ github.workspace }}/swiftinstaller-* path: ${{ github.workspace }}/swiftinstaller-*
- name: Upload symbols - name: Upload symbols
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
if: ${{ env.do_symbols }} if: ${{ env.do_symbols }}
with: with:
name: swiftsymbols-allos-${{ env.swift_version }} name: swiftsymbols-allos-${{ needs.preBuild.outputs.version }}
path: ${{ github.workspace }}/swiftsymbols-* path: ${{ github.workspace }}/swiftsymbols-*
- name: Upload xswiftbus - name: Upload xswiftbus
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: xswiftbus-thin-allos-${{ github.run_id }} name: xswiftbus-thin-allos-${{ needs.preBuild.outputs.version }}
path: ${{ github.workspace }}/xswiftbus-* path: ${{ github.workspace }}/xswiftbus-*
buildWin32: buildWin32:
@@ -174,7 +173,7 @@ jobs:
version: 5.15.0 version: 5.15.0
arch: "win32_msvc2019" arch: "win32_msvc2019"
aqtversion: ">=0.9.0" aqtversion: ">=0.9.0"
- name: Install InstallBuilder - name: Download InstallBuilder
run: | run: |
curl.exe --output "$HOME\installbuilder.exe" -L --url https://installbuilder.com/installbuilder-qt-professional-20.4.0-windows-installer.exe 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") start -wait "$HOME\installbuilder.exe" @("--mode", "unattended", "--prefix", "$HOME\installbuilder")
@@ -203,26 +202,21 @@ jobs:
env: env:
VATSIM_ID: ${{ secrets.VATSIM_ID }} VATSIM_ID: ${{ secrets.VATSIM_ID }}
VATSIM_KEY: ${{ secrets.VATSIM_KEY }} 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 - name: Upload installer
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: swiftinstaller-windows-32-${{ env.swift_version }} name: swiftinstaller-windows-32-${{ needs.preBuild.outputs.version }}
path: ${{ github.workspace }}/swiftinstaller-* path: ${{ github.workspace }}/swiftinstaller-*
- name: Upload symbols - name: Upload symbols
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
if: ${{ env.do_symbols }} if: ${{ env.do_symbols }}
with: with:
name: swiftsymbols-allos-${{ env.swift_version }} name: swiftsymbols-allos-${{ needs.preBuild.outputs.version }}
path: ${{ github.workspace }}/swiftsymbols-* path: ${{ github.workspace }}/swiftsymbols-*
- name: Upload xswiftbus - name: Upload xswiftbus
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: xswiftbus-thin-allos-${{ github.run_id }} name: xswiftbus-thin-allos-${{ needs.preBuild.outputs.version }}
path: ${{ github.workspace }}/xswiftbus-* path: ${{ github.workspace }}/xswiftbus-*
buildMacOS: buildMacOS:
@@ -272,57 +266,51 @@ jobs:
env: env:
VATSIM_ID: ${{ secrets.VATSIM_ID }} VATSIM_ID: ${{ secrets.VATSIM_ID }}
VATSIM_KEY: ${{ secrets.VATSIM_KEY }} 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 - name: Upload installer
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: swiftinstaller-macos-64-${{ env.swift_version }} name: swiftinstaller-macos-64-${{ needs.preBuild.outputs.version }}
path: ${{ github.workspace }}/swiftinstaller-* path: ${{ github.workspace }}/swiftinstaller-*
- name: Upload symbols - name: Upload symbols
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
if: ${{ env.do_symbols }} if: ${{ env.do_symbols }}
with: with:
name: swiftsymbols-allos-${{ env.swift_version }} name: swiftsymbols-allos-${{ needs.preBuild.outputs.version }}
path: ${{ github.workspace }}/swiftsymbols-* path: ${{ github.workspace }}/swiftsymbols-*
- name: Upload xswiftbus - name: Upload xswiftbus
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: xswiftbus-thin-allos-${{ github.run_id }} name: xswiftbus-thin-allos-${{ needs.preBuild.outputs.version }}
path: ${{ github.workspace }}/xswiftbus-* path: ${{ github.workspace }}/xswiftbus-*
postBuild: postBuild:
runs-on: ubuntu-latest runs-on: ubuntu-20.04
needs: [buildLinux, buildWin64, buildWin32, buildMacOS] needs: [preBuild, buildLinux, buildWin64, buildWin32, buildMacOS]
steps: steps:
- name: Download xswiftbus-thin - name: Download xswiftbus-thin
uses: actions/download-artifact@v2 uses: actions/download-artifact@v2
with: with:
name: xswiftbus-thin-allos-${{ github.run_id }} name: xswiftbus-thin-allos-${{ needs.preBuild.outputs.version }}
- name: Repackage xswiftbus - name: Repackage xswiftbus
run: | run: |
7z x -y xswiftbus-windows-32-*.7z 7z x -y xswiftbus-windows-32-*.7z
7z x -y xswiftbus-windows-64-*.7z 7z x -y xswiftbus-windows-64-*.7z
7z x -y xswiftbus-linux-64-*.7z 7z x -y xswiftbus-linux-64-*.7z
7z x -y xswiftbus-macos-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]+') 7z a -y -mx=9 xswiftbus-fat-allos-${{ needs.preBuild.outputs.version }}.7z xswiftbus
echo "::set-env name=swift_version::$SWIFT_VERSION"
7z a -y -mx=9 xswiftbus-fat-allos-${SWIFT_VERSION}.7z xswiftbus
- name: Upload xswiftbus-fat - name: Upload xswiftbus-fat
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: xswiftbus-fat-allos-${{ env.swift_version }} name: xswiftbus-fat-allos-${{ needs.preBuild.outputs.version }}
path: xswiftbus-fat-allos-* path: xswiftbus-fat-allos-*
- name: Remove xswiftbus-thin - name: Remove xswiftbus-thin
uses: geekyeggo/delete-artifact@v1 uses: geekyeggo/delete-artifact@v1
with: with:
name: xswiftbus-thin-allos-${{ github.run_id }} name: xswiftbus-thin-allos-${{ needs.preBuild.outputs.version }}
notify: notify:
runs-on: ubuntu-latest runs-on: ubuntu-20.04
needs: [preBuild, buildLinux, buildWin64, buildWin32, buildMacOS, postBuild] needs: [preBuild, buildLinux, buildWin64, buildWin32, buildMacOS, postBuild]
if: always() if: always()

View File

@@ -37,6 +37,7 @@ class Builder:
Build processes will be called with the environment modified by this function. Build processes will be called with the environment modified by this function.
""" """
print('Preparing environment ...') print('Preparing environment ...')
self.make_cmd = self._get_make_cmd()
os.environ['PATH'] += os.pathsep + self._get_qt_binary_path() os.environ['PATH'] += os.pathsep + self._get_qt_binary_path()
self._specific_prepare() self._specific_prepare()
@@ -252,7 +253,6 @@ class Builder:
self.qt_path = path.abspath(self.__config.get(platform.system(), 'qt_path')) 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.dump_syms = path.abspath(self.__config.get(platform.system(), 'dump_syms'))
self.make_cmd = self._get_make_cmd()
self.version = self.__get_swift_version() self.version = self.__get_swift_version()
def __get_config_file(self): def __get_config_file(self):
@@ -412,7 +412,7 @@ def print_help():
'Windows': ['msvc', 'mingw'] 'Windows': ['msvc', 'mingw']
} }
compiler_help = '|'.join(supported_compilers[platform.system()]) compiler_help = '|'.join(supported_compilers[platform.system()])
print('build.py -c <config file> -w <32|64> -t <' + compiler_help + '> [-d] [-e <end of life in month>] [-q <extra qmake argument>]') print('build.py -c <config file> -w <32|64> -t <' + compiler_help + '> [-v] [-d] [-e <end of life in month>] [-q <extra qmake argument>]')
# Entry point if called as a standalone program # Entry point if called as a standalone program
@@ -427,12 +427,12 @@ def main(argv):
qmake_args = [] qmake_args = []
try: 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: except getopt.GetoptError:
print_help() print_help()
sys.exit(2) sys.exit(2)
if len(opts) < 2: if len(opts) == 0:
print_help() print_help()
sys.exit(2) sys.exit(2)
@@ -440,6 +440,9 @@ def main(argv):
if opt == '-h': if opt == '-h':
print_help() print_help()
sys.exit() sys.exit()
elif opt in ('-v', '--version'):
print(Builder(None, None).version)
sys.exit()
elif opt in ('-c', '--config'): elif opt in ('-c', '--config'):
config_file = path.abspath(arg) config_file = path.abspath(arg)
if not os.path.exists(config_file): if not os.path.exists(config_file):