Aggregator Batch Write API #28
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Indexer Tests | |
on: | |
pull_request: | |
paths: | |
- '.github/**' | |
- 'protocol/**' | |
- 'common/**' | |
- 'executor/**' | |
defaults: | |
run: | |
working-directory: indexer | |
jobs: | |
indexer-lint-and-test: | |
runs-on: ubuntu-latest | |
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: indexer/go.mod | |
cache-dependency-path: indexer/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: Run lint | |
run: just lint | |
- name: Run tests | |
run: COVERAGE_FILE=coverage.out just test-coverage | |
# - name: Generate coverage report | |
# if: github.event_name == 'pull_request' | |
# run: | | |
# total=$(go tool cover -func=coverage.out | grep total | awk '{print $3}') | |
# echo "coverage=$total" >> $GITHUB_ENV | |
# - 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 }} | |
# # TODO: switch to just once available in the base branch. | |
# # COVERAGE_FILE=coverage_target.out just test-coverage | |
# go test -shuffle on -v -coverprofile=coverage_target.out ./... | |
# total=$(go tool cover -func=coverage_target.out | grep total | awk '{print $3}') | |
# echo "coverage_target=$total" >> $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 = "| Metric |"; | |
# 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; | |
# github.rest.issues.createComment({ | |
# issue_number: context.issue.number, | |
# owner: context.repo.owner, | |
# repo: context.repo.repo, | |
# body: `| Metric | \`${{ github.head_ref }}\` | \`${{ github.base_ref }}\` |\n|--|--|--|\n| **Coverage** | ${coverage} | ${coverage_target} |` | |
# }); | |