IND-2525 error correction #79
This file contains 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: hashicorp/go-multierror/go-multierror | |
on: | |
- push | |
- pull_request | |
permissions: | |
contents: read | |
jobs: | |
go-fmt: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get go-version | |
run: go version | |
- name: Checkout code | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Setup go | |
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 | |
with: | |
go-version-file: go.mod | |
- name: check go fmt | |
run: |- | |
files="$(go fmt ./...)" | |
if [ -n "$files" ]; then | |
echo "The following file(s) do not conform to go fmt:" | |
echo "$files" | |
exit 1 | |
fi | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Setup go | |
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 | |
with: | |
go-version-file: go.mod | |
- name: Run golangci-lint | |
uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5 | |
linux-tests: | |
runs-on: ubuntu-latest | |
env: | |
TEST_RESULTS_PATH: '/tmp/test-results' | |
strategy: | |
matrix: | |
go-version: | |
- '1.13' # oldest supported; named in go.mod | |
- 'oldstable' | |
- 'stable' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Setup go | |
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Install gotestsum | |
uses: autero1/action-gotestsum@7263b9d73912eec65f46337689e59fac865c425f # v2.0.0 | |
with: | |
gotestsum_version: 1.9.0 | |
- name: Get go version and env | |
run: | | |
go version | |
go env | |
- name: Create test directory | |
run: mkdir -p "$TEST_RESULTS_PATH/go-multierror" | |
- name: Run go tests | |
env: | |
PLATFORM: linux | |
REPORT_FILE: ${{ env.TEST_RESULTS_PATH }}/go-multierror/gotestsum-report.xml | |
run: |- | |
gotestsum --format=short-verbose --junitfile ${{ env.REPORT_FILE }} -- -p 2 -cover -coverprofile=coverage-linux.out ./... | |
- name: Upload and save artifacts | |
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 | |
with: | |
path: ${{ env.TEST_RESULTS_PATH }} | |
name: tests-linux-${{ matrix.go-version }} | |
- name: Upload coverage report | |
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 | |
with: | |
path: coverage-linux.out | |
name: Coverage-report-linux-${{matrix.go-version}} | |
- name: Display coverage report | |
run: go tool cover -func=coverage-linux.out | |
windows-tests: | |
runs-on: windows-latest | |
env: | |
TEST_RESULTS_PATH: 'c:\Users\runneradmin\AppData\Local\Temp\test-results' | |
strategy: | |
matrix: | |
go-version: | |
- '1.13' # oldest supported; named in go.mod | |
- 'oldstable' | |
- 'stable' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Setup Go | |
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Get go-version and env | |
run: | | |
go version | |
go env | |
- run: git config --global core.autocrlf false | |
- name: Download go modules | |
run: go mod download | |
- name: Install gotestsum | |
uses: autero1/action-gotestsum@7263b9d73912eec65f46337689e59fac865c425f # v2.0.0 | |
with: | |
gotestsum_version: 1.9.0 | |
- name: Run go tests | |
env: | |
PLATFORM: win | |
REPORT_FILE: ${{ env.TEST_RESULTS_PATH }}/go-multierror/gotestsum-report.xml | |
run: |- | |
gotestsum.exe --format=short-verbose --junitfile ${{ env.REPORT_FILE }} -- -p 2 -cover -coverprofile="coverage-win.out" ./... | |
- name: Upload and save artifacts | |
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 | |
with: | |
path: ${{ env.TEST_RESULTS_PATH }} | |
name: tests-windows-${{ matrix.go-version }} | |
- name: Upload coverage test | |
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 | |
with: | |
path: coverage-win.out | |
name: Coverage-report-win-${{matrix.go-version}} | |
- name: Display coverage report | |
run: go tool cover -func=coverage-win.out | |
shell: cmd |