Skip to content

Remove static discovery in indexer #1786

Remove static discovery in indexer

Remove static discovery in indexer #1786

name: Test Coverage Report
on:
merge_group:
pull_request:
push:
branches:
- main
jobs:
test-coverage-report:
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
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 short
- name: Coverage on target branch
if: github.event_name == 'pull_request'
run: |
git fetch origin ${{ github.base_ref }}
git branch -a
git checkout ${{ github.base_ref }}
just test-coverage coverage_target.out short
# switch back to the head ref
git checkout ${{ github.head_ref }}
./tools/bin/cov_compare.sh --no-header coverage_target.out coverage.out > table.txt
cat table.txt
{
echo 'coverage_report<<COVERAGE_REPORT_DELIM'
cat table.txt
echo 'COVERAGE_REPORT_DELIM'
} >> "$GITHUB_ENV"
- name: Remove previous coverage comments
uses: actions/github-script@v6
if: github.event_name == 'pull_request'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { owner, repo, number: issue_number } = context.issue;
const comments = await github.rest.issues.listComments({
owner,
repo,
issue_number
});
const coverageCommentPrefix = "Code coverage report:";
for (const comment of comments.data) {
if (comment.body.startsWith(coverageCommentPrefix)) {
await github.rest.issues.deleteComment({
owner,
repo,
comment_id: comment.id
});
}
}
- name: Display coverage in PR comment
uses: actions/github-script@v6
if: github.event_name == 'pull_request'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const coverage = process.env.coverage;
const coverage_target = process.env.coverage_target;
const coverage_report = process.env.coverage_report;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `Code coverage report:\n| Package | \`${{ github.base_ref }}\` | \`${{ github.head_ref }}\` | diff |\n ${coverage_report}`
});