Test Spawn-Terminate #127
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Test action to spawn/terminate backend instance | |
| name: Test Spawn-Terminate | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| # TODO Make a common workflow for all providers since they use the exact same steps. | |
| jobs: | |
| action-start: | |
| name: GitHub Actions Test (spawn) | |
| runs-on: ubuntu-latest | |
| outputs: | |
| runner-aws: ${{ steps.gen-output.outputs.runner_aws }} | |
| steps: | |
| - name: Checkout | |
| id: checkout | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
| - name: Test start instance | |
| id: test-start | |
| uses: ./ | |
| with: | |
| mode: start | |
| github-token: ${{ secrets.SLAB_ACTION_TOKEN }} | |
| slab-url: ${{ secrets.SLAB_BASE_URL_PRE_PROD }} | |
| job-secret: ${{ secrets.JOB_SECRET }} | |
| backend: terraform | |
| profile: aws-ci-test | |
| - name: Generate output | |
| id: gen-output | |
| run: | | |
| echo "runner_aws=${{ steps.test-start.outputs.label }}" >> "${GITHUB_OUTPUT}" | |
| test-runner-alive-aws: | |
| name: Test runner is alive (AWS) | |
| needs: [action-start] | |
| uses: ./.github/workflows/registered_runner.yml | |
| with: | |
| runner-name: ${{ needs.action-start.outputs.runner-aws }} | |
| action-stop: | |
| name: GitHub Actions Test (terminate) | |
| runs-on: ubuntu-latest | |
| needs: [action-start, test-runner-alive-aws ] | |
| if: ${{ always() && needs.action-start.result != 'skipped' }} | |
| steps: | |
| - name: Checkout | |
| id: checkout | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
| - name: Test stop instance | |
| id: test-stop | |
| uses: ./ | |
| with: | |
| mode: stop | |
| github-token: ${{ secrets.SLAB_ACTION_TOKEN }} | |
| slab-url: ${{ secrets.SLAB_BASE_URL_PRE_PROD }} | |
| job-secret: ${{ secrets.JOB_SECRET }} | |
| label: ${{ needs.action-start.outputs.runner-aws }} | |
| test-runner-removed-aws: | |
| name: Test runner is removed (AWS) | |
| needs: [action-start, action-stop] | |
| uses: ./.github/workflows/removed_runner.yml | |
| with: | |
| runner-name: ${{ needs.action-start.outputs.runner-aws }} | |
| must-exist: false | |
| secrets: | |
| READ_REPO_TOKEN: ${{ secrets.SLAB_ACTION_TOKEN }} |