Skip to content

Refactor OpenTofu CLI commands and tests #1

Refactor OpenTofu CLI commands and tests

Refactor OpenTofu CLI commands and tests #1

Workflow file for this run

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();