Skip to content

fix(ci): correct merged-coverage artifact path + log merged lanes #52

fix(ci): correct merged-coverage artifact path + log merged lanes

fix(ci): correct merged-coverage artifact path + log merged lanes #52

Workflow file for this run

name: Go CLI
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
workflow_dispatch: {}
schedule:
# Daily 06:00 UTC: the full runtime parity matrix + publish parity. On
# push/PR only the cases affected by the change run (see parity-runtime).
- cron: "0 6 * * *"
jobs:
lint-and-test:
runs-on: ubuntu-latest
permissions:
contents: read
code-quality: write
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- uses: go-task/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- run: task lint
- run: task spec:compliance
- run: task vuln
- run: task test:race
- run: task coverage
- name: Coverage summary
if: always()
run: bash scripts/coverage-report.sh coverage.out "unit (hermetic)" >> "$GITHUB_STEP_SUMMARY"
- run: task test:integration
- run: task build
- run: ./devcontainer --version
# Convert the Go coverage profile (coverage.out) to Cobertura XML for
# GitHub's native Code Quality feature.
- name: Convert coverage to Cobertura XML
run: |
go install github.com/boumenot/gocover-cobertura@latest
gocover-cobertura < coverage.out > coverage.xml
- name: Upload coverage report
uses: actions/upload-code-coverage@v1
with:
file: coverage.xml
language: Go
label: code-coverage/go
# Binary covdata for the cross-lane merge (coverage-report job).
- uses: actions/upload-artifact@v7
if: always()
with:
name: covdata-unit
path: artifacts/coverage/data/unit
if-no-files-found: error
e2e:
runs-on: ubuntu-latest
needs: lint-and-test
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- uses: go-task/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- run: task coverage:e2e
- name: Coverage summary
if: always()
run: bash scripts/coverage-report.sh artifacts/coverage/data/e2e "e2e" >> "$GITHUB_STEP_SUMMARY"
- uses: actions/upload-artifact@v7
if: always()
with:
name: covdata-e2e
path: artifacts/coverage/data/e2e
if-no-files-found: error
- if: always()
run: task clean
# Hermetic parity gate: read-configuration golden comparison + the contract
# lane of the parity matrix (flag validation / output contract, no Docker).
parity:
runs-on: ubuntu-latest
needs: lint-and-test
steps:
- uses: actions/checkout@v7
with:
submodules: recursive
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- uses: actions/setup-node@v6
with:
node-version: "20"
- uses: go-task/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- run: task reference
- run: task parity:contract
- run: task parity:network
# Coverage is measured separately with an instrumented Go binary. Keep the
# functional parity run above release-like, and avoid conflating subprocess
# coverage with the hermetic unit profile.
- run: task coverage:parity-contract
- name: Coverage summary
if: always()
run: bash scripts/coverage-report.sh artifacts/coverage/data/contract "parity:contract" >> "$GITHUB_STEP_SUMMARY"
- if: always()
run: |
mkdir -p artifacts
git -C reference rev-parse HEAD > artifacts/reference-commit.txt
- uses: actions/upload-artifact@v7
if: always()
with:
name: parity-contract-network-v0.88.0
path: artifacts/
if-no-files-found: error
- uses: actions/upload-artifact@v7
if: always()
with:
name: covdata-contract
path: artifacts/coverage/data/contract
if-no-files-found: error
# Runtime lane of the parity matrix (creates real containers via Docker) on
# push/PR, SCOPED to the commands affected by the change: the full matrix takes
# ~45 min, so scripts/parity-affected.sh maps the diff to a
# PARITY_COMMAND allowlist (or "all"/"none"). The daily parity-runtime-full job
# is the backstop that always runs the whole thing.
parity-runtime:
if: github.event_name == 'push' || github.event_name == 'pull_request'
runs-on: ubuntu-latest
needs: lint-and-test
env:
PARITY_RUNTIME_TIMEOUT: "10m"
# 2-core hosted runners can't sustain 2 concurrent heavy docker builds; run
# serially for gate determinism (override with PARITY_PARALLEL for beefy runners).
PARITY_PARALLEL: "1"
steps:
- uses: actions/checkout@v7
with:
submodules: recursive
# Full history so the diff base (PR base / previous push) is present.
fetch-depth: 0
- name: Determine affected parity commands
id: affected
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
base="${{ github.event.pull_request.base.sha }}"; head="${{ github.event.pull_request.head.sha }}"
else
base="${{ github.event.before }}"; head="${{ github.sha }}"
fi
bash scripts/parity-affected-commands.sh "$base" "$head" >> "$GITHUB_OUTPUT"
- uses: actions/setup-go@v6
if: steps.affected.outputs.run == 'true'
with:
go-version-file: go.mod
- uses: actions/setup-node@v6
if: steps.affected.outputs.run == 'true'
with:
node-version: "20"
- uses: go-task/setup-task@v2
if: steps.affected.outputs.run == 'true'
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
# Free disk + enable the containerd image store (build-cache export). Reuses
# the Taskfile so the runner prep is identical to release.yml.
- if: steps.affected.outputs.run == 'true'
run: task ci:prepare-runner
- if: steps.affected.outputs.run == 'true'
run: task reference
- if: steps.affected.outputs.run == 'true'
env:
PARITY_COMMAND: ${{ steps.affected.outputs.commands }}
run: task parity:runtime
- if: always() && steps.affected.outputs.run == 'true'
run: |
mkdir -p artifacts
git -C reference rev-parse HEAD > artifacts/reference-commit.txt
- uses: actions/upload-artifact@v7
if: always() && steps.affected.outputs.run == 'true'
with:
name: parity-runtime-v0.88.0
path: artifacts/
if-no-files-found: error
- if: always() && steps.affected.outputs.run == 'true'
run: task clean
# Full runtime parity matrix + publish parity. Runs once a day (schedule) and
# on manual dispatch — the exhaustive backstop for the scoped push/PR job above.
parity-runtime-full:
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
needs: lint-and-test
env:
PARITY_RUNTIME_TIMEOUT: "10m"
PARITY_PARALLEL: "1"
steps:
- uses: actions/checkout@v7
with:
submodules: recursive
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- uses: actions/setup-node@v6
with:
node-version: "20"
- uses: go-task/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- run: task ci:prepare-runner
- run: task reference
# The full lanes run the instrumented binary, so this measures coverage AND
# gates parity; coverage:merge unions them into one cross-lane report.
- run: task coverage:parity-runtime
- run: task coverage:parity-publish
- name: Merged coverage report
if: always()
run: task coverage:merge | tee -a "$GITHUB_STEP_SUMMARY"
- if: always()
run: |
mkdir -p artifacts
git -C reference rev-parse HEAD > artifacts/reference-commit.txt
- uses: actions/upload-artifact@v7
if: always()
with:
name: parity-runtime-full-v0.88.0
path: |
artifacts/
artifacts/coverage/
if-no-files-found: error
- if: always()
run: task clean
# Experimental, NON-gating: arm64 runtime via QEMU emulation. arm64 runtime is
# unsupported for now, so its cases are skipped-arm64 in the gate above. This job
# is SLOW (QEMU) and only runs on a manual trigger (workflow_dispatch), not on
# every push/PR — enable it when validating arm64.
parity-runtime-arm64-experimental:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
needs: lint-and-test
continue-on-error: true
env:
PARITY_ARM64: "true"
PARITY_RUNTIME_TIMEOUT: "15m"
steps:
- uses: actions/checkout@v7
with:
submodules: recursive
- name: Set up QEMU (arm64 emulation)
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- uses: actions/setup-node@v6
with:
node-version: "20"
- uses: go-task/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- run: task ci:prepare-runner
- run: task reference
- run: task parity:runtime
- if: always()
run: task clean
# Cross-lane coverage: merge the per-PR lanes' covdata (unit + e2e + contract)
# into the one number no single lane shows, and post it to the run summary.
coverage-report:
if: always() && (github.event_name == 'push' || github.event_name == 'pull_request')
runs-on: ubuntu-latest
needs: [lint-and-test, e2e, parity]
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- uses: go-task/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Download lane covdata
uses: actions/download-artifact@v7
with:
pattern: covdata-*
path: artifacts/coverage/data
# download-artifact nests each artifact under covdata-<lane>/; flatten to <lane>/.
- name: Normalize lane dirs
run: |
cd artifacts/coverage/data
for d in covdata-*; do [ -d "$d" ] && mv "$d" "${d#covdata-}"; done
ls -R . || true
- name: Merged coverage report
run: task coverage:merge | tee -a "$GITHUB_STEP_SUMMARY"
- uses: actions/upload-artifact@v7
with:
name: covdata-merged
path: artifacts/coverage/data/merged.out
if-no-files-found: warn
cross-compile:
runs-on: ubuntu-latest
needs: lint-and-test
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- uses: go-task/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- run: task build:cross
- run: ls -lh dist/