Browse Source

github: use GitHub hosted runner for TCTI sysroot builds

Also default to GitHub hosted runner if no self-hosted runner exists to be
more friendly to forks.
osy 2 years ago
parent
commit
c7a34605ef
2 changed files with 53 additions and 23 deletions
  1. 52 23
      .github/workflows/build.yml
  2. 1 0
      Documentation/Release.md

+ 52 - 23
.github/workflows/build.yml

@@ -24,21 +24,50 @@ on:
 
 
 env:
 env:
   BUILD_XCODE_PATH: /Applications/Xcode_14.1.app
   BUILD_XCODE_PATH: /Applications/Xcode_14.1.app
-  INSTALL_REQUIREMENTS: false
+  RUNNER_IMAGE: macos-12
 
 
 jobs:
 jobs:
+  configuration:
+    name: Setup configuration
+    runs-on: ubuntu-latest
+    outputs:
+      runner: ${{ steps.checker.outputs.runners }}
+      github-runner: ${{ steps.checker.outputs.github-runner }}
+    steps:
+    - name: Check for hosted runners
+      id: checker
+      shell: bash
+      env:
+        IS_SELF_HOSTED_RUNNER: ${{ secrets.IS_SELF_HOSTED_RUNNER }}
+      run: |
+        echo "github-runner='$RUNNER_IMAGE'" >> $GITHUB_OUTPUT
+        if [ "$IS_SELF_HOSTED_RUNNER" == "true" ]; then
+          echo "runners=['self-hosted', 'macOS']" >> $GITHUB_OUTPUT
+        else
+          echo "runners='$RUNNER_IMAGE'" >> $GITHUB_OUTPUT
+        fi
   build-sysroot:
   build-sysroot:
     name: Build Sysroot
     name: Build Sysroot
-    runs-on: [self-hosted, macOS, large]
+    runs-on: ${{ matrix.runner == 'default' && fromJSON(needs.configuration.outputs.runner) || fromJSON(needs.configuration.outputs.github-runner) }}
+    needs: configuration
     strategy:
     strategy:
       matrix:
       matrix:
         arch: [arm64, x86_64]
         arch: [arm64, x86_64]
         platform: [ios, ios_simulator, ios-tci, macos]
         platform: [ios, ios_simulator, ios-tci, macos]
+        runner: [default, github]
         exclude:
         exclude:
+          # x86_64 does not exist on iOS
           - arch: x86_64
           - arch: x86_64
             platform: ios
             platform: ios
-          - arch: x86_64
+          # TCI does not exist for x86_64 and should not use default runner
+          - platform: ios-tci
+          # use default runner
+          - runner: github
+        include:
+          # always run iOS TCI build on GitHub Runner (Clang bug causes DOS on hosted runner)
+          - arch: arm64
             platform: ios-tci
             platform: ios-tci
+            runner: github
     steps:
     steps:
       - name: Checkout
       - name: Checkout
         uses: actions/checkout@v3
         uses: actions/checkout@v3
@@ -60,7 +89,7 @@ jobs:
         run: |
         run: |
           echo "/usr/local/opt/bison/bin:/opt/homebrew/opt/bison/bin" >> $GITHUB_PATH
           echo "/usr/local/opt/bison/bin:/opt/homebrew/opt/bison/bin" >> $GITHUB_PATH
       - name: Install Requirements
       - name: Install Requirements
-        if: (steps.cache-sysroot.outputs.cache-hit != 'true' || github.event.inputs.rebuild_sysroot == 'true') && env.INSTALL_REQUIREMENTS == 'true'
+        if: (steps.cache-sysroot.outputs.cache-hit != 'true' || github.event.inputs.rebuild_sysroot == 'true') && (matrix.runner == 'github' || needs.configuration.outputs.runners == env.RUNNER_IMAGE)
         run: |
         run: |
           brew uninstall cmake
           brew uninstall cmake
           brew install bison pkg-config gettext glib-utils libgpg-error nasm make meson
           brew install bison pkg-config gettext glib-utils libgpg-error nasm make meson
