Integration [pull_request_target: 2a6bb77c8b9d528316d9ced13ad3a7befe5b105f]: #3088
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
| name: "Tests: Integration" | |
| run-name: "Integration [${{ github.event_name }}: ${{ github.event.pull_request.head.sha || github.event.push.after || github.event.workflow_run.head_sha}}]: ${{ github.event.workflow_run.head_commit.message }}" | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| workflow: | |
| description: Tests to run | |
| required: true | |
| type: choice | |
| options: | |
| - all | |
| - run-integration-tests-cf-env | |
| - run-integration-tests-cf-env-with-client-creds | |
| env-name: | |
| description: Pre-provisioned environment name to use in tests | |
| required: false | |
| type: string | |
| push: | |
| tags: | |
| - "v8.*" | |
| pull_request_target: | |
| branches: | |
| - main | |
| - v8 | |
| types: | |
| - opened | |
| - synchronize | |
| - reopened | |
| - labeled | |
| paths-ignore: | |
| - "doc/**" | |
| - ".gitpod.yml" | |
| - "README.md" | |
| jobs: | |
| get-sha: | |
| runs-on: ubuntu-latest | |
| if: | | |
| ${{ github.actor != 'dependabot[bot]' && ( | |
| github.event_name == 'workflow_dispatch' || | |
| github.event_name == 'push' || | |
| github.event.pull_request.author_association == 'OWNER' || | |
| github.event.pull_request.author_association == 'COLLABORATOR' || | |
| (github.event.action == 'labeled' && | |
| github.event.label.name == 'safe-to-test') | |
| ) }} | |
| outputs: | |
| gitRef: ${{steps.calculate.outputs.ref}} | |
| steps: | |
| - id: calculate | |
| run: | | |
| if [[ "${{ github.event_name }}" == "pull_request_target" ]]; then | |
| echo "checkout pull request head ${{ github.event.pull_request.head.sha }}" | |
| echo "ref=${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT | |
| elif [[ "${{ github.event_name }}" == "push" ]]; then | |
| echo "checkout push request ${{github.event.push.after}}" | |
| echo "ref=${{github.event.push.after}}" >> $GITHUB_OUTPUT | |
| elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
| echo "checkout workflow_dispatch ref ${{ github.sha }}" | |
| echo "ref=${{ github.sha }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "checkout else ${{ github.event.workflow_run.head_sha }}" | |
| echo "ref=${{github.event.workflow_run.head_sha}}" >> $GITHUB_OUTPUT | |
| fi | |
| echo "Event: ${{ github.event_name }}, Workflow Input: ${{ github.event.inputs.workflow }}" | |
| units: | |
| name: Basic units to gate for integration tests | |
| runs-on: ubuntu-latest | |
| needs: | |
| - get-sha | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| with: | |
| ref: ${{needs.get-sha.outputs.gitRef}} | |
| fetch-depth: 0 | |
| # get-sha only produces this ref for OWNER/COLLABORATOR authors or | |
| # after a maintainer applies the safe-to-test label - see get-sha's | |
| # if: condition above. | |
| allow-unsafe-pr-checkout: true | |
| - name: Set Up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: go.mod | |
| - name: Run Units | |
| run: make units | |
| create-cf-env: | |
| name: Create bosh lite env | |
| needs: | |
| - get-sha | |
| - units | |
| if: ${{ inputs.env-name == '' }} | |
| uses: ./.github/workflows/create-bosh-lite.yml | |
| secrets: inherit | |
| set-env-name: | |
| name: Update env name | |
| runs-on: ubuntu-latest | |
| needs: | |
| - get-sha | |
| - units | |
| - create-cf-env | |
| outputs: | |
| env-name: ${{ steps.set-name.outputs.env-name }} | |
| if: ${{ always() && needs.get-sha.result == 'success' && github.actor != 'dependabot[bot]' }} | |
| steps: | |
| - name: set env name | |
| id: set-name | |
| run: | | |
| if [[ -n "${{ inputs.env-name }}" ]]; then | |
| echo "env-name=${{ inputs.env-name }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "env-name=${{ needs.create-cf-env.outputs.env-name }}" >> $GITHUB_OUTPUT | |
| fi | |
| run-integration-tests-cf-env: | |
| name: Integration tests | |
| needs: | |
| - get-sha | |
| - set-env-name | |
| if: ${{ | |
| always() && | |
| needs.set-env-name.result == 'success' && | |
| (github.event_name != 'workflow_dispatch' || inputs.workflow == 'all' || | |
| inputs.workflow == 'run-integration-tests-cf-env') }} | |
| uses: ./.github/workflows/tests-integration-reusable.yml | |
| with: | |
| name: Integration | |
| gitRef: ${{needs.get-sha.outputs.gitRef}} | |
| env-name: ${{ needs.set-env-name.outputs.env-name }} | |
| run-with-client-creds: false | |
| secrets: inherit | |
| run-integration-tests-cf-env-with-client-creds: | |
| name: client creds | |
| needs: | |
| - get-sha | |
| - set-env-name | |
| - run-integration-tests-cf-env | |
| if: ${{ | |
| always() && | |
| needs.set-env-name.result == 'success' && | |
| (github.event_name != 'workflow_dispatch' || inputs.workflow == 'all' || | |
| inputs.workflow == 'run-integration-tests-cf-env-with-client-creds') && | |
| needs.run-integration-tests-cf-env.result != 'failure' }} | |
| uses: ./.github/workflows/tests-integration-reusable.yml | |
| with: | |
| name: Integration client creds | |
| env-name: ${{ needs.set-env-name.outputs.env-name }} | |
| gitRef: ${{needs.get-sha.outputs.gitRef}} | |
| run-with-client-creds: true | |
| secrets: inherit | |
| delete-env: | |
| name: Unclaim environment | |
| if: ${{ always() && inputs.env-name == '' && needs.set-env-name.result == 'success' }} | |
| needs: | |
| - set-env-name | |
| - run-integration-tests-cf-env | |
| - run-integration-tests-cf-env-with-client-creds | |
| uses: ./.github/workflows/delete-bosh-lite.yml | |
| with: | |
| env-name: ${{ needs.set-env-name.outputs.env-name }} | |
| secrets: inherit |