From d0c9f3ec516008492ea9226295c52071d24c015f Mon Sep 17 00:00:00 2001 From: Ramon Quitales Date: Wed, 10 Jan 2024 15:14:40 -0800 Subject: [PATCH] WIP initial fan out for nodejs tests --- .github/workflows/run-acceptance-tests.yml | 38 +++++++++++++++------- 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/.github/workflows/run-acceptance-tests.yml b/.github/workflows/run-acceptance-tests.yml index 6f6fc273b7..899fc375c0 100644 --- a/.github/workflows/run-acceptance-tests.yml +++ b/.github/workflows/run-acceptance-tests.yml @@ -10,6 +10,7 @@ on: - master - main - v4 + - rquitales/test-fan-out paths-ignore: - CHANGELOG.md workflow_dispatch: {} @@ -48,6 +49,23 @@ env: GOOGLE_PROJECT_NUMBER: 637339343727 PR_COMMIT_SHA: ${{ github.event.client_payload.pull_request.head.sha }} jobs: + generate-test-names: + runs-on: ubuntu-latest + name: generate-test-names + outputs: + test-names: ${{ steps.generate.outputs.test-names }} + steps: + - name: Checkout Repo + uses: actions/checkout@v3 + with: + lfs: true + ref: ${{ env.PR_COMMIT_SHA }} + - name: Generate test names + id: generate + run: | + TEST_NAMES=$(cd tests/sdk/nodejs && grep -r -h -o -E 'func Test[A-Z][a-zA-Z0-9_]+' | sort | uniq | sed 's/func //g') + TEST_NAMES_JSON=$(printf '%s\n' "${TEST_NAMES[@]}" | jq -R . | jq -s .) + echo "::set-output name=test-names::$TEST_NAMES_JSON" comment-notification: runs-on: ubuntu-latest name: comment-notification @@ -249,17 +267,13 @@ jobs: test: runs-on: pulumi-ubuntu-8core needs: + - generate-test-names - build_sdks - build-test-cluster strategy: fail-fast: true matrix: - language: - - nodejs - - python - - dotnet - - go - - java + test-name: ${{ fromJson(needs.generate-test-names.outputs.test-names) }} name: test permissions: contents: read @@ -324,11 +338,11 @@ jobs: - name: Download SDK uses: actions/download-artifact@v2 with: - name: ${{ matrix.language }}-sdk.tar.gz - path: ${{ github.workspace}}/sdk/ + name: nodejs-sdk.tar.gz + path: nodejs/sdk/ - name: UnTar SDK folder - run: tar -zxf ${{ github.workspace}}/sdk/${{ matrix.language}}.tar.gz -C ${{ - github.workspace}}/sdk/${{ matrix.language}} + run: tar -zxf ${{ github.workspace}}/sdk/nodejs.tar.gz -C ${{ + github.workspace}}/sdk/nodejs - name: Update path run: echo "${{ github.workspace }}/bin" >> $GITHUB_PATH - name: Install Node dependencies @@ -339,7 +353,7 @@ jobs: pip3 install virtualenv==20.0.23 pip3 install pipenv - name: Install dependencies - run: make install_${{ matrix.language}}_sdk + run: make install_nodejs_sdk - name: Make Kube Directory run: mkdir -p "~/.kube/" - name: Download Kubeconfig @@ -390,7 +404,7 @@ jobs: version: v2.4.0 token: ${{ secrets.GITHUB_TOKEN }} - name: Run tests - run: cd tests/sdk/${{ matrix.language }} && go test -v -count=1 -cover -timeout + run: cd tests/sdk/nodejs && go test -v -count=1 -cover -timeout -run ^${{ matrix.test-name}}$ 2h -parallel 4 ./... - if: failure() && github.event_name == 'push' name: Notify Slack