From 4ae7594800e654c62353c3ed53db5b24a0ef039b Mon Sep 17 00:00:00 2001 From: Mathias Fredriksson <mafredri@gmail.com> Date: Thu, 15 Aug 2024 17:01:11 +0000 Subject: [PATCH] Fix coverage --- .github/workflows/static.yml | 42 ++++++++++++++++++++++++++++++++++++ README.md | 2 +- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/static.yml diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml new file mode 100644 index 0000000..dcde3c4 --- /dev/null +++ b/.github/workflows/static.yml @@ -0,0 +1,42 @@ +name: static + +on: + push: + branches: ['master'] + workflow_dispatch: + +# Set permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages. +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: pages + cancel-in-progress: true + +jobs: + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Pages + uses: actions/configure-pages@v5 + - name: Generate coverage and badge + run: | + ./ci/test.sh + mkdir -p ./ci/out/static + cp ./ci/out/coverage.html ./ci/out/static/coverage.html + percent=$(go tool cover -func ./ci/out/coverage.prof | tail -n1 | awk '{print $3}' | tr -d '%') + wget -O ./ci/out/static/coverage.svg "https://img.shields.io/badge/coverage-${percent}%25-success" + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: ./ci/out/static/ + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/README.md b/README.md index c74b79d..44a6ddf 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # websocket [](https://pkg.go.dev/github.com/coder/websocket) -[](https://github.com/coder/websocket/coverage.html) +[](https://coder.github.io/websocket/coverage.html) websocket is a minimal and idiomatic WebSocket library for Go. -- GitLab