From 5028e082bd66a0c8388f352aaebc8eaacda8dc04 Mon Sep 17 00:00:00 2001 From: Calvin Cestari Date: Mon, 4 Dec 2023 11:59:06 -0800 Subject: [PATCH 1/2] Adds frontend bundle validation to CI --- .github/workflows/ci-tests.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index 079bc0444..564a6651c 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -207,6 +207,31 @@ jobs: shell: bash run: | ./scripts/run-test-codegen-configurations.sh -t + + verify-frontend-bundle-latest: + runs-on: macos-13 + 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: Install Node packages + shell: bash + working-directory: apollo-ios-codegen/Sources/GraphQLCompiler/JavaScript + run: | + npm install + - name: Rollup Bundle + shell: bash + working-directory: apollo-ios-codegen/Sources/GraphQLCompiler/JavaScript + run: | + npm install --global rollup + sh ./auto_rollup.sh + - name: Verify Latest + shell: bash + run: | + git diff --exit-code run-cocoapods-integration-tests: runs-on: macos-13 From d1727463a89544f12e9194877ac99261b0e766ea Mon Sep 17 00:00:00 2001 From: Calvin Cestari Date: Mon, 4 Dec 2023 11:15:00 -0800 Subject: [PATCH 2/2] rollup config + fail on error --- .../Sources/GraphQLCompiler/JavaScript/auto_rollup.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apollo-ios-codegen/Sources/GraphQLCompiler/JavaScript/auto_rollup.sh b/apollo-ios-codegen/Sources/GraphQLCompiler/JavaScript/auto_rollup.sh index ab171ce0b..0e03d6e7d 100755 --- a/apollo-ios-codegen/Sources/GraphQLCompiler/JavaScript/auto_rollup.sh +++ b/apollo-ios-codegen/Sources/GraphQLCompiler/JavaScript/auto_rollup.sh @@ -1,8 +1,9 @@ #!/usr/bin/env bash +set -e SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) output_file="$SCRIPT_DIR/../ApolloCodegenFrontendBundle.swift" -$( cd "$SCRIPT_DIR" && rollup -c ) +$( cd "$SCRIPT_DIR" && rollup -c --bundleConfigAsCjs ) minJS=$(cat "$SCRIPT_DIR/dist/ApolloCodegenFrontend.bundle.js") printf "%s%s%s" "let ApolloCodegenFrontendBundle: String = #\"" "$minJS" "\"#" > $output_file exit 0