From d248f1e99dd91a2b3a0631334bddc733a881bf88 Mon Sep 17 00:00:00 2001 From: Audrey Sage Lorberfeld Date: Mon, 16 Dec 2024 16:15:16 -0800 Subject: [PATCH] Remove `git submodule` cmds and update Vercel cmds in `external-app` tests (#316) ## Problem The addition of `git submodule...` commands was causing issues with the `ts-fetch` generator. Exactly why it was causing those issues remains an open question, but this way originally worked and the `git submodule` cmds were just added as a safety precaution. We can remove them since they're causing unnecessary cruft. ## Addition This PR includes additional work done to the GH actions file for the external app Edge runtime testing: the Vercel cmds were out of date, causing CI to fail. --- .github/actions/external-app/edge/action.yml | 4 +- .github/workflows/testing.yml | 368 +++++++++---------- codegen/build-oas.sh | 5 +- 3 files changed, 188 insertions(+), 189 deletions(-) diff --git a/.github/actions/external-app/edge/action.yml b/.github/actions/external-app/edge/action.yml index e9323c2c..d6e6d764 100644 --- a/.github/actions/external-app/edge/action.yml +++ b/.github/actions/external-app/edge/action.yml @@ -51,8 +51,8 @@ runs: - name: Install Vercel CLI and (re)deploy the app run: | cd ts-client-test-external-app - npm install vercel - vercel --token ${{ inputs.vercel-token }} + npm install --global vercel@latest + vercel --token ${{ inputs.vercel-token }} --yes vercel pull --yes --token ${{ inputs.vercel-token }} vercel build --token ${{ inputs.vercel-token }} vercel --token ${{ inputs.vercel-token }} --prod diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 9bb47dd1..ae41e755 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -26,190 +26,190 @@ jobs: SERVERLESS_INDEX_NAME=$(npx ts-node ./src/integration/setup.ts | grep "SERVERLESS_INDEX_NAME=" | cut -d'=' -f2) echo "SERVERLESS_INDEX_NAME=$SERVERLESS_INDEX_NAME" >> $GITHUB_OUTPUT - unit-tests: - needs: setup - name: Run unit tests - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup - uses: ./.github/actions/setup - - - name: Run tests - env: - CI: true - run: npm run test:unit -- --coverage - - integration-tests: - needs: setup - name: Run integration tests - runs-on: ubuntu-latest - outputs: - serverlessIndexName: ${{ steps.runTests1.outputs.SERVERLESS_INDEX_NAME }} - strategy: - fail-fast: false - max-parallel: 2 - matrix: - pinecone_env: - - prod - # - staging - node_version: [18.x, 20.x] - config: - [ - { runner: 'npm', jest_env: 'node' }, - { runner: 'npm', jest_env: 'edge' }, - { runner: 'bun', jest_env: 'node', bun_version: '1.0.0' }, - { runner: 'bun', jest_env: 'node', bun_version: '1.0.36' }, - { runner: 'bun', jest_env: 'node', bun_version: '1.1.11' }, - ] - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup - uses: ./.github/actions/setup - with: - node_version: ${{ matrix.node_version }} - - - name: Setup bun - if: matrix.config.bun_version - uses: oven-sh/setup-bun@v1 - with: - bun-version: ${{ matrix.config.bun_version }} - - - name: Run integration tests (Prod) - id: runTests1 - if: matrix.pinecone_env == 'prod' - env: - CI: true - PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} - SERVERLESS_INDEX_NAME: ${{ needs.setup.outputs.serverlessIndexName}} - run: | - ${{ matrix.config.runner }} run test:integration:${{ matrix.config.jest_env }} - echo "SERVERLESS_INDEX_NAME=${{ needs.setup.outputs.serverlessIndexName}}" >> $GITHUB_OUTPUT - - - name: Run integration tests (Staging) - if: matrix.pinecone_env == 'staging' - env: - CI: true - PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} - PINECONE_CONTROLLER_HOST: 'https://api-staging.pinecone.io' - run: ${{ matrix.config.runner }} run test:integration:${{ matrix.config.jest_env }} - - teardown: - name: Teardown - needs: integration-tests # Ensure teardown only runs after test jobs - runs-on: ubuntu-latest - if: always() # Run teardown even if the tests fail - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Install dependencies - run: npm ci - - - name: Run teardown script - env: - PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} - SERVERLESS_INDEX_NAME: ${{ needs.integration-tests.outputs.serverlessIndexName}} - run: | - npx ts-node ./src/integration/teardown.ts - - typescript-compilation-tests: - name: TS compile - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - tsVersion: - [ - '~4.1.0', - '~4.2.0', - '~4.3.0', - '~4.4.0', - '~4.5.0', - '~4.6.0', - '~4.7.0', - '~4.8.0', - '~4.9.0', - '~5.0.0', - '~5.1.0', - '~5.2.0', - 'latest', - ] - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 18.x - registry-url: 'https://registry.npmjs.org' - - name: Install npm packages - run: | - npm install --ignore-scripts - shell: bash - - name: Build TypeScript for Pinecone - run: npm run build - shell: bash - - name: install, compile, and run sample app - shell: bash - env: - PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} - run: | - set -x - cd .. - cp -r pinecone-ts-client/ts-compilation-test ts-compilation-test - cd ts-compilation-test - npm install typescript@${{ matrix.tsVersion }} --no-cache - npm install '../pinecone-ts-client' --no-cache - cat package.json - cat package-lock.json - npm run tsc-version - npm run build - npm run start - - example-app-semantic-search: - name: 'Example app: semantic search' - runs-on: ubuntu-latest - steps: - - name: Checkout pinecone-ts-client - uses: actions/checkout@v4 - with: - path: pinecone-ts-client - - name: Checkout semantic-search-example - uses: actions/checkout@v4 - with: - repository: pinecone-io/semantic-search-example - ref: spruce - path: semantic-search-example - - name: Install and build client - shell: bash - run: | - cd pinecone-ts-client - npm install --ignore-scripts - npm run build - - name: Install and build sample app - shell: bash - run: | - cd semantic-search-example - npm install --no-cache - npm install '../pinecone-ts-client' - cat package.json - - name: Run example tests with dev version of client - env: - CI: true - PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} - PINECONE_INDEX: 'semantic-search' - PINECONE_CLOUD: 'aws' - PINECONE_REGION: 'us-west-2' - shell: bash - run: | - cd semantic-search-example - npm run test + unit-tests: + needs: setup + name: Run unit tests + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup + uses: ./.github/actions/setup + + - name: Run tests + env: + CI: true + run: npm run test:unit -- --coverage + + integration-tests: + needs: setup + name: Run integration tests + runs-on: ubuntu-latest + outputs: + serverlessIndexName: ${{ steps.runTests1.outputs.SERVERLESS_INDEX_NAME }} + strategy: + fail-fast: false + max-parallel: 2 + matrix: + pinecone_env: + - prod + # - staging + node_version: [18.x, 20.x] + config: + [ + { runner: 'npm', jest_env: 'node' }, + { runner: 'npm', jest_env: 'edge' }, + { runner: 'bun', jest_env: 'node', bun_version: '1.0.0' }, + { runner: 'bun', jest_env: 'node', bun_version: '1.0.36' }, + { runner: 'bun', jest_env: 'node', bun_version: '1.1.11' }, + ] + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup + uses: ./.github/actions/setup + with: + node_version: ${{ matrix.node_version }} + + - name: Setup bun + if: matrix.config.bun_version + uses: oven-sh/setup-bun@v1 + with: + bun-version: ${{ matrix.config.bun_version }} + + - name: Run integration tests (Prod) + id: runTests1 + if: matrix.pinecone_env == 'prod' + env: + CI: true + PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} + SERVERLESS_INDEX_NAME: ${{ needs.setup.outputs.serverlessIndexName}} + run: | + ${{ matrix.config.runner }} run test:integration:${{ matrix.config.jest_env }} + echo "SERVERLESS_INDEX_NAME=${{ needs.setup.outputs.serverlessIndexName}}" >> $GITHUB_OUTPUT + + - name: Run integration tests (Staging) + if: matrix.pinecone_env == 'staging' + env: + CI: true + PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} + PINECONE_CONTROLLER_HOST: 'https://api-staging.pinecone.io' + run: ${{ matrix.config.runner }} run test:integration:${{ matrix.config.jest_env }} + + teardown: + name: Teardown + needs: integration-tests # Ensure teardown only runs after test jobs + runs-on: ubuntu-latest + if: always() # Run teardown even if the tests fail + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install dependencies + run: npm ci + + - name: Run teardown script + env: + PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} + SERVERLESS_INDEX_NAME: ${{ needs.integration-tests.outputs.serverlessIndexName}} + run: | + npx ts-node ./src/integration/teardown.ts + + typescript-compilation-tests: + name: TS compile + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + tsVersion: + [ + '~4.1.0', + '~4.2.0', + '~4.3.0', + '~4.4.0', + '~4.5.0', + '~4.6.0', + '~4.7.0', + '~4.8.0', + '~4.9.0', + '~5.0.0', + '~5.1.0', + '~5.2.0', + 'latest', + ] + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 18.x + registry-url: 'https://registry.npmjs.org' + - name: Install npm packages + run: | + npm install --ignore-scripts + shell: bash + - name: Build TypeScript for Pinecone + run: npm run build + shell: bash + - name: install, compile, and run sample app + shell: bash + env: + PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} + run: | + set -x + cd .. + cp -r pinecone-ts-client/ts-compilation-test ts-compilation-test + cd ts-compilation-test + npm install typescript@${{ matrix.tsVersion }} --no-cache + npm install '../pinecone-ts-client' --no-cache + cat package.json + cat package-lock.json + npm run tsc-version + npm run build + npm run start + + example-app-semantic-search: + name: 'Example app: semantic search' + runs-on: ubuntu-latest + steps: + - name: Checkout pinecone-ts-client + uses: actions/checkout@v4 + with: + path: pinecone-ts-client + - name: Checkout semantic-search-example + uses: actions/checkout@v4 + with: + repository: pinecone-io/semantic-search-example + ref: spruce + path: semantic-search-example + - name: Install and build client + shell: bash + run: | + cd pinecone-ts-client + npm install --ignore-scripts + npm run build + - name: Install and build sample app + shell: bash + run: | + cd semantic-search-example + npm install --no-cache + npm install '../pinecone-ts-client' + cat package.json + - name: Run example tests with dev version of client + env: + CI: true + PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} + PINECONE_INDEX: 'semantic-search' + PINECONE_CLOUD: 'aws' + PINECONE_REGION: 'us-west-2' + shell: bash + run: | + cd semantic-search-example + npm run test external-app: name: external-app diff --git a/codegen/build-oas.sh b/codegen/build-oas.sh index 8449c467..dacbe00f 100755 --- a/codegen/build-oas.sh +++ b/codegen/build-oas.sh @@ -10,11 +10,10 @@ build_dir="build" update_apis_repo() { echo "Updating apis repo" - git submodule update --init --recursive - git submodule sync --recursive pushd codegen/apis + git fetch git checkout main - git pull origin main + git pull just build popd }