diff --git a/.github/workflows/master-push.yml b/.github/workflows/master-push.yml index 3b7a84ea27..edacf39c54 100644 --- a/.github/workflows/master-push.yml +++ b/.github/workflows/master-push.yml @@ -4,12 +4,13 @@ on: branches: - "master" env: - XCODE_VERSION: "['15.1']" # '14.1', '14.2', '14.3.1', '15.0.1', '15.1' - PLATFORM: "['ios']" # , 'osx', 'watchos', 'tvos', 'catalyst', visionos' - BUILD_PLATFORM: "['ios', 'iossimulator']" # , 'osx', 'watchos', 'watchossimulator', 'tvos', 'tvossimulator', 'catalyst' + XCODE_VERSION: "['14.1', '14.2', '14.3.1', '15.0.1', '15.1']" + PLATFORM: "['ios', 'osx', 'watchos', 'tvos', 'catalyst', visionos']" + BUILD_PLATFORM: "['ios', 'iossimulator', 'osx', 'watchos', 'watchossimulator', 'tvos', 'tvossimulator', 'catalyst']" DOC_VERSION: '14.3.1' XCFRAMEWORK_VERSION: '15.0.1' REALM_VERSION: '15.1' + TEST_VERSION: '15.0.1' jobs: prepare: runs-on: ubuntu-latest @@ -111,7 +112,7 @@ jobs: run: | workflow_id=$(echo $(ruby ./scripts/xcode_cloud_helper.rb --create-build-workflow "${{ matrix.platform }}-${{ matrix.target }}-${{ matrix.configuration }}" --token ${{ steps.token.outputs.token }} --xcode-version ${{ matrix.xcode-version }})) echo "WORKFLOW_ID=$workflow_id" >> $GITHUB_OUTPUT - - name: Runs the XCode Cloud workflow created by the prevous step which that a package for ${{ matrix.platform }} in ${{ matrix.xcode-version }} with configuration ${{ matrix.configuration }} + - name: Runs the XCode Cloud workflow created by the previous step id: build-run run: | build_run_id=$(echo $(ruby ./scripts/xcode_cloud_helper.rb --run-release-workflow ${{ steps.create-workflow.outputs.WORKFLOW_ID }} --token ${{ steps.token.outputs.token }} --branch ${{ github.ref_name }})) @@ -405,8 +406,19 @@ jobs: key id: ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }} # P8 private key. Can get from App Store Connect. key: ${{ secrets.APPLE_STORE_CONNECT_API_KEY }} - - name: Run release_ios-static_15.1 which runs test over the packages produces by the previous step and wait for it to complete or fail - run: ruby ./scripts/xcode_cloud_helper.rb --run-release-workflow release_test-ios-static_15.1 --token ${{ steps.token.outputs.token }} + - name: Creates on demand XCode Cloud's workflows for running ios-static test + id: create-workflow + run: | + workflow_id=$(echo $(ruby ./scripts/xcode_cloud_helper.rb --create-test-workflow "ios-static-${{ env.TEST_VERSION }}" --token ${{ steps.token.outputs.token }} --xcode-version ${{ env.TEST_VERSION }})) + echo "WORKFLOW_ID=$workflow_id" >> $GITHUB_OUTPUT + - name: Runs the XCode Cloud workflow created by the previous step + id: build-run + run: | + build_run_id=$(echo $(ruby ./scripts/xcode_cloud_helper.rb --run-release-workflow ${{ steps.create-workflow.outputs.WORKFLOW_ID }} --token ${{ steps.token.outputs.token }} --branch ${{ github.ref_name }})) + echo "BUILD_RUN_ID=$build_run_id" >> $GITHUB_OUTPUT + - name: Check build status and wait for it to finish + run: | + ruby ./scripts/xcode_cloud_helper.rb --token ${{ steps.token.outputs.token }} --check-workflow-status ${{ steps.build-run.outputs.BUILD_RUN_ID }} test-osx-static: runs-on: ubuntu-latest name: Run tests on macOS @@ -424,14 +436,23 @@ jobs: key id: ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }} # P8 private key. Can get from App Store Connect. key: ${{ secrets.APPLE_STORE_CONNECT_API_KEY }} - - name: Run release_osx_15.1 which runs test over the packages produces by the previous step and wait for it to complete or fail - run: ruby ./scripts/xcode_cloud_helper.rb --run-release-workflow release_test-osx_15.1 --token ${{ steps.token.outputs.token }} + - name: Creates on demand XCode Cloud's workflows for running osx-static test + id: create-workflow + run: | + workflow_id=$(echo $(ruby ./scripts/xcode_cloud_helper.rb --create-test-workflow "osx-static-${{ env.TEST_VERSION }}" --token ${{ steps.token.outputs.token }} --xcode-version ${{ env.TEST_VERSION }})) + echo "WORKFLOW_ID=$workflow_id" >> $GITHUB_OUTPUT + - name: Runs the XCode Cloud workflow created by the previous step + id: build-run + run: | + build_run_id=$(echo $(ruby ./scripts/xcode_cloud_helper.rb --run-release-workflow ${{ steps.create-workflow.outputs.WORKFLOW_ID }} --token ${{ steps.token.outputs.token }} --branch ${{ github.ref_name }})) + echo "BUILD_RUN_ID=$build_run_id" >> $GITHUB_OUTPUT + - name: Check build status and wait for it to finish + run: | + ruby ./scripts/xcode_cloud_helper.rb --token ${{ steps.token.outputs.token }} --check-workflow-status ${{ steps.build-run.outputs.BUILD_RUN_ID }} test-installation: runs-on: ubuntu-latest - name: Run installation test for ${{ matrix.platform }}, ${{ matrix.installation }} and ${{ matrix.linkage }} + name: Run installation test needs: create-final-package - env: - XCODE_VERSION: '14.3.1' strategy: matrix: platform: [ios, osx, watchos, tvos, catalyst] @@ -455,48 +476,58 @@ jobs: key id: ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }} # P8 private key. Can get from App Store Connect. key: ${{ secrets.APPLE_STORE_CONNECT_API_KEY }} - - name: Creates an XCode Cloud workflow to run the test and runs build + - name: Creates on demand XCode Cloud's workflows to run installation test for ${{ matrix.platform }}, ${{ matrix.installation }}, ${{ matrix.linkage }} + id: create-workflow run: | - ruby ./scripts/xcode_cloud_helper.rb --create-release-workflow-and-run test-installation-${{ matrix.platform }}-${{ matrix.installation }}-${{ matrix.linkage }} --xcode-version "$XCODE_VERSION" --token ${{ steps.token.outputs.token }} --team-id ${{ secrets.APPLE_STORE_CONNECT_TEAM_ID }} - test-installation-xcode: # we run this installation tests separatly because we need xcode cloud workflows previsously created with a GITHUB token so we can download the release package for this tests - runs-on: ubuntu-latest - name: Run installation xcframework ${{ matrix.platform }}, ${{ matrix.linkage }} in ${{ matrix.xcode_version }} - needs: create-final-package - strategy: - max-parallel: 5 - matrix: - platform: [osx] - xcode_version: ['14.1', '14.2', '14.3.1', '15.0.1', '15.1'] - linkage: [dynamic] - include: - - platform: ios - xcode_version: '14.3.1' - linkage: dynamic - - platform: watchos - xcode_version: '14.3.1' - linkage: dynamic - - platform: tvos - xcode_version: '14.3.1' - linkage: dynamic - - platform: catalyst - xcode_version: '14.3.1' - linkage: dynamic - - platform: ios - installation: '14.3.1' - linkage: static - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Get Token - id: token - uses: yuki0n0/action-appstoreconnect-token@v1.0 - with: - # UUID. Can get from App Store Connect. - issuer id: ${{ secrets.APPLE_STORE_CONNECT_ISSUER_ID }} - # Key ID. Can get from App Store Connect. - key id: ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }} - # P8 private key. Can get from App Store Connect. - key: ${{ secrets.APPLE_STORE_CONNECT_API_KEY }} - - name: Run installation tests for ${{ matrix.platform }} xcframework ${{ matrix.linkage }} in xcode version ${{ matrix.xcode-version }} + workflow_id=$(echo $(ruby ./scripts/xcode_cloud_helper.rb --create-test-workflow "test-installation-${{ matrix.platform }}-${{ matrix.installation }}-${{ matrix.linkage }}" --token ${{ steps.token.outputs.token }} --xcode-version ${{ env.TEST_VERSION }})) + echo "WORKFLOW_ID=$workflow_id" >> $GITHUB_OUTPUT + - name: Runs the XCode Cloud workflow created by the previous step + id: build-run run: | - ruby ./scripts/xcode_cloud_helper.rb --run-release-workflow "release_test-installation-${{ matrix.platform }}-xcframework-${{ matrix.linkage }}_${{ matrix.xcode-version }}" --token ${{ steps.token.outputs.token }} \ No newline at end of file + build_run_id=$(echo $(ruby ./scripts/xcode_cloud_helper.rb --run-release-workflow ${{ steps.create-workflow.outputs.WORKFLOW_ID }} --token ${{ steps.token.outputs.token }} --branch ${{ github.ref_name }})) + echo "BUILD_RUN_ID=$build_run_id" >> $GITHUB_OUTPUT + - name: Check build status and wait for it to finish + run: | + ruby ./scripts/xcode_cloud_helper.rb --token ${{ steps.token.outputs.token }} --check-workflow-status ${{ steps.build-run.outputs.BUILD_RUN_ID }} + # test-installation-xcode: # we run this installation tests separatly because we need xcode cloud workflows previsously created with a GITHUB token so we can download the release package for this tests + # runs-on: ubuntu-latest + # name: Run installation xcframework ${{ matrix.platform }}, ${{ matrix.linkage }} in ${{ matrix.xcode_version }} + # needs: create-final-package + # strategy: + # max-parallel: 5 + # matrix: + # platform: [osx] + # xcode_version: ['14.1', '14.2', '14.3.1', '15.0.1', '15.1'] + # linkage: [dynamic] + # include: + # - platform: ios + # xcode_version: '14.3.1' + # linkage: dynamic + # - platform: watchos + # xcode_version: '14.3.1' + # linkage: dynamic + # - platform: tvos + # xcode_version: '14.3.1' + # linkage: dynamic + # - platform: catalyst + # xcode_version: '14.3.1' + # linkage: dynamic + # - platform: ios + # installation: '14.3.1' + # linkage: static + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # - name: Get Token + # id: token + # uses: yuki0n0/action-appstoreconnect-token@v1.0 + # with: + # # UUID. Can get from App Store Connect. + # issuer id: ${{ secrets.APPLE_STORE_CONNECT_ISSUER_ID }} + # # Key ID. Can get from App Store Connect. + # key id: ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }} + # # P8 private key. Can get from App Store Connect. + # key: ${{ secrets.APPLE_STORE_CONNECT_API_KEY }} + # - name: Run installation tests for ${{ matrix.platform }} xcframework ${{ matrix.linkage }} in xcode version ${{ matrix.xcode-version }} + # run: | + # ruby ./scripts/xcode_cloud_helper.rb --run-release-workflow "release_test-installation-${{ matrix.platform }}-xcframework-${{ matrix.linkage }}_${{ matrix.xcode-version }}" --token ${{ steps.token.outputs.token }} \ No newline at end of file diff --git a/build.sh b/build.sh index 44c16c9319..35bf2b8182 100755 --- a/build.sh +++ b/build.sh @@ -1321,7 +1321,7 @@ case "$COMMAND" in sh build.sh examples-tvos-swift ;; - ("release_test-ios") + ("release-test-ios") echo "Test run on test action" ;; diff --git a/scripts/release-matrix.rb b/scripts/release-matrix.rb new file mode 100755 index 0000000000..ef19a0c24c --- /dev/null +++ b/scripts/release-matrix.rb @@ -0,0 +1,61 @@ +#!/usr/bin/env ruby + +module RELEASE + DOCS_XCODE_VERSION = '14.3.1' + XCODE_VERSIONS = ['14.1', '14.2', '14.3.1', '15.0.1', '15.1'] + PLATFORMS_NAMES = ['osx': 'macOS', 'ios': 'iOS', 'watchos': 'watchOS', 'tvos': 'tvOS', 'catalyst': 'Catalyst', 'visionos': 'visionOS'] + + all = ->(v) { true } + latest_only = ->(v) { v == XCODE_VERSIONS.last } + doc_version = ->(v) { v == DOCS_XCODE_VERSION } + + PLATFORMS = { + 'osx' => all, + 'ios' => all, + 'watchos' => all, + 'tvos' => all, + 'catalyst' => all, + 'visionos' => latest_only, + } + + RELEASE_XCODE_CLOUD_TARGETS = { + 'package-docs' => doc_version, + 'package' => all, + 'test-package-examples' => latest_only, + 'test-ios-static' => latest_only, + 'test-osx' => latest_only, + 'test-installation-osx-xcframework-dynamic' => all, + 'test-installation-ios-xcframework-dynamic' => doc_version, + 'test-installation-watchos-xcframework-dynamic' => doc_version, + 'test-installation-tvos-xcframework-dynamic' => doc_version, + 'test-installation-catalyst-xcframework-dynamic' => doc_version, + 'test-installation-ios-xcframework-static' => doc_version, + } +end + +def get_doc_version + puts "#{RELEASE::DOCS_XCODE_VERSION}" +end + +def plaforms_for_version(version) + platforms_version = [] + RELEASE::PLATFORMS.each { |platform, filter| + if filter.call(version) + platforms_version.append(platform) + end + } + puts "#{platforms_version.join(",")}" +end + +def get_xcode_versions + puts "#{RELEASE::XCODE_VERSIONS.join(",")}" +end + +if ARGV[0] == 'docs_version' + get_doc_version +elsif ARGV[0] == 'plaforms_for_version' + version = ARGV[1] + plaforms_for_version(version) +elsif ARGV[0] == 'xcode_versions' + get_xcode_versions +end diff --git a/scripts/xcode_cloud_helper.rb b/scripts/xcode_cloud_helper.rb index 709ec130c9..b2577785b6 100755 --- a/scripts/xcode_cloud_helper.rb +++ b/scripts/xcode_cloud_helper.rb @@ -841,6 +841,7 @@ def download_artifact_for_build(build_id_run) [ '--run-release-workflow', GetoptLong::REQUIRED_ARGUMENT ], [ '--check-workflow-status', GetoptLong::REQUIRED_ARGUMENT ], [ '--create-build-workflow', GetoptLong::REQUIRED_ARGUMENT ], + [ '--create-test-workflow', GetoptLong::REQUIRED_ARGUMENT ], [ '--download-build-artifact', GetoptLong::REQUIRED_ARGUMENT ], [ '--get-token', GetoptLong::NO_ARGUMENT ] ) @@ -938,7 +939,8 @@ def download_artifact_for_build(build_id_run) Check workflow status --create-build-workflow - Creates a workflow, runs it and wait for it to finish + +--create-test-workflow --download-build-artifact @@ -977,7 +979,7 @@ def download_artifact_for_build(build_id_run) if arg != '' workflow_id = arg end - when '--create-workflow', '--create-build-workflow' + when '--create-workflow', '--create-build-workflow', '--create-test-workflow' if arg != '' name = arg end @@ -1086,6 +1088,13 @@ def download_artifact_for_build(build_id_run) workflow_id = create_workflow('build', name, xcode_version, "release-package-") puts workflow_id end +elsif option == '--create-test-workflow' + if name == '' || xcode_version == '' + raise 'Needs name and xcode version' + else + workflow_id = create_workflow('test', name, xcode_version, "release-") + puts workflow_id + end elsif option == '--download-build-artifact' if build_run_id == '' raise 'Needs build id name to run.'