@@ -70,7 +99,7 @@ jobs:
         if: steps.cache-sysroot.outputs.cache-hit != 'true' || github.event.inputs.rebuild_sysroot == 'true'
         if: steps.cache-sysroot.outputs.cache-hit != 'true' || github.event.inputs.rebuild_sysroot == 'true'
         run: ./scripts/build_dependencies.sh -p ${{ matrix.platform }} -a ${{ matrix.arch }}
         run: ./scripts/build_dependencies.sh -p ${{ matrix.platform }} -a ${{ matrix.arch }}
         env:
         env:
-          NCPU: ${{ matrix.platform == 'ios-tci' && '1' || '0' }} # limit 1 CPU for TCI build due to memory issues, 0 = unlimited for other builds
+           NCPU: ${{ matrix.platform == 'ios-tci' && '1' || '0' }} # limit 1 CPU for TCI build due to memory issues, 0 = unlimited for other builds
       - name: Compress Sysroot
       - name: Compress Sysroot
         if: steps.cache-sysroot.outputs.cache-hit != 'true' || github.event_name == 'release' || github.event.inputs.test_release == 'true'
         if: steps.cache-sysroot.outputs.cache-hit != 'true' || github.event_name == 'release' || github.event.inputs.test_release == 'true'
         run: tar -acf sysroot.tgz sysroot*
         run: tar -acf sysroot.tgz sysroot*
@@ -82,8 +111,8 @@ jobs:
           path: sysroot.tgz
           path: sysroot.tgz
   build-sysroot-universal:
   build-sysroot-universal:
     name: Build Sysroot (Universal Mac)
     name: Build Sysroot (Universal Mac)
-    runs-on: macos-12
-    needs: build-sysroot
+    runs-on: ${{ fromJSON(needs.configuration.outputs.github-runner) }}
+    needs: [configuration, build-sysroot]
     steps:
     steps:
       - name: Checkout
       - name: Checkout
         uses: actions/checkout@v3
         uses: actions/checkout@v3
@@ -127,8 +156,8 @@ jobs:
           path: sysroot.tgz
           path: sysroot.tgz
   build-utm:
   build-utm:
     name: Build UTM
     name: Build UTM
-    runs-on: [self-hosted, macOS]
-    needs: build-sysroot
+    runs-on: ${{ fromJSON(needs.configuration.outputs.runner) }}
+    needs: [configuration, build-sysroot]
     strategy:
     strategy:
       matrix:
       matrix:
         arch: [arm64, x86_64]
         arch: [arm64, x86_64]
@@ -169,8 +198,8 @@ jobs:
           path: UTM.xcarchive.tgz
           path: UTM.xcarchive.tgz
   build-universal:
   build-universal:
     name: Build UTM (Universal Mac)
     name: Build UTM (Universal Mac)
-    runs-on: [self-hosted, macOS]
-    needs: build-sysroot-universal
+    runs-on: ${{ fromJSON(needs.configuration.outputs.runner) }}
+    needs: [configuration, build-sysroot-universal]
     steps:
     steps:
       - name: Checkout
       - name: Checkout
         uses: actions/checkout@v3
         uses: actions/checkout@v3
@@ -204,8 +233,8 @@ jobs:
           path: UTM.xcarchive.tgz
           path: UTM.xcarchive.tgz
   package-ipa:
   package-ipa:
     name: Package (iOS IPA)
     name: Package (iOS IPA)
-    runs-on: macos-12
-    needs: build-utm
+    runs-on: ${{ fromJSON(needs.configuration.outputs.github-runner) }}
+    needs: [configuration, build-utm]
     if: github.event_name == 'release' || github.event.inputs.test_release == 'true'
     if: github.event_name == 'release' || github.event.inputs.test_release == 'true'
     steps:
     steps:
       - name: Checkout
       - name: Checkout
@@ -246,8 +275,8 @@ jobs:
           event-type: new-release
           event-type: new-release
   package-ipa-se:
   package-ipa-se:
     name: Package (iOS-TCI IPA)
     name: Package (iOS-TCI IPA)
