From 3e57ec5b76c91af9d89782f8f98fb0286edc365d Mon Sep 17 00:00:00 2001 From: Calvin Cestari Date: Thu, 4 Jul 2024 22:07:01 -0700 Subject: [PATCH 1/7] Remove fragment mutation setter from template and codegen tests --- .../SelectionSetTemplate_LocalCacheMutation_Tests.swift | 4 ---- .../ApolloCodegenLib/Templates/SelectionSetTemplate.swift | 2 -- 2 files changed, 6 deletions(-) diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplate_LocalCacheMutation_Tests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplate_LocalCacheMutation_Tests.swift index 3cb0753e1..1a1430a81 100644 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplate_LocalCacheMutation_Tests.swift +++ b/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplate_LocalCacheMutation_Tests.swift @@ -336,8 +336,6 @@ class SelectionSetTemplate_LocalCacheMutationTests: XCTestCase { public var animalDetails: AnimalDetails { get { _toFragment() } _modify { var f = animalDetails; yield &f; __data = f.__data } - @available(*, unavailable, message: "mutate properties of the fragment instead.") - set { preconditionFailure() } } """ @@ -381,8 +379,6 @@ class SelectionSetTemplate_LocalCacheMutationTests: XCTestCase { public var animalDetails: AnimalDetails? { get { _toFragment() } _modify { var f = animalDetails; yield &f; if let newData = f?.__data { __data = newData } } - @available(*, unavailable, message: "mutate properties of the fragment instead.") - set { preconditionFailure() } } """ diff --git a/apollo-ios-codegen/Sources/ApolloCodegenLib/Templates/SelectionSetTemplate.swift b/apollo-ios-codegen/Sources/ApolloCodegenLib/Templates/SelectionSetTemplate.swift index 686c22a0f..85b5f1174 100644 --- a/apollo-ios-codegen/Sources/ApolloCodegenLib/Templates/SelectionSetTemplate.swift +++ b/apollo-ios-codegen/Sources/ApolloCodegenLib/Templates/SelectionSetTemplate.swift @@ -559,8 +559,6 @@ struct SelectionSetTemplate { "if let newData = f?.__data { __data = newData }", else: "__data = f.__data" ) } - @available(*, unavailable, message: "mutate properties of the fragment instead.") - set { preconditionFailure() } } """, else: " _toFragment() }" From 4acc49899f3cf6e3142836f9d6af7558599e6a18 Mon Sep 17 00:00:00 2001 From: Calvin Cestari Date: Thu, 4 Jul 2024 22:07:27 -0700 Subject: [PATCH 2/7] Remove fragment mutation setter from ApolloAPI --- apollo-ios/Sources/ApolloAPI/LocalCacheMutation.swift | 2 -- 1 file changed, 2 deletions(-) diff --git a/apollo-ios/Sources/ApolloAPI/LocalCacheMutation.swift b/apollo-ios/Sources/ApolloAPI/LocalCacheMutation.swift index f09fed6c8..91dccd631 100644 --- a/apollo-ios/Sources/ApolloAPI/LocalCacheMutation.swift +++ b/apollo-ios/Sources/ApolloAPI/LocalCacheMutation.swift @@ -39,8 +39,6 @@ public extension MutableSelectionSet where Fragments: FragmentContainer { yield &f self.__data._data = f.__data._data } - @available(*, unavailable, message: "mutate properties of the fragment instead.") - set { preconditionFailure("") } } } From 56f4ab4fa801084e697f73ce652959f252a6aace Mon Sep 17 00:00:00 2001 From: Calvin Cestari Date: Thu, 4 Jul 2024 22:07:45 -0700 Subject: [PATCH 3/7] Remove fragment mutation setter from unit tests --- Tests/ApolloTests/Cache/ReadWriteFromStoreTests.swift | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Tests/ApolloTests/Cache/ReadWriteFromStoreTests.swift b/Tests/ApolloTests/Cache/ReadWriteFromStoreTests.swift index 87325d8d4..413884347 100644 --- a/Tests/ApolloTests/Cache/ReadWriteFromStoreTests.swift +++ b/Tests/ApolloTests/Cache/ReadWriteFromStoreTests.swift @@ -1051,8 +1051,6 @@ class ReadWriteFromStoreTests: XCTestCase, CacheDependentTesting, StoreLoading { var givenFragment: GivenFragment { get { _toFragment() } _modify { var f = givenFragment; yield &f; __data = f.__data } - @available(*, unavailable, message: "mutate properties of the fragment instead.") - set { preconditionFailure() } } } } @@ -1204,8 +1202,6 @@ class ReadWriteFromStoreTests: XCTestCase, CacheDependentTesting, StoreLoading { var givenFragment: GivenFragment? { get { _toFragment() } _modify { var f = givenFragment; yield &f; if let newData = f?.__data { __data = newData } } - @available(*, unavailable, message: "mutate properties of the fragment instead.") - set { preconditionFailure() } } } } From 2a23da4d46854397cb88610edaf28b12dbc3e6ed Mon Sep 17 00:00:00 2001 From: Calvin Cestari Date: Thu, 4 Jul 2024 22:08:40 -0700 Subject: [PATCH 4/7] Removes Xcode 16 beta action --- .github/workflows/ci-tests-xcode-beta.yml | 334 ---------------------- 1 file changed, 334 deletions(-) delete mode 100644 .github/workflows/ci-tests-xcode-beta.yml diff --git a/.github/workflows/ci-tests-xcode-beta.yml b/.github/workflows/ci-tests-xcode-beta.yml deleted file mode 100644 index ebf4e338d..000000000 --- a/.github/workflows/ci-tests-xcode-beta.yml +++ /dev/null @@ -1,334 +0,0 @@ -name: "CI Tests (Xcode 16.0 Beta)" - -on: - workflow_dispatch - -env: - XCODE_VERSION: "16.0-beta" - -jobs: - changes: - runs-on: ubuntu-latest - outputs: - ios: ${{ steps.filter.outputs.ios }} - codegen: ${{ steps.filter.outputs.codegen }} - pagination: ${{ steps.filter.outputs.pagination }} - tuist: ${{ steps.filter.outputs.tuist }} - steps: - - uses: actions/checkout@v4 - - uses: dorny/paths-filter@v2 - id: filter - with: - filters: | - ios: - - 'apollo-ios/**' - - 'Tests/ApolloInternalTestHelpers/**' - - 'Tests/ApolloServerIntegrationTests/**' - - 'Tests/ApolloTests/**' - codegen: - - 'apollo-ios-codegen/**' - - 'Tests/ApolloCodegenInternalTestHelpers/**' - - 'Tests/ApolloCodegenTests/**' - - 'Tests/CodegenCLITests/**' - - 'Tests/CodegenIntegrationTests/**' - - 'Tests/TestCodeGenConfigurations/**' - pagination: - - 'apollo-ios-pagination/**' - - 'Tests/ApolloInternalTestHelpers/**' - - 'apollo-ios/**' - tuist: - - '.tuist-version' - - tuist-generation: - runs-on: macos-latest - needs: [changes] - if: ${{ needs.changes.outputs.ios == 'true' || needs.changes.outputs.codegen == 'true' || needs.changes.outputs.pagination == 'true' || needs.changes.outputs.tuist == 'true' }} - timeout-minutes: 8 - name: Run Tuist Generation - steps: - - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: ${{ env.XCODE_VERSION }} - - name: Checkout Repo - uses: actions/checkout@v3 - - name: Run Tuist Generation - uses: ./.github/actions/run-tuist-generation - - name: Cache Build Dependencies - uses: actions/cache@v3 - with: - path: | - ./ApolloDev.xcodeproj - ./ApolloDev.xcworkspace - ./Derived/* - key: ${{ github.run_id }}-dependencies - - run-swift-builds: - runs-on: macos-latest - timeout-minutes: 15 - strategy: - fail-fast: false - matrix: - include: - - package: apollo-ios - - package: apollo-ios-codegen - - package: apollo-ios-pagination - name: Run swift build for SPM packages - steps: - - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: ${{ env.XCODE_VERSION }} - - name: Checkout Repo - uses: actions/checkout@v3 - - name: Run Swift Build - shell: bash - run: | - cd ${{ matrix.package }} && swift build - - build-and-unit-test: - runs-on: macos-latest - needs: [tuist-generation, changes] - timeout-minutes: 20 - strategy: - fail-fast: false - matrix: - include: - # macOS_current - - destination: platform=macOS,arch=x86_64 - scheme: ApolloTests - test-plan: Apollo-CITestPlan - name: Apollo Unit Tests - macOS - run-js-tests: false - should-run: ${{ needs.changes.outputs.ios }} - # Codegen CLI Test - - destination: platform=macOS,arch=x86_64 - scheme: CodegenCLITests - test-plan: CodegenCLITestPlan - name: Codegen CLI Unit Tests - macOS - run-js-tests: false - should-run: ${{ needs.changes.outputs.codegen }} - # CodegenLib Test - - destination: platform=macOS,arch=x86_64 - scheme: ApolloCodegenTests - test-plan: Apollo-Codegen-CITestPlan - name: Codegen Lib Unit Tests - macOS - run-js-tests: true - should-run: ${{ needs.changes.outputs.codegen }} - # ApolloPagination Tests - - destination: platform=macOS,arch=x86_64 - scheme: ApolloPaginationTests - test-plan: Apollo-PaginationTestPlan - name: ApolloPagination Unit Tests - macOS - run-js-tests: false - should-run: ${{ needs.changes.outputs.pagination }} - name: ${{ matrix.name }} - steps: - - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: ${{ env.XCODE_VERSION }} - - name: Checkout Repo - uses: actions/checkout@v3 - - name: Retrieve Build Cache - uses: actions/cache@v3 - with: - path: | - ./ApolloDev.xcodeproj - ./ApolloDev.xcworkspace - ./Derived/* - key: ${{ github.run_id }}-dependencies - fail-on-cache-miss: true - # Caching for apollo-ios and apollo-ios-codegen SPM dependencies - # - uses: actions/cache@v3 - # with: - # path: ./DerivedData/SourcePackages - # key: ${{ runner.os }}-spm-${{ hashFiles('./apollo-ios/Package.resolved') }}-${{ hashFiles('./apollo-ios-codegen/Package.resolved') }} - # - name: Run Tuist Generation - # uses: tuist/tuist-action@0.13.0 - # with: - # command: 'generate' - # arguments: '' - - name: Build and Test - if: ${{ matrix.should-run == true || matrix.should-run == 'true' }} - id: build-and-test - uses: ./.github/actions/build-and-run-unit-tests - with: - destination: ${{ matrix.destination }} - scheme: ${{ matrix.scheme }} - test-plan: ${{ matrix.test-plan }} - - name: Run-JS-Tests - if: ${{ matrix.run-js-tests == true }} - shell: bash - working-directory: apollo-ios-codegen/Sources/GraphQLCompiler/JavaScript/ - run: | - npm install && npm test - - name: Save xcodebuild logs - if: ${{ steps.build-and-test.outcome != 'skipped' }} - uses: actions/upload-artifact@v3 - with: - name: ${{ matrix.name }}-logs - path: | - DerivedData/Logs/Build - - name: Save crash logs - if: ${{ steps.build-and-test.outcome != 'skipped' }} - uses: actions/upload-artifact@v3 - with: - name: ${{ matrix.name }}-crashes - path: | - ~/Library/Logs/DiagnosticReports - - name: Zip Result Bundle - if: ${{ steps.build-and-test.outcome != 'skipped' }} - shell: bash - working-directory: TestResults - run: | - zip -r ResultBundle.zip ResultBundle.xcresult - - name: Save test results - if: ${{ steps.build-and-test.outcome != 'skipped' }} - uses: actions/upload-artifact@v3 - with: - name: ${{ matrix.name }}-results - path: | - TestResults/ResultBundle.zip - - run-codegen-test-configurations: - runs-on: macos-latest - timeout-minutes: 20 - name: Codegen Test Configurations - macOS - steps: - - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: ${{ env.XCODE_VERSION }} - - name: Checkout Repo - uses: actions/checkout@v3 - - name: Test Codegen Configurations - shell: bash - run: | - ./scripts/run-test-codegen-configurations.sh -t - - verify-frontend-bundle-latest: - runs-on: macos-latest - needs: [changes] - if: ${{ needs.changes.outputs.codegen == 'true' }} - timeout-minutes: 5 - name: Verify Frontend Bundle Latest - macOS - steps: - - name: Checkout Repo - uses: actions/checkout@v3 - - name: Build JS Bundle - shell: bash - working-directory: apollo-ios-codegen/Sources/GraphQLCompiler/JavaScript - run: npm install && ./auto_rollup.sh - - name: Verify Latest - shell: bash - run: | - git diff --exit-code - - verify-cli-binary-archive: - runs-on: macos-latest - needs: [changes] - if: ${{ needs.changes.outputs.codegen == 'true' }} - timeout-minutes: 5 - name: Verify CLI Binary Archive - macOS - steps: - - name: Checkout Repo - uses: actions/checkout@v3 - - name: Extract CLI Binary - shell: bash - working-directory: apollo-ios/CLI - run: tar -xf apollo-ios-cli.tar.gz apollo-ios-cli - - name: Verify Version - shell: bash - working-directory: apollo-ios/scripts - run: ./cli-version-check.sh - - run-cocoapods-integration-tests: - runs-on: macos-latest - timeout-minutes: 20 - name: Cocoapods Integration Tests - macOS - steps: - - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: ${{ env.XCODE_VERSION }} - - name: Checkout Repo - uses: actions/checkout@v3 - - name: Export ENV Variables - shell: bash - working-directory: apollo-ios - run: | - apollo_ios_sha=$(git rev-parse HEAD) - echo "APOLLO_IOS_SHA=$apollo_ios_sha" >> ${GITHUB_ENV} - - name: Run CocoaPods Integration Tests - id: run-cocoapods-integration-tests - uses: ./.github/actions/run-cocoapods-integration-tests - - run-integration-tests: - runs-on: macos-13 - needs: [tuist-generation, changes] - if: ${{ needs.changes.outputs.ios == 'true' }} - timeout-minutes: 20 - name: Apollo Integration Tests - macOS - steps: - - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: 15.2 - - name: Checkout Repo - uses: actions/checkout@v3 - - name: Setup Node 12.22.10 - uses: actions/setup-node@v3 - with: - node-version: 12.22.10 - - name: Setup Upload Server - shell: bash - run: | - sudo chmod -R +rwx SimpleUploadServer - cd SimpleUploadServer && npm install && npm start & - - name: Setup Node 18.15.0 - uses: actions/setup-node@v3 - with: - node-version: 18.15.0 - - name: Setup Subscription Server - shell: bash - run: | - sh ./scripts/install-apollo-server-docs-example-server.sh - cd ../docs-examples/apollo-server/v3/subscriptions-graphql-ws && npm start & - - name: Setup Star Wars Server - shell: bash - run: | - sh ./scripts/install-or-update-starwars-server.sh - cd ../starwars-server && npm start & - - name: Retrieve Build Cache - uses: actions/cache@v3 - with: - path: | - ./ApolloDev.xcodeproj - ./ApolloDev.xcworkspace - ./Derived/* - key: ${{ github.run_id }}-dependencies - fail-on-cache-miss: true - - name: Build and Test - uses: ./.github/actions/build-and-run-unit-tests - with: - destination: platform=macOS,arch=x86_64 - scheme: ApolloServerIntegrationTests - test-plan: Apollo-IntegrationTestPlan - - name: Save xcodebuild logs - uses: actions/upload-artifact@v3 - with: - name: macOS-Integration-logs - path: | - DerivedData/Logs/Build - - name: Save crash logs - uses: actions/upload-artifact@v3 - with: - name: macOS-Integration-crashes - path: | - ~/Library/Logs/DiagnosticReports - - name: Zip Result Bundle - shell: bash - working-directory: TestResults - run: | - zip -r ResultBundle.zip ResultBundle.xcresult - - name: Save test results - uses: actions/upload-artifact@v3 - with: - name: macOS-Integration-results - path: | - TestResults/ResultBundle.zip From 8def71485a3f98687d60ef89a43ec34e6a4e297d Mon Sep 17 00:00:00 2001 From: Calvin Cestari Date: Wed, 10 Jul 2024 12:06:59 -0700 Subject: [PATCH 5/7] Revert "Removes Xcode 16 beta action" This reverts commit 2a23da4d46854397cb88610edaf28b12dbc3e6ed. --- .github/workflows/ci-tests-xcode-beta.yml | 334 ++++++++++++++++++++++ 1 file changed, 334 insertions(+) create mode 100644 .github/workflows/ci-tests-xcode-beta.yml diff --git a/.github/workflows/ci-tests-xcode-beta.yml b/.github/workflows/ci-tests-xcode-beta.yml new file mode 100644 index 000000000..ebf4e338d --- /dev/null +++ b/.github/workflows/ci-tests-xcode-beta.yml @@ -0,0 +1,334 @@ +name: "CI Tests (Xcode 16.0 Beta)" + +on: + workflow_dispatch + +env: + XCODE_VERSION: "16.0-beta" + +jobs: + changes: + runs-on: ubuntu-latest + outputs: + ios: ${{ steps.filter.outputs.ios }} + codegen: ${{ steps.filter.outputs.codegen }} + pagination: ${{ steps.filter.outputs.pagination }} + tuist: ${{ steps.filter.outputs.tuist }} + steps: + - uses: actions/checkout@v4 + - uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + ios: + - 'apollo-ios/**' + - 'Tests/ApolloInternalTestHelpers/**' + - 'Tests/ApolloServerIntegrationTests/**' + - 'Tests/ApolloTests/**' + codegen: + - 'apollo-ios-codegen/**' + - 'Tests/ApolloCodegenInternalTestHelpers/**' + - 'Tests/ApolloCodegenTests/**' + - 'Tests/CodegenCLITests/**' + - 'Tests/CodegenIntegrationTests/**' + - 'Tests/TestCodeGenConfigurations/**' + pagination: + - 'apollo-ios-pagination/**' + - 'Tests/ApolloInternalTestHelpers/**' + - 'apollo-ios/**' + tuist: + - '.tuist-version' + + tuist-generation: + runs-on: macos-latest + needs: [changes] + if: ${{ needs.changes.outputs.ios == 'true' || needs.changes.outputs.codegen == 'true' || needs.changes.outputs.pagination == 'true' || needs.changes.outputs.tuist == 'true' }} + timeout-minutes: 8 + name: Run Tuist Generation + steps: + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: ${{ env.XCODE_VERSION }} + - name: Checkout Repo + uses: actions/checkout@v3 + - name: Run Tuist Generation + uses: ./.github/actions/run-tuist-generation + - name: Cache Build Dependencies + uses: actions/cache@v3 + with: + path: | + ./ApolloDev.xcodeproj + ./ApolloDev.xcworkspace + ./Derived/* + key: ${{ github.run_id }}-dependencies + + run-swift-builds: + runs-on: macos-latest + timeout-minutes: 15 + strategy: + fail-fast: false + matrix: + include: + - package: apollo-ios + - package: apollo-ios-codegen + - package: apollo-ios-pagination + name: Run swift build for SPM packages + steps: + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: ${{ env.XCODE_VERSION }} + - name: Checkout Repo + uses: actions/checkout@v3 + - name: Run Swift Build + shell: bash + run: | + cd ${{ matrix.package }} && swift build + + build-and-unit-test: + runs-on: macos-latest + needs: [tuist-generation, changes] + timeout-minutes: 20 + strategy: + fail-fast: false + matrix: + include: + # macOS_current + - destination: platform=macOS,arch=x86_64 + scheme: ApolloTests + test-plan: Apollo-CITestPlan + name: Apollo Unit Tests - macOS + run-js-tests: false + should-run: ${{ needs.changes.outputs.ios }} + # Codegen CLI Test + - destination: platform=macOS,arch=x86_64 + scheme: CodegenCLITests + test-plan: CodegenCLITestPlan + name: Codegen CLI Unit Tests - macOS + run-js-tests: false + should-run: ${{ needs.changes.outputs.codegen }} + # CodegenLib Test + - destination: platform=macOS,arch=x86_64 + scheme: ApolloCodegenTests + test-plan: Apollo-Codegen-CITestPlan + name: Codegen Lib Unit Tests - macOS + run-js-tests: true + should-run: ${{ needs.changes.outputs.codegen }} + # ApolloPagination Tests + - destination: platform=macOS,arch=x86_64 + scheme: ApolloPaginationTests + test-plan: Apollo-PaginationTestPlan + name: ApolloPagination Unit Tests - macOS + run-js-tests: false + should-run: ${{ needs.changes.outputs.pagination }} + name: ${{ matrix.name }} + steps: + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: ${{ env.XCODE_VERSION }} + - name: Checkout Repo + uses: actions/checkout@v3 + - name: Retrieve Build Cache + uses: actions/cache@v3 + with: + path: | + ./ApolloDev.xcodeproj + ./ApolloDev.xcworkspace + ./Derived/* + key: ${{ github.run_id }}-dependencies + fail-on-cache-miss: true + # Caching for apollo-ios and apollo-ios-codegen SPM dependencies + # - uses: actions/cache@v3 + # with: + # path: ./DerivedData/SourcePackages + # key: ${{ runner.os }}-spm-${{ hashFiles('./apollo-ios/Package.resolved') }}-${{ hashFiles('./apollo-ios-codegen/Package.resolved') }} + # - name: Run Tuist Generation + # uses: tuist/tuist-action@0.13.0 + # with: + # command: 'generate' + # arguments: '' + - name: Build and Test + if: ${{ matrix.should-run == true || matrix.should-run == 'true' }} + id: build-and-test + uses: ./.github/actions/build-and-run-unit-tests + with: + destination: ${{ matrix.destination }} + scheme: ${{ matrix.scheme }} + test-plan: ${{ matrix.test-plan }} + - name: Run-JS-Tests + if: ${{ matrix.run-js-tests == true }} + shell: bash + working-directory: apollo-ios-codegen/Sources/GraphQLCompiler/JavaScript/ + run: | + npm install && npm test + - name: Save xcodebuild logs + if: ${{ steps.build-and-test.outcome != 'skipped' }} + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.name }}-logs + path: | + DerivedData/Logs/Build + - name: Save crash logs + if: ${{ steps.build-and-test.outcome != 'skipped' }} + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.name }}-crashes + path: | + ~/Library/Logs/DiagnosticReports + - name: Zip Result Bundle + if: ${{ steps.build-and-test.outcome != 'skipped' }} + shell: bash + working-directory: TestResults + run: | + zip -r ResultBundle.zip ResultBundle.xcresult + - name: Save test results + if: ${{ steps.build-and-test.outcome != 'skipped' }} + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.name }}-results + path: | + TestResults/ResultBundle.zip + + run-codegen-test-configurations: + runs-on: macos-latest + timeout-minutes: 20 + name: Codegen Test Configurations - macOS + steps: + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: ${{ env.XCODE_VERSION }} + - name: Checkout Repo + uses: actions/checkout@v3 + - name: Test Codegen Configurations + shell: bash + run: | + ./scripts/run-test-codegen-configurations.sh -t + + verify-frontend-bundle-latest: + runs-on: macos-latest + needs: [changes] + if: ${{ needs.changes.outputs.codegen == 'true' }} + timeout-minutes: 5 + name: Verify Frontend Bundle Latest - macOS + steps: + - name: Checkout Repo + uses: actions/checkout@v3 + - name: Build JS Bundle + shell: bash + working-directory: apollo-ios-codegen/Sources/GraphQLCompiler/JavaScript + run: npm install && ./auto_rollup.sh + - name: Verify Latest + shell: bash + run: | + git diff --exit-code + + verify-cli-binary-archive: + runs-on: macos-latest + needs: [changes] + if: ${{ needs.changes.outputs.codegen == 'true' }} + timeout-minutes: 5 + name: Verify CLI Binary Archive - macOS + steps: + - name: Checkout Repo + uses: actions/checkout@v3 + - name: Extract CLI Binary + shell: bash + working-directory: apollo-ios/CLI + run: tar -xf apollo-ios-cli.tar.gz apollo-ios-cli + - name: Verify Version + shell: bash + working-directory: apollo-ios/scripts + run: ./cli-version-check.sh + + run-cocoapods-integration-tests: + runs-on: macos-latest + timeout-minutes: 20 + name: Cocoapods Integration Tests - macOS + steps: + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: ${{ env.XCODE_VERSION }} + - name: Checkout Repo + uses: actions/checkout@v3 + - name: Export ENV Variables + shell: bash + working-directory: apollo-ios + run: | + apollo_ios_sha=$(git rev-parse HEAD) + echo "APOLLO_IOS_SHA=$apollo_ios_sha" >> ${GITHUB_ENV} + - name: Run CocoaPods Integration Tests + id: run-cocoapods-integration-tests + uses: ./.github/actions/run-cocoapods-integration-tests + + run-integration-tests: + runs-on: macos-13 + needs: [tuist-generation, changes] + if: ${{ needs.changes.outputs.ios == 'true' }} + timeout-minutes: 20 + name: Apollo Integration Tests - macOS + steps: + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: 15.2 + - name: Checkout Repo + uses: actions/checkout@v3 + - name: Setup Node 12.22.10 + uses: actions/setup-node@v3 + with: + node-version: 12.22.10 + - name: Setup Upload Server + shell: bash + run: | + sudo chmod -R +rwx SimpleUploadServer + cd SimpleUploadServer && npm install && npm start & + - name: Setup Node 18.15.0 + uses: actions/setup-node@v3 + with: + node-version: 18.15.0 + - name: Setup Subscription Server + shell: bash + run: | + sh ./scripts/install-apollo-server-docs-example-server.sh + cd ../docs-examples/apollo-server/v3/subscriptions-graphql-ws && npm start & + - name: Setup Star Wars Server + shell: bash + run: | + sh ./scripts/install-or-update-starwars-server.sh + cd ../starwars-server && npm start & + - name: Retrieve Build Cache + uses: actions/cache@v3 + with: + path: | + ./ApolloDev.xcodeproj + ./ApolloDev.xcworkspace + ./Derived/* + key: ${{ github.run_id }}-dependencies + fail-on-cache-miss: true + - name: Build and Test + uses: ./.github/actions/build-and-run-unit-tests + with: + destination: platform=macOS,arch=x86_64 + scheme: ApolloServerIntegrationTests + test-plan: Apollo-IntegrationTestPlan + - name: Save xcodebuild logs + uses: actions/upload-artifact@v3 + with: + name: macOS-Integration-logs + path: | + DerivedData/Logs/Build + - name: Save crash logs + uses: actions/upload-artifact@v3 + with: + name: macOS-Integration-crashes + path: | + ~/Library/Logs/DiagnosticReports + - name: Zip Result Bundle + shell: bash + working-directory: TestResults + run: | + zip -r ResultBundle.zip ResultBundle.xcresult + - name: Save test results + uses: actions/upload-artifact@v3 + with: + name: macOS-Integration-results + path: | + TestResults/ResultBundle.zip From fc78ade39e43ae70ecb39f0bb25cbdf1728b60b7 Mon Sep 17 00:00:00 2001 From: Calvin Cestari Date: Wed, 10 Jul 2024 12:13:39 -0700 Subject: [PATCH 6/7] Fixes test build errors --- Tests/ApolloCodegenTests/TestHelpers/IRMatchers.swift | 2 +- Tests/ApolloInternalTestHelpers/XCTestCase+Helpers.swift | 2 +- Tests/CodegenCLITests/Matchers/ErrorMatchers.swift | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Tests/ApolloCodegenTests/TestHelpers/IRMatchers.swift b/Tests/ApolloCodegenTests/TestHelpers/IRMatchers.swift index cf671b028..e834b2063 100644 --- a/Tests/ApolloCodegenTests/TestHelpers/IRMatchers.swift +++ b/Tests/ApolloCodegenTests/TestHelpers/IRMatchers.swift @@ -587,7 +587,7 @@ extension Nimble.Matcher { func mappingActualTo( _ actualMapper: @escaping ((U?) throws -> T?) ) -> Nimble.Matcher { - Nimble.Matcher.define { (actual: Expression) in + Nimble.Matcher.define { (actual: Nimble.Expression) in let newActual = actual.cast(actualMapper) return try self.satisfies(newActual) } diff --git a/Tests/ApolloInternalTestHelpers/XCTestCase+Helpers.swift b/Tests/ApolloInternalTestHelpers/XCTestCase+Helpers.swift index 5355f13e3..bd4d7b2fe 100644 --- a/Tests/ApolloInternalTestHelpers/XCTestCase+Helpers.swift +++ b/Tests/ApolloInternalTestHelpers/XCTestCase+Helpers.swift @@ -64,7 +64,7 @@ extension StoreLoading where Self: XCTestCase { operation: Operation, file: StaticString = #filePath, line: UInt = #line, - resultHandler: @escaping AsyncResultObserver, Error>.ResultHandler + resultHandler: @escaping AsyncResultObserver, any Error>.ResultHandler ) { let resultObserver = makeResultObserver(for: operation, file: file, line: line) diff --git a/Tests/CodegenCLITests/Matchers/ErrorMatchers.swift b/Tests/CodegenCLITests/Matchers/ErrorMatchers.swift index 808ab6e4a..fc771020f 100644 --- a/Tests/CodegenCLITests/Matchers/ErrorMatchers.swift +++ b/Tests/CodegenCLITests/Matchers/ErrorMatchers.swift @@ -4,7 +4,7 @@ import Nimble public func throwUserValidationError( _ expectedError: ValidationError -) -> Nimble.Matcher { +) -> Nimble.Matcher { return Matcher { actualExpression in var actualError: (any Error)? do { @@ -41,7 +41,7 @@ public func throwUserValidationError( } } -public func throwUnknownOptionError() -> Nimble.Matcher { +public func throwUnknownOptionError() -> Nimble.Matcher { return Matcher { actualExpression in var actualError: (any Error)? do { From ed6b71c5781f7c9c6030b7ae95aeb0ac55d804a6 Mon Sep 17 00:00:00 2001 From: Calvin Cestari Date: Wed, 10 Jul 2024 17:03:04 -0700 Subject: [PATCH 7/7] Bring back xcode beta 6 test suite but with reduced jobs --- .github/workflows/ci-tests-xcode-beta.yml | 298 ++++++++-------------- 1 file changed, 107 insertions(+), 191 deletions(-) diff --git a/.github/workflows/ci-tests-xcode-beta.yml b/.github/workflows/ci-tests-xcode-beta.yml index ebf4e338d..ca4b5f1cd 100644 --- a/.github/workflows/ci-tests-xcode-beta.yml +++ b/.github/workflows/ci-tests-xcode-beta.yml @@ -1,7 +1,8 @@ name: "CI Tests (Xcode 16.0 Beta)" on: - workflow_dispatch + pull_request: + types: [opened, synchronize, reopened] env: XCODE_VERSION: "16.0-beta" @@ -84,124 +85,111 @@ jobs: run: | cd ${{ matrix.package }} && swift build - build-and-unit-test: - runs-on: macos-latest - needs: [tuist-generation, changes] - timeout-minutes: 20 - strategy: - fail-fast: false - matrix: - include: - # macOS_current - - destination: platform=macOS,arch=x86_64 - scheme: ApolloTests - test-plan: Apollo-CITestPlan - name: Apollo Unit Tests - macOS - run-js-tests: false - should-run: ${{ needs.changes.outputs.ios }} - # Codegen CLI Test - - destination: platform=macOS,arch=x86_64 - scheme: CodegenCLITests - test-plan: CodegenCLITestPlan - name: Codegen CLI Unit Tests - macOS - run-js-tests: false - should-run: ${{ needs.changes.outputs.codegen }} - # CodegenLib Test - - destination: platform=macOS,arch=x86_64 - scheme: ApolloCodegenTests - test-plan: Apollo-Codegen-CITestPlan - name: Codegen Lib Unit Tests - macOS - run-js-tests: true - should-run: ${{ needs.changes.outputs.codegen }} - # ApolloPagination Tests - - destination: platform=macOS,arch=x86_64 - scheme: ApolloPaginationTests - test-plan: Apollo-PaginationTestPlan - name: ApolloPagination Unit Tests - macOS - run-js-tests: false - should-run: ${{ needs.changes.outputs.pagination }} - name: ${{ matrix.name }} - steps: - - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: ${{ env.XCODE_VERSION }} - - name: Checkout Repo - uses: actions/checkout@v3 - - name: Retrieve Build Cache - uses: actions/cache@v3 - with: - path: | - ./ApolloDev.xcodeproj - ./ApolloDev.xcworkspace - ./Derived/* - key: ${{ github.run_id }}-dependencies - fail-on-cache-miss: true - # Caching for apollo-ios and apollo-ios-codegen SPM dependencies - # - uses: actions/cache@v3 - # with: - # path: ./DerivedData/SourcePackages - # key: ${{ runner.os }}-spm-${{ hashFiles('./apollo-ios/Package.resolved') }}-${{ hashFiles('./apollo-ios-codegen/Package.resolved') }} - # - name: Run Tuist Generation - # uses: tuist/tuist-action@0.13.0 - # with: - # command: 'generate' - # arguments: '' - - name: Build and Test - if: ${{ matrix.should-run == true || matrix.should-run == 'true' }} - id: build-and-test - uses: ./.github/actions/build-and-run-unit-tests - with: - destination: ${{ matrix.destination }} - scheme: ${{ matrix.scheme }} - test-plan: ${{ matrix.test-plan }} - - name: Run-JS-Tests - if: ${{ matrix.run-js-tests == true }} - shell: bash - working-directory: apollo-ios-codegen/Sources/GraphQLCompiler/JavaScript/ - run: | - npm install && npm test - - name: Save xcodebuild logs - if: ${{ steps.build-and-test.outcome != 'skipped' }} - uses: actions/upload-artifact@v3 - with: - name: ${{ matrix.name }}-logs - path: | - DerivedData/Logs/Build - - name: Save crash logs - if: ${{ steps.build-and-test.outcome != 'skipped' }} - uses: actions/upload-artifact@v3 - with: - name: ${{ matrix.name }}-crashes - path: | - ~/Library/Logs/DiagnosticReports - - name: Zip Result Bundle - if: ${{ steps.build-and-test.outcome != 'skipped' }} - shell: bash - working-directory: TestResults - run: | - zip -r ResultBundle.zip ResultBundle.xcresult - - name: Save test results - if: ${{ steps.build-and-test.outcome != 'skipped' }} - uses: actions/upload-artifact@v3 - with: - name: ${{ matrix.name }}-results - path: | - TestResults/ResultBundle.zip + # build-and-unit-test: + # runs-on: macos-latest + # needs: [tuist-generation, changes] + # timeout-minutes: 20 + # strategy: + # fail-fast: false + # matrix: + # include: + # # macOS_current + # - destination: platform=macOS,arch=x86_64 + # scheme: ApolloTests + # test-plan: Apollo-CITestPlan + # name: Apollo Unit Tests - macOS + # run-js-tests: false + # should-run: ${{ needs.changes.outputs.ios }} + # # Codegen CLI Test + # - destination: platform=macOS,arch=x86_64 + # scheme: CodegenCLITests + # test-plan: CodegenCLITestPlan + # name: Codegen CLI Unit Tests - macOS + # run-js-tests: false + # should-run: ${{ needs.changes.outputs.codegen }} + # # CodegenLib Test + # - destination: platform=macOS,arch=x86_64 + # scheme: ApolloCodegenTests + # test-plan: Apollo-Codegen-CITestPlan + # name: Codegen Lib Unit Tests - macOS + # run-js-tests: true + # should-run: ${{ needs.changes.outputs.codegen }} + # # ApolloPagination Tests + # - destination: platform=macOS,arch=x86_64 + # scheme: ApolloPaginationTests + # test-plan: Apollo-PaginationTestPlan + # name: ApolloPagination Unit Tests - macOS + # run-js-tests: false + # should-run: ${{ needs.changes.outputs.pagination }} + # name: ${{ matrix.name }} + # steps: + # - uses: maxim-lobanov/setup-xcode@v1 + # with: + # xcode-version: ${{ env.XCODE_VERSION }} + # - name: Checkout Repo + # uses: actions/checkout@v3 + # - name: Retrieve Build Cache + # uses: actions/cache@v3 + # with: + # path: | + # ./ApolloDev.xcodeproj + # ./ApolloDev.xcworkspace + # ./Derived/* + # key: ${{ github.run_id }}-dependencies + # fail-on-cache-miss: true + # # Caching for apollo-ios and apollo-ios-codegen SPM dependencies + # # - uses: actions/cache@v3 + # # with: + # # path: ./DerivedData/SourcePackages + # # key: ${{ runner.os }}-spm-${{ hashFiles('./apollo-ios/Package.resolved') }}-${{ hashFiles('./apollo-ios-codegen/Package.resolved') }} + # # - name: Run Tuist Generation + # # uses: tuist/tuist-action@0.13.0 + # # with: + # # command: 'generate' + # # arguments: '' + # - name: Build and Test + # if: ${{ matrix.should-run == true || matrix.should-run == 'true' }} + # id: build-and-test + # uses: ./.github/actions/build-and-run-unit-tests + # with: + # destination: ${{ matrix.destination }} + # scheme: ${{ matrix.scheme }} + # test-plan: ${{ matrix.test-plan }} + # - name: Run-JS-Tests + # if: ${{ matrix.run-js-tests == true }} + # shell: bash + # working-directory: apollo-ios-codegen/Sources/GraphQLCompiler/JavaScript/ + # run: | + # npm install && npm test + # - name: Save xcodebuild logs + # if: ${{ steps.build-and-test.outcome != 'skipped' }} + # uses: actions/upload-artifact@v3 + # with: + # name: ${{ matrix.name }}-logs + # path: | + # DerivedData/Logs/Build + # - name: Save crash logs + # if: ${{ steps.build-and-test.outcome != 'skipped' }} + # uses: actions/upload-artifact@v3 + # with: + # name: ${{ matrix.name }}-crashes + # path: | + # ~/Library/Logs/DiagnosticReports + # - name: Zip Result Bundle + # if: ${{ steps.build-and-test.outcome != 'skipped' }} + # shell: bash + # working-directory: TestResults + # run: | + # zip -r ResultBundle.zip ResultBundle.xcresult + # - name: Save test results + # if: ${{ steps.build-and-test.outcome != 'skipped' }} + # uses: actions/upload-artifact@v3 + # with: + # name: ${{ matrix.name }}-results + # path: | + # TestResults/ResultBundle.zip - run-codegen-test-configurations: - runs-on: macos-latest - timeout-minutes: 20 - name: Codegen Test Configurations - macOS - steps: - - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: ${{ env.XCODE_VERSION }} - - name: Checkout Repo - uses: actions/checkout@v3 - - name: Test Codegen Configurations - shell: bash - run: | - ./scripts/run-test-codegen-configurations.sh -t + # CodegenTestConfigurations removed because source is not compatible with Sendable yet. verify-frontend-bundle-latest: runs-on: macos-latest @@ -259,76 +247,4 @@ jobs: id: run-cocoapods-integration-tests uses: ./.github/actions/run-cocoapods-integration-tests - run-integration-tests: - runs-on: macos-13 - needs: [tuist-generation, changes] - if: ${{ needs.changes.outputs.ios == 'true' }} - timeout-minutes: 20 - name: Apollo Integration Tests - macOS - steps: - - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: 15.2 - - name: Checkout Repo - uses: actions/checkout@v3 - - name: Setup Node 12.22.10 - uses: actions/setup-node@v3 - with: - node-version: 12.22.10 - - name: Setup Upload Server - shell: bash - run: | - sudo chmod -R +rwx SimpleUploadServer - cd SimpleUploadServer && npm install && npm start & - - name: Setup Node 18.15.0 - uses: actions/setup-node@v3 - with: - node-version: 18.15.0 - - name: Setup Subscription Server - shell: bash - run: | - sh ./scripts/install-apollo-server-docs-example-server.sh - cd ../docs-examples/apollo-server/v3/subscriptions-graphql-ws && npm start & - - name: Setup Star Wars Server - shell: bash - run: | - sh ./scripts/install-or-update-starwars-server.sh - cd ../starwars-server && npm start & - - name: Retrieve Build Cache - uses: actions/cache@v3 - with: - path: | - ./ApolloDev.xcodeproj - ./ApolloDev.xcworkspace - ./Derived/* - key: ${{ github.run_id }}-dependencies - fail-on-cache-miss: true - - name: Build and Test - uses: ./.github/actions/build-and-run-unit-tests - with: - destination: platform=macOS,arch=x86_64 - scheme: ApolloServerIntegrationTests - test-plan: Apollo-IntegrationTestPlan - - name: Save xcodebuild logs - uses: actions/upload-artifact@v3 - with: - name: macOS-Integration-logs - path: | - DerivedData/Logs/Build - - name: Save crash logs - uses: actions/upload-artifact@v3 - with: - name: macOS-Integration-crashes - path: | - ~/Library/Logs/DiagnosticReports - - name: Zip Result Bundle - shell: bash - working-directory: TestResults - run: | - zip -r ResultBundle.zip ResultBundle.xcresult - - name: Save test results - uses: actions/upload-artifact@v3 - with: - name: macOS-Integration-results - path: | - TestResults/ResultBundle.zip + # IntegrationTests removed because source is not compatible with Sendable yet.