Skip to content

Merge pull request #13 from qrdl/deps/update #69

Merge pull request #13 from qrdl/deps/update

Merge pull request #13 from qrdl/deps/update #69

Workflow file for this run

name: Test
on: [push, workflow_dispatch]
jobs:
build:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: './go.mod'
- name: Test examples
run: go test -v -gcflags="all=-N -l" ./examples/...
- name: Unit tests
run: go test -v -gcflags="all=-N -l" -coverprofile coverage.out .
- id: cover
name: Calculate coverage
if: ${{ matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/main' }}
run: |
echo "COVERAGE=$(go tool cover -func coverage.out | grep total: | awk '{ print $3 }')" >> $GITHUB_OUTPUT
- id: gen_badge
name: Generate badge
if: ${{ matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/main' }}
run: echo "BADGE=$(curl https://img.shields.io/badge/Coverage-${{ steps.cover.outputs.COVERAGE }}25-limegreen)" >> $GITHUB_OUTPUT
- name: Update badge
if: ${{ matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/main' }}
uses: gorgbus/gist-actions@main
env:
GITHUB_TOKEN: ${{ secrets.GIST_TOKEN }}
with:
action: "update"
gist_id: "5bfca1854a183da5294ad00cb41ace31"
file_name: "coverage.svg"
content: ${{ steps.gen_badge.outputs.BADGE }}