diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index f6acf44b037b..133fe9ac3851 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -442,11 +442,79 @@ jobs: autoAcceptChanges: true exitOnceUploaded: true - frontend-test: + # In case of self-hosted EC2 errors, remove this block. + stop-frontend-runner: + name: "Frontend: Stop Runner" + timeout-minutes: 10 + needs: + - start-frontend-runner # required to get output from the start-runner job + - frontend-build # required to wait when then build job is done + runs-on: ubuntu-latest + # Always is required to stop the runner even if the previous job has errors. However always() runs even if the previous step is skipped. + # Thus, we check for skipped here. + if: ${{ always() && needs.start-frontend-runner.result != 'skipped'}} + steps: + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.SELF_RUNNER_AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.SELF_RUNNER_AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-2 + - name: Checkout Airbyte + uses: actions/checkout@v3 + - name: Check PAT rate limits + run: | + ./tools/bin/find_non_rate_limited_PAT \ + ${{ secrets.AIRBYTEIO_PAT }} \ + ${{ secrets.OSS_BUILD_RUNNER_GITHUB_PAT }} \ + ${{ secrets.SUPERTOPHER_PAT }} \ + ${{ secrets.DAVINCHIA_PAT }} + - name: Stop EC2 runner + uses: supertopher/ec2-github-runner@base64v1.0.10 + with: + mode: stop + github-token: ${{ env.PAT }} + label: ${{ needs.start-frontend-runner.outputs.label }} + ec2-instance-id: ${{ needs.start-frontend-runner.outputs.ec2-instance-id }} + + ## Frontend Test + # In case of self-hosted EC2 errors, remove this block. + start-frontend-e2e-runner: + name: "Frontend E2E Tests: Start EC2 Runner" + needs: + - changes + # Because scheduled builds on master require us to skip the changes job. Use always() to force this to run on master. + if: | + needs.changes.outputs.frontend == 'true' || needs.changes.outputs.build == 'true' || github.ref == 'refs/heads/master' + || (always() && needs.changes.outputs.backend == 'true') + timeout-minutes: 10 + runs-on: ubuntu-latest + outputs: + label: ${{ steps.start-ec2-runner.outputs.label }} + ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} + steps: + - name: Checkout Airbyte + uses: actions/checkout@v3 + - name: Check PAT rate limits + run: | + ./tools/bin/find_non_rate_limited_PAT \ + ${{ secrets.AIRBYTEIO_PAT }} \ + ${{ secrets.OSS_BUILD_RUNNER_GITHUB_PAT }} \ + ${{ secrets.SUPERTOPHER_PAT }} \ + ${{ secrets.DAVINCHIA_PAT }} + - name: Start AWS Runner + id: start-ec2-runner + uses: ./.github/actions/start-aws-runner + with: + aws-access-key-id: ${{ secrets.SELF_RUNNER_AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.SELF_RUNNER_AWS_SECRET_ACCESS_KEY }} + github-token: ${{ env.PAT }} + + frontend-e2e-test: name: "Frontend: Run End-to-End Tests" needs: - - start-frontend-runner # required to have runner started - runs-on: ${{ needs.start-frontend-runner.outputs.label }} # run the job on the newly created runner + - start-frontend-e2e-runner # required to have runner started + runs-on: ${{ needs.start-frontend-e2e-runner.outputs.label }} # run the job on the newly created runner timeout-minutes: 120 steps: - name: Checkout Airbyte @@ -505,18 +573,18 @@ jobs: command: ./tools/bin/e2e_test.sh attempt_limit: 3 attempt_delay: 5000 # in ms + # In case of self-hosted EC2 errors, remove this block. - stop-frontend-runner: - name: "Frontend: Stop Runner" + stop-frontend-e2e-runner: + name: "Frontend E2E Tests: Stop Runner" timeout-minutes: 10 needs: - - start-frontend-runner # required to get output from the start-runner job - - frontend-test # required to wait when the e2e-test job is done - - frontend-build # required to wait when then build job is done + - start-frontend-e2e-runner # required to get output from the start-runner job + - frontend-e2e-test # required to wait when the e2e-test job is done runs-on: ubuntu-latest # Always is required to stop the runner even if the previous job has errors. However always() runs even if the previous step is skipped. # Thus, we check for skipped here. - if: ${{ always() && needs.start-frontend-runner.result != 'skipped'}} + if: ${{ always() && needs.start-frontend-e2e-runner.result != 'skipped'}} steps: - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v1 @@ -538,8 +606,8 @@ jobs: with: mode: stop github-token: ${{ env.PAT }} - label: ${{ needs.start-frontend-runner.outputs.label }} - ec2-instance-id: ${{ needs.start-frontend-runner.outputs.ec2-instance-id }} + label: ${{ needs.start-frontend-e2e-runner.outputs.label }} + ec2-instance-id: ${{ needs.start-frontend-e2e-runner.outputs.ec2-instance-id }} ## FOLLOWING BUILDS ARE ALL PLATFORM BUILDS.