Refactor OpenTofu CLI commands and tests #1
Workflow file for this run
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: Go Tests | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: 1.25.5 | |
| - name: Run tests | |
| run: | | |
| go test -v ./... | |
| go test -coverprofile=cover.out ./... | |
| go tool cover -func=cover.out | |
| - name: Add test results to summary | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const testResults = fs.readFileSync('test-results.txt', 'utf8'); | |
| const coverage = fs.readFileSync('coverage.txt', 'utf8'); | |
| core.summary | |
| .addHeading('Go Test Results') | |
| .addCodeBlock(testResults) | |
| .addHeading('Coverage Summary') | |
| .addCodeBlock(coverage) | |
| .write(); |