Parallelize iOS/macOS upload

Also:

- Cache SwiftPM
- Run tests on any branch but stable
This commit is contained in:
Davide De Rosa 2021-11-11 22:39:23 +01:00
parent a696df36b3
commit a18f9cad32
2 changed files with 82 additions and 56 deletions

View File

@ -0,0 +1,20 @@
name: 'Prepare build environment'
runs:
using: 'composite'
steps:
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- uses: actions/cache@v2
with:
path: .build
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- shell: bash
run: |
scripts/ci/recognize-match-hostname.sh
bundle exec fastlane preinstall_development_certs

View File

@ -14,12 +14,6 @@ env:
APP_STORE_CONNECT_API_KEY: ${{ secrets.APP_STORE_CONNECT_API_KEY }} APP_STORE_CONNECT_API_KEY: ${{ secrets.APP_STORE_CONNECT_API_KEY }}
FASTLANE_USERNAME: ${{ secrets.FASTLANE_USERNAME }} FASTLANE_USERNAME: ${{ secrets.FASTLANE_USERNAME }}
FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }} FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }}
jobs:
test_or_upload_to_app_store:
runs-on: macos-10.15
timeout-minutes: 60
env:
MATCH_USERNAME: ${{ secrets.MATCH_USERNAME }} MATCH_USERNAME: ${{ secrets.MATCH_USERNAME }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
MATCH_GIT_URL: ${{ secrets.MATCH_GIT_URL }} MATCH_GIT_URL: ${{ secrets.MATCH_GIT_URL }}
@ -31,50 +25,62 @@ jobs:
PILOT_BETA_APP_FEEDBACK: ${{ secrets.PILOT_BETA_APP_FEEDBACK }} PILOT_BETA_APP_FEEDBACK: ${{ secrets.PILOT_BETA_APP_FEEDBACK }}
PILOT_BETA_APP_REVIEW_INFO: ${{ secrets.PILOT_BETA_APP_REVIEW_INFO }} PILOT_BETA_APP_REVIEW_INFO: ${{ secrets.PILOT_BETA_APP_REVIEW_INFO }}
CHANGELOG_PREFACE: ${{ secrets.CHANGELOG_PREFACE }} CHANGELOG_PREFACE: ${{ secrets.CHANGELOG_PREFACE }}
jobs:
run_tests:
if: github.ref != 'refs/heads/stable'
runs-on: macos-10.15
timeout-minutes: 20
steps: steps:
- name: Check out repository - uses: actions/checkout@v2
uses: actions/checkout@v2
with: with:
fetch-depth: 0 # for proper build number fetch-depth: 0
submodules: true submodules: true
- name: Prepare Ruby bundle - name: Prepare build
uses: ruby/setup-ruby@v1 uses: ./.github/actions/prepare-build-app
with: - name: Run tests
bundler-cache: true
- name: Select Xcode version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Prepare for fastlane match
run: |
scripts/ci/recognize-match-hostname.sh
bundle exec fastlane preinstall_development_certs
- name: Run tests (macOS)
if: github.ref == 'refs/heads/master'
run: | run: |
bundle exec fastlane --env mac,beta test_target bundle exec fastlane --env mac,beta test_target
- name: Build (macOS) build_upload_ios:
if: github.ref == 'refs/heads/stable'
run: |
bundle exec fastlane --env mac,beta create_archive
- name: Build (iOS)
if: github.ref == 'refs/heads/stable' if: github.ref == 'refs/heads/stable'
runs-on: macos-10.15
timeout-minutes: 60
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: true
- name: Prepare build
uses: ./.github/actions/prepare-build-app
- name: Build iOS (.ipa)
run: | run: |
bundle exec fastlane --env ios,beta create_archive bundle exec fastlane --env ios,beta create_archive
- name: Submit to TestFlight (macOS) - name: Submit to TestFlight
if: github.ref == 'refs/heads/stable'
run: |
export PILOT_CHANGELOG=`ci/build-changelog.sh mac`
bundle exec fastlane --env mac,beta store_beta
- name: Submit to TestFlight (iOS)
if: github.ref == 'refs/heads/stable'
run: | run: |
export PILOT_CHANGELOG=`ci/build-changelog.sh ios` export PILOT_CHANGELOG=`ci/build-changelog.sh ios`
bundle exec fastlane --env ios,beta store_beta bundle exec fastlane --env ios,beta store_beta
build_upload_mac:
if: github.ref == 'refs/heads/stable'
runs-on: macos-10.15
timeout-minutes: 60
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: true
- name: Prepare build
uses: ./.github/actions/prepare-build-app
- name: Build macOS (.pkg)
run: |
bundle exec fastlane --env mac,beta create_archive
- name: Submit to TestFlight
run: |
export PILOT_CHANGELOG=`ci/build-changelog.sh mac`
bundle exec fastlane --env mac,beta store_beta
release_public_beta: release_public_beta:
if: github.ref == 'refs/heads/stable' if: github.ref == 'refs/heads/stable'
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: test_or_upload_to_app_store needs: [build_upload_ios, build_upload_mac]
environment: environment:
name: public_beta name: public_beta
env: env:
@ -91,20 +97,20 @@ jobs:
uses: ruby/setup-ruby@v1 uses: ruby/setup-ruby@v1
with: with:
bundler-cache: true bundler-cache: true
- name: Publish on TestFlight (macOS)
run: |
export PILOT_APP_VERSION=`ci/version-number.sh mac`
export PILOT_BUILD_NUMBER=`ci/build-number.sh mac`
bundle exec fastlane --env mac,beta store_beta
- name: Publish on TestFlight (iOS) - name: Publish on TestFlight (iOS)
run: | run: |
export PILOT_APP_VERSION=`ci/version-number.sh ios` export PILOT_APP_VERSION=`ci/version-number.sh ios`
export PILOT_BUILD_NUMBER=`ci/build-number.sh ios` export PILOT_BUILD_NUMBER=`ci/build-number.sh ios`
bundle exec fastlane --env ios,beta store_beta bundle exec fastlane --env ios,beta store_beta
- name: Publish on TestFlight (macOS)
run: |
export PILOT_APP_VERSION=`ci/version-number.sh mac`
export PILOT_BUILD_NUMBER=`ci/build-number.sh mac`
bundle exec fastlane --env mac,beta store_beta
submit_for_app_review: submit_for_app_review:
if: github.ref == 'refs/heads/stable' if: github.ref == 'refs/heads/stable'
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: test_or_upload_to_app_store needs: release_public_beta
environment: environment:
name: app_review name: app_review
env: env:
@ -120,13 +126,13 @@ jobs:
uses: ruby/setup-ruby@v1 uses: ruby/setup-ruby@v1
with: with:
bundler-cache: true bundler-cache: true
- name: Submit for App Review (macOS)
run: |
export DELIVER_APP_VERSION=`ci/version-number.sh mac`
export DELIVER_BUILD_NUMBER=`ci/build-number.sh mac`
bundle exec fastlane --env mac store_review add_id_info_uses_idfa:false
- name: Submit for App Review (iOS) - name: Submit for App Review (iOS)
run: | run: |
export DELIVER_APP_VERSION=`ci/version-number.sh ios` export DELIVER_APP_VERSION=`ci/version-number.sh ios`
export DELIVER_BUILD_NUMBER=`ci/build-number.sh ios` export DELIVER_BUILD_NUMBER=`ci/build-number.sh ios`
bundle exec fastlane --env ios store_review add_id_info_uses_idfa:false bundle exec fastlane --env ios store_review add_id_info_uses_idfa:false
- name: Submit for App Review (macOS)
run: |
export DELIVER_APP_VERSION=`ci/version-number.sh mac`
export DELIVER_BUILD_NUMBER=`ci/build-number.sh mac`
bundle exec fastlane --env mac store_review add_id_info_uses_idfa:false