Fix build and test workflow runs being duplicated on PRs (#488) #385
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
| # Copyright (c) HashiCorp, Inc. | |
| # SPDX-License-Identifier: MPL-2.0 | |
| name: HCPT Test | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - release/** | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd | |
| - name: Set up Go | |
| uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e | |
| with: | |
| go-version-file: "go.mod" | |
| - name: Build server | |
| run: | | |
| make build | |
| - name: Start server | |
| env: | |
| ENABLE_TF_OPERATIONS: true | |
| run: | | |
| nohup ./bin/terraform-mcp-server streamable-http --transport-host 0.0.0.0 --transport-port 8080 2>&1 & | |
| - name: Run tests against HCPT | |
| env: | |
| TF_MCP_ENDPOINT: http://localhost:8080/mcp | |
| TFE_TOKEN: ${{ secrets.TFE_TOKEN_TESTING }} | |
| TFE_ORG_NAME: ${{ vars.TEST_TF_ORG_NAME }} | |
| TFE_USERNAME: ${{ vars.TEST_TF_USERNAME }} | |
| TFE_USER_EMAIL: ${{ vars.TEST_TF_USER_EMAIL }} | |
| ENABLE_TF_OPERATIONS: true | |
| run: | | |
| make test-hcpt |