chore(deps): bump hashicorp/setup-terraform from 3 to 4 #617
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: Test | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| unit-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout infraspec | |
| uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: go.mod | |
| - name: Cache Go modules | |
| uses: actions/cache@v5 | |
| with: | |
| path: | | |
| ~/go/pkg/mod | |
| ~/.cache/go-build | |
| key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
| restore-keys: | | |
| ${{ runner.os }}-go- | |
| - name: Run Unit Tests | |
| run: | | |
| # Run all unit tests (excluding integration tests in test/ directory) | |
| go test -v $(go list ./... | grep -v '/test$') | |
| env: | |
| INFRASPEC_TELEMETRY_DISABLED: "1" | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout infraspec | |
| uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: go.mod | |
| - name: Cache Go modules | |
| uses: actions/cache@v5 | |
| with: | |
| path: | | |
| ~/go/pkg/mod | |
| ~/.cache/go-build | |
| key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
| restore-keys: | | |
| ${{ runner.os }}-go- | |
| - name: Build InfraSpec Binary | |
| run: | | |
| go build -o ./infraspec ./cmd/infraspec | |
| - name: Upload InfraSpec Binary | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: infraspec-binary | |
| path: ./infraspec | |
| retention-days: 1 | |
| integration-test-aws: | |
| name: Integration Test (${{ matrix.service }}) | |
| runs-on: ubuntu-latest | |
| needs: build | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| service: [dynamodb, ec2, iam, lambda, rds, s3, sqs] | |
| include: | |
| - service: terraform | |
| path: features/terraform/ | |
| steps: | |
| - name: Checkout infraspec | |
| uses: actions/checkout@v6 | |
| - name: Download InfraSpec Binary | |
| uses: actions/download-artifact@v7 | |
| with: | |
| name: infraspec-binary | |
| - name: Make InfraSpec Binary Executable | |
| run: chmod +x ./infraspec | |
| - name: Install Terraform | |
| uses: hashicorp/setup-terraform@v4 | |
| with: | |
| terraform_version: "1.5.7" | |
| terraform_wrapper: false | |
| - name: Cache Terraform providers | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.terraform.d/plugin-cache | |
| key: terraform-providers-${{ matrix.service }}-${{ hashFiles('**/*.tf') }} | |
| restore-keys: | | |
| terraform-providers-${{ matrix.service }}- | |
| terraform-providers- | |
| - name: Run Integration Tests | |
| run: | | |
| if [ "${{ matrix.service }}" = "terraform" ]; then | |
| ./infraspec features/terraform/ --parallel 4 | |
| else | |
| ./infraspec features/aws/${{ matrix.service }}/ --parallel 4 | |
| fi | |
| env: | |
| INFRASPEC_TELEMETRY_DISABLED: "1" | |
| INFRASPEC_CLOUD_TOKEN: ${{ secrets.INFRASPEC_CLOUD_TOKEN }} | |
| TF_PLUGIN_CACHE_DIR: ~/.terraform.d/plugin-cache | |
| integration-test-http: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Checkout infraspec | |
| uses: actions/checkout@v6 | |
| - name: Download InfraSpec Binary | |
| uses: actions/download-artifact@v7 | |
| with: | |
| name: infraspec-binary | |
| - name: Make InfraSpec Binary Executable | |
| run: chmod +x ./infraspec | |
| - name: Start httpbin | |
| run: | | |
| docker run -d --name httpbin -p 9000:80 kennethreitz/httpbin | |
| # Wait for httpbin to be ready | |
| timeout 30 bash -c 'until curl -f http://localhost:9000/status/200; do sleep 1; done' | |
| - name: Run HTTP Tests | |
| run: | | |
| ./infraspec features/http/ | |
| env: | |
| INFRASPEC_TELEMETRY_DISABLED: "1" | |
| INFRASPEC_BEARER_TOKEN: "test-token" | |
| - name: Cleanup httpbin | |
| if: always() | |
| run: | | |
| docker stop httpbin || true | |
| docker rm httpbin || true |