version bump to v2.11.0 #529
Workflow file for this run
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: | |
build-dev-image: | |
name: build dev image | |
permissions: | |
packages: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- 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 | |
- uses: actions/delete-package-versions@v5 | |
with: | |
owner: vladopajic | |
package-name: go-test-coverage | |
package-type: container | |
min-versions-to-keep: 5 | |
delete-only-untagged-versions: true | |
test: | |
name: test | |
runs-on: ubuntu-latest | |
needs: build-dev-image | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: setup go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- name: generate test coverage | |
run: go test ./... -coverprofile=./cover.out -covermode=atomic | |
- 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" | |
## 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 |