Bump golang.org/x/tools from 0.24.0 to 0.25.0 (#103) #359
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: action-test | |
on: [push] | |
jobs: | |
test: | |
name: test | |
permissions: | |
contents: write | |
packages: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: setup go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- name: set action image version to dev | |
run: | | |
yq e -i '.runs.image = "docker://ghcr.io/vladopajic/go-test-coverage:dev"' action.yml | |
image=$(yq '.runs.image' action.yml) | |
echo "Image: $image" | |
- name: login to GitHub container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: build and push | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
build-args: | | |
VERSION=dev | |
tags: | | |
ghcr.io/vladopajic/go-test-coverage:dev | |
- name: generate test coverage | |
run: go test ./... -coverprofile=./cover.out -covermode=atomic | |
## Test 1 | |
- name: "test: total coverage 0% (config)" | |
uses: ./ | |
id: test-1 | |
with: | |
config: ./.github/workflows/testdata/zero.yml | |
- name: "check: test output values" | |
if: ${{ steps.test-1.outputs.total-coverage == '' || steps.test-1.outputs.badge-text == '' || steps.test-1.outputs.badge-color == '' }} | |
shell: bash | |
run: echo "Previous step should have output values" && exit 1 | |
## Test 2 | |
- name: "test: total coverage 100% (config)" | |
uses: ./ | |
id: test-2 | |
continue-on-error: true | |
with: | |
config: ./.github/workflows/testdata/total100.yml | |
- name: "check: test should have failed" | |
if: steps.test-2.outcome != 'failure' | |
shell: bash | |
run: echo "Previous step should have failed" && exit 1 | |
- name: "check: test output values" | |
if: ${{ steps.test-2.outputs.total-coverage == '' || steps.test-2.outputs.badge-text == '' || steps.test-2.outputs.badge-color == '' }} | |
shell: bash | |
run: echo "Previous step should have output values" && exit 1 | |
## Test 3 | |
- name: "test: total coverage 0% (inputs)" | |
uses: ./ | |
id: test-3 | |
with: | |
profile: cover.out | |
local-prefix: "github.com/vladopajic/go-test-coverage/v2" | |
threshold-file: 0 | |
threshold-package: 0 | |
threshold-total: 0 | |
## Test 4 | |
- name: "test: total coverage 100% (inputs)" | |
uses: ./ | |
id: test-4 | |
continue-on-error: true | |
with: | |
profile: cover.out | |
local-prefix: "github.com/vladopajic/go-test-coverage/v2" | |
threshold-file: 0 | |
threshold-package: 0 | |
threshold-total: 100 | |
- name: "check: test should have failed" | |
if: steps.test-4.outcome != 'failure' | |
shell: bash | |
run: echo "Previous step should have failed" && exit 1 | |
## Test 5 | |
- name: "test: override config" | |
uses: ./ | |
id: test-5 | |
with: | |
config: ./.github/workflows/testdata/total100.yml | |
threshold-file: 0 | |
threshold-package: 0 | |
threshold-total: 0 |