Skip to content

combine interfaces (#978) #4401

combine interfaces (#978)

combine interfaces (#978) #4401

name: Test Coverage
on:
merge_group:
pull_request:
push:
branches:
- main
jobs:
test-coverage:
runs-on: runs-on=${{ github.run_id }}/family=c6i/cpu=32+48/ram=64+96/spot=false/image=ubuntu24-full-x64/extras=s3-cache+tmpfs
env:
COVERAGE_THRESHOLD: 37
steps:
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v6 # v6
with:
cache: true
go-version-file: go.mod
cache-dependency-path: go.sum
- name: Populate go envs
run: |
echo "GOBIN=$(go env GOPATH)/bin" >> $GITHUB_ENV
echo "GOCACHE=$(go env GOPATH)/build" >> $GITHUB_ENV
- name: Cache Go toolchain artifacts
uses: actions/cache@v4
with:
path: |
${{ env.GOBIN }}
${{ env.GOCACHE }}
# hashFiles paths are repo-root relative (not affected by working-directory)
key: chainlink-ccv-gotools-${{ runner.os }}-${{ hashFiles('tool-versions.env') }}
restore-keys: |
chainlink-ccv-gotools-${{ runner.os }}-
- name: Install just
uses: extractions/setup-just@69d82fb0233557aec017ef13706851d0694e0f1d # v2.0.0
- name: Install go-tools
run: just install-go-tools
- name: Install Solana CLI
run: |
sh -c "$(curl -sSfL https://release.anza.xyz/stable/install)"
echo "PATH=$HOME/.local/share/solana/install/active_release/bin:$PATH" >> $GITHUB_ENV
- name: Run tests
run: |
just test-coverage coverage.out
total=$(go tool cover -func=coverage.out | grep total | awk '{print $3}')
echo "Total coverage: $total"
echo "$total" | awk -v threshold="$COVERAGE_THRESHOLD" '{ pc=substr($0, 1, length($0)-1); if (pc < threshold) { print "Coverage (" pc "%) is less than " threshold "%"; exit 1 } }'