Skip to content

clean up makefile and add testing badge, try 2 #9

clean up makefile and add testing badge, try 2

clean up makefile and add testing badge, try 2 #9

Workflow file for this run

name: Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
tests:
name: Tests and coverage
strategy:
matrix:
go-version: [ "1.19" ]
platform: [ "ubuntu-latest" ]
goflags: [ "-v -count=1 -json" ]
coveropts: [ "-coverprofile=coverage.txt -covermode=atomic" ]
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
id: go
- name: Restore Go cache
uses: actions/cache@v2
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum', 'testdata/**') }}
restore-keys: |
${{ runner.os }}-go-${{ matrix.go-version }}-
- name: Install tparse
run: go install github.com/mfridman/tparse@latest
- name: Check for .codecov.yaml
id: codecov-enabled
uses: andstor/file-existence-action@latest
with:
files: .codecov.yaml
- name: Test
env:
COVER_OPTS: ${{ matrix.coveropts }}
GOFLAGS: ${{ matrix.goflags }}
run: go test $COVER_OPTS ./... | tparse -all -notests -format markdown >> $GITHUB_STEP_SUMMARY
- if: steps.codecov-enabled.outputs.files_exists == 'true'
name: Upload Codecov Report
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: timbray/topfew
- name: Verify git clean
shell: bash
run: |
if [[ -z "$(git status --porcelain)" ]]; then
echo "${{ github.repository }} up to date."
else
echo "${{ github.repository }} is dirty."
echo "::error:: $(git status)"
exit 1
fi