commit plugin - support batch sizes greater than one #993
Workflow file for this run
This file contains 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: "Build lint and test CCIP-OCR3" | |
on: | |
pull_request: | |
push: | |
branches: | |
- 'main' | |
jobs: | |
build-lint-test: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
go-version: ['1.22'] | |
defaults: | |
run: | |
working-directory: . | |
steps: | |
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 | |
- name: Setup Go ${{ matrix.go-version }} | |
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Display Go version | |
run: go version | |
- name: Build | |
run: make | |
- name: Install linter | |
run: | | |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.59.0 | |
- name: Run linter | |
run: make lint | |
- name: Run tests | |
run: TEST_COUNT=20 COVERAGE_FILE=coverage.out make test | |
- 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 checkout ${{ github.base_ref }} | |
TEST_COUNT=1 COVERAGE_FILE=coverage_target.out make test | |
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 = "### Test Coverage"; | |
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: `### Test Coverage\n\n| Branch | Coverage |\n|-----------------|-----------------|\n| ${{ github.head_ref }} | ${coverage} |\n| ${{ github.base_ref }} | ${coverage_target} |` | |
}); |