From d63a8bb6155381471d3057ec640271112e9927e0 Mon Sep 17 00:00:00 2001 From: Micheal Wilkinson Date: Sat, 21 Mar 2026 23:15:32 +0000 Subject: [PATCH] ci: remove fragile external badge actions --- .gitea/workflows/pr-validation.yml | 14 ++++-- .gitea/workflows/push-validation.yml | 70 +++++++++------------------- 2 files changed, 30 insertions(+), 54 deletions(-) diff --git a/.gitea/workflows/pr-validation.yml b/.gitea/workflows/pr-validation.yml index a81a1b1..01047d0 100644 --- a/.gitea/workflows/pr-validation.yml +++ b/.gitea/workflows/pr-validation.yml @@ -168,11 +168,15 @@ jobs: - name: Upload coverage badge id: badge if: ${{ always() && steps.coverage.outcome == 'success' && steps.coverage-files.outputs.exists == 'true' }} - uses: https://git.hrafn.xyz/aether/vociferate/coverage-badge@v1.1.0 - with: - coverage-profile: coverage.out - artefact-bucket-name: ${{ vars.ARTEFACT_BUCKET_NAME }} - artefact-bucket-endpoint: ${{ vars.ARTEFACT_BUCKET_ENDPONT }} + run: | + set -euo pipefail + total="$(go tool cover -func=coverage.out | awk '/^total:/ {sub(/%/, "", $3); print $3}')" + if [[ -z "$total" ]]; then + total="n/a" + fi + echo "total=${total}" >> "$GITHUB_OUTPUT" + echo "report-url=n/a" >> "$GITHUB_OUTPUT" + echo "badge-url=n/a" >> "$GITHUB_OUTPUT" - name: Validate changelog gate if: ${{ always() }} diff --git a/.gitea/workflows/push-validation.yml b/.gitea/workflows/push-validation.yml index 3a55c33..f3cec3b 100644 --- a/.gitea/workflows/push-validation.yml +++ b/.gitea/workflows/push-validation.yml @@ -12,43 +12,7 @@ concurrency: cancel-in-progress: true jobs: - check-open-pr: - runs-on: ubuntu-latest - container: docker.io/catthehacker/ubuntu:act-latest - outputs: - should_run: ${{ steps.detect.outputs.should_run }} - steps: - - name: Detect open PR for branch - id: detect - env: - REPOSITORY: ${{ github.repository }} - OWNER: ${{ github.repository_owner }} - BRANCH: ${{ github.ref_name }} - SERVER_URL: ${{ github.server_url }} - TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - set -eu - - api_url="${SERVER_URL}/api/v1/repos/${REPOSITORY}/pulls?state=open&head=${OWNER}:${BRANCH}" - if [ -n "${TOKEN:-}" ]; then - response="$(curl -fsSL -H "Authorization: token ${TOKEN}" -H "accept: application/json" "$api_url" || echo '[]')" - else - response="$(curl -fsSL -H "accept: application/json" "$api_url" || echo '[]')" - fi - - open_prs="$(printf '%s' "$response" | grep -o '"number":[0-9]\+' | wc -l | tr -d ' ')" - - if [ "$open_prs" -gt 0 ]; then - echo "should_run=false" >> "$GITHUB_OUTPUT" - echo "Open PR detected for ${OWNER}:${BRANCH}; skipping push validation." >> "$GITHUB_STEP_SUMMARY" - else - echo "should_run=true" >> "$GITHUB_OUTPUT" - echo "No open PR detected for ${OWNER}:${BRANCH}; running push validation." >> "$GITHUB_STEP_SUMMARY" - fi - validate: - needs: check-open-pr - if: ${{ needs.check-open-pr.outputs.should_run == 'true' }} runs-on: ubuntu-latest container: docker.io/catthehacker/ubuntu:act-latest defaults: @@ -198,19 +162,27 @@ jobs: exit 1 fi - - name: Publish coverage artefacts - id: coverage-badge - uses: https://git.hrafn.xyz/aether/vociferate/coverage-badge@v1.1.0 - with: - coverage-profile: coverage.out - coverage-html: coverage.html - coverage-badge: coverage-badge.svg - coverage-summary: coverage-summary.json - artefact-bucket-name: ${{ vars.ARTEFACT_BUCKET_NAME }} - artefact-bucket-endpoint: ${{ vars.ARTEFACT_BUCKET_ENDPONT }} - branch-name: ${{ github.ref_name }} - repository-name: ${{ github.repository }} - summary-file: ${{ env.SUMMARY_FILE }} + - name: Add coverage summary + if: ${{ always() && steps.coverage-tests.outcome == 'success' }} + run: | + set -euo pipefail + total="${{ steps.coverage-tests.outputs.total }}" + if [[ -z "$total" ]]; then + total="n/a" + fi + + { + echo '## Coverage' + echo + echo "- Total: ${total}%" + echo + echo '### Package Coverage' + if [[ -f coverage-packages.md ]]; then + cat coverage-packages.md + else + echo '_Package coverage details unavailable for this run._' + fi + } >> "$SUMMARY_FILE" - name: Run behavior suite on main pushes if: ${{ github.ref == 'refs/heads/main' }}