-    runs-on: macos-12
-    needs: build-utm
+    runs-on: ${{ fromJSON(needs.configuration.outputs.github-runner) }}
+    needs: [configuration, build-utm]
     if: github.event_name == 'release' || github.event.inputs.test_release == 'true'
     if: github.event_name == 'release' || github.event.inputs.test_release == 'true'
     steps:
     steps:
       - name: Checkout
       - name: Checkout
@@ -288,8 +317,8 @@ jobs:
           event-type: new-release
           event-type: new-release
   package-hv:
   package-hv:
     name: Package (iOS HV)
     name: Package (iOS HV)
-    runs-on: macos-12
-    needs: build-utm
+    runs-on: ${{ fromJSON(needs.configuration.outputs.github-runner) }}
+    needs: [configuration, build-utm]
     if: github.event_name == 'release' || github.event.inputs.test_release == 'true'
     if: github.event_name == 'release' || github.event.inputs.test_release == 'true'
     steps:
     steps:
       - name: Checkout
       - name: Checkout
@@ -323,8 +352,8 @@ jobs:
           asset_content_type: application/octet-stream
           asset_content_type: application/octet-stream
   package-deb:
   package-deb:
     name: Package (iOS DEB)
     name: Package (iOS DEB)
-    runs-on: macos-12
-    needs: build-utm
+    runs-on: ${{ fromJSON(needs.configuration.outputs.github-runner) }}
+    needs: [configuration, build-utm]
     if: github.event_name == 'release' || github.event.inputs.test_release == 'true'
     if: github.event_name == 'release' || github.event.inputs.test_release == 'true'
     steps:
     steps:
       - name: Checkout
       - name: Checkout
@@ -365,8 +394,8 @@ jobs:
           event-type: new-release
           event-type: new-release
   package-mac:
   package-mac:
     name: Package (macOS)
     name: Package (macOS)
-    runs-on: macos-12
-    needs: build-universal
+    runs-on: ${{ fromJSON(needs.configuration.outputs.github-runner) }}
+    needs: [configuration, build-universal]
     if: github.event_name == 'release' || github.event.inputs.test_release == 'true'
     if: github.event_name == 'release' || github.event.inputs.test_release == 'true'
     steps:
     steps:
       - name: Checkout
       - name: Checkout
@@ -427,8 +456,8 @@ jobs:
           asset_content_type: application/octet-stream
           asset_content_type: application/octet-stream
   submit-mac:
   submit-mac:
     name: Submit (macOS)
     name: Submit (macOS)
-    runs-on: macos-12
-    needs: build-universal
+    runs-on: ${{ fromJSON(needs.configuration.outputs.github-runner) }}
+    needs: [configuration, build-universal]
     if: github.event_name == 'release' || github.event.inputs.test_release == 'true'
     if: github.event_name == 'release' || github.event.inputs.test_release == 'true'
     steps:
     steps:
       - name: Checkout
       - name: Checkout

+ 1 - 0
Documentation/Release.md

@@ -100,6 +100,7 @@ Below is a summary of all the secrets used by GitHub Actions in the release proc
 |`APP_STORE_HELPER_PROFILE_UUID`  |UUID of provisioning profile above                                                 |
 |`APP_STORE_HELPER_PROFILE_UUID`  |UUID of provisioning profile above                                                 |
 |`APP_STORE_LAUNCHER_PROFILE_DATA`|Base64 encoded provisioning profile of QEMULauncher for App Store submission       |
 |`APP_STORE_LAUNCHER_PROFILE_DATA`|Base64 encoded provisioning profile of QEMULauncher for App Store submission       |
 |`APP_STORE_LAUNCHER_PROFILE_UUID`|UUID of provisioning profile above                                                 |
 |`APP_STORE_LAUNCHER_PROFILE_UUID`|UUID of provisioning profile above                                                 |
+|`IS_SELF_HOSTED_RUNNER`          |Set to `true` to use a self hosted macOS runner set up by the owner                |
 
 
 ### Signing for release
 ### Signing for release