diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fb05a84df..514700268 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,39 +40,6 @@ jobs: name: SourceCode path: ./output - Xcode-template-matrix-old: - strategy: - matrix: - xcode: - - Xcode_11.3.1 - target: - - template - platform: - - iphone - needs: source-code - runs-on: macos-10.15 - env: - DEVELOPER_DIR: /Applications/${{ matrix.xcode }}.app/Contents/Developer - TEMPLATE_TARGET: ${{ matrix.target }} - steps: - - name: Get processed code - uses: actions/download-artifact@v1 - with: - name: SourceCode - - name: Unpack source code - run: tar -xzf SourceCode/corona.tgz - - run: ./tools/GHAction/daily_env.sh - - name: Build templates - working-directory: ./platform/${{ matrix.platform }} - run: ./gh_build_templates.sh - env: - CERT_PASSWORD: ${{ secrets.CertPassword }} - - name: Upload templates - uses: actions/upload-artifact@v1 - with: - name: Templates-${{ matrix.platform }}-${{ matrix.xcode }}-${{ matrix.target }} - path: ./output - Xcode-template-matrix: strategy: matrix: @@ -85,11 +52,16 @@ jobs: platform: - iphone - tvos + include: + - xcode: Xcode_11.3.1 + target: template + platform: iphone needs: source-code runs-on: macos-10.15 env: DEVELOPER_DIR: /Applications/${{ matrix.xcode }}.app/Contents/Developer TEMPLATE_TARGET: ${{ matrix.target }} + TEMPLATE_PLATFORM: ${{ matrix.platform }} steps: - name: Get processed code uses: actions/download-artifact@v1 @@ -103,6 +75,8 @@ jobs: run: ./gh_build_templates.sh env: CERT_PASSWORD: ${{ secrets.CertPassword }} + - name: Build templates JSON spec + run: ./tools/GHAction/generate_xcode_json.py - name: Upload templates uses: actions/upload-artifact@v1 with: @@ -112,17 +86,18 @@ jobs: collect-ios-templates: needs: - Xcode-template-matrix - - Xcode-template-matrix-old runs-on: ubuntu-20.04 steps: - uses: actions/download-artifact@v2 - name: Collect templates together run: | - mkdir -p output + mkdir -p output/iostemplate for D in Templates-* do - mv -v "$D/"* output/ + mv -v "$D/"*.tar.bz output/iostemplate done + - name: Generate template JSON + run: find Templates-* -name '*_*-SDKs.json' -exec ./tools/GHAction/aggregate_xcode_jsons.py output {} \+ - name: Upload templates uses: actions/upload-artifact@v1 with: @@ -281,12 +256,14 @@ jobs: - name: Unpack source code run: tar -xzf SourceCode/corona.tgz - run: ./tools/GHAction/daily_env.sh + - name: Check for macOS min supported version + run: exit $( echo $(cat platform/mac/AppDelegate.mm | perl -ne 'print for /kosVersionCurrent = @"([0-9.]+)"/') ' < ' $(/usr/bin/xcrun --sdk macosx --show-sdk-version) | bc ) - name: Get collected templates uses: actions/download-artifact@v1 with: name: Collected-ios-templates - name: Put collected iOS templates in place - run: cp -v Collected-ios-templates/* platform/resources/iostemplate/ + run: cp -v Collected-ios-templates/* platform/resources/ - name: Get Webtemplate uses: actions/download-artifact@v1 with: diff --git a/tools/GHAction/aggregate_xcode_jsons.py b/tools/GHAction/aggregate_xcode_jsons.py new file mode 100755 index 000000000..a95c14d62 --- /dev/null +++ b/tools/GHAction/aggregate_xcode_jsons.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python +import json +import sys +import os +import subprocess + +output_dir = sys.argv[1] +files = sys.argv[2:] +files = [f for f in files if f.endswith('.json') and os.path.basename(f).count('_') == 1] +files.sort(key=os.path.basename) + +out = {} +def processFile(f): + with open(f) as fp: + obj = json.load(fp) + out_file = os.path.basename(f).split('_')[1] # type: str + out[out_file] = out.get(out_file, {}) + for platform, entries in obj.items(): + out[out_file][platform] = out[out_file].get(platform, []) + out[out_file][platform].extend(entries) + +map(processFile, files) + +subprocess.check_call(['/bin/mkdir', '-p', output_dir]) +for out_file, content in out.items(): + with open(os.path.join(output_dir, out_file), 'w') as fp: + json.dump(content, fp, indent=4, sort_keys=True) diff --git a/tools/GHAction/generate_xcode_json.py b/tools/GHAction/generate_xcode_json.py new file mode 100755 index 000000000..c2a2fa94a --- /dev/null +++ b/tools/GHAction/generate_xcode_json.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python +import json +import os +import subprocess + +platform = os.environ['TEMPLATE_PLATFORM'] +SDKs = {"tvos":"appletvos", "iphone":"iphoneos"} +xcodeVersion = subprocess.check_output(['/usr/bin/xcrun', '--sdk', SDKs[platform],'--show-sdk-version']).strip() +coronaVersion = int(float(xcodeVersion)*10000) +xcode = subprocess.check_output(['/usr/bin/xcodebuild', '-version']).split('\n')[0].strip() + +def getCustomTemplateName(): + target = os.environ['TEMPLATE_TARGET'] + target = target[len('template'):] + if target: + return target +customTemplate = getCustomTemplateName() + +def isBeta(): + return False + +def getLabel(): + if coronaVersion < 140000: + return xcodeVersion + " (Legacy)" + if customTemplate == '-angle': + return xcodeVersion + " Metal" + return xcodeVersion + + +entry = { + "label": getLabel(), + "xcodeVersion": xcodeVersion, + "failMessage": "install or xcode-select " + xcode + " to enable", + "coronaVersion": coronaVersion, + "beta": isBeta(), +} +if customTemplate: + entry["customTemplate"] = customTemplate + +platforms = {"tvos":"tvos", "iphone":"ios"} +output = { + platforms[platform] : [ + entry + ] +} + +subprocess.check_call(['/bin/mkdir', '-p', 'output']) +fileName = {"tvos":"tvOS-SDKs.json", "iphone":"iOS-SDKs.json"} +ordNum = 1000000 - coronaVersion + (5 if isBeta() else 0) + (1 if customTemplate else 0) +fileName = str(ordNum).zfill(7) + '_' + fileName[platform] +with open(os.path.join('output', fileName), 'w') as f: + json.dump(output, f, indent=4)