Commit to a next power table and additional commitments #669
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: Continuous Integration | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
merge_group: | |
types: | |
- checks_requested | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.58 | |
only-new-issues: true | |
- name: Tidy go.mod | |
run: go mod tidy | |
- name: Check Tidy go.mod | |
run: | | |
git diff --exit-code || { echo "##[error] go.mod is not tidy, run 'go mod tidy' and commit the changes."; exit 1; } | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- name: Test | |
run: make test/cover | |
- name: Upload coverage to Codecov | |
# Commit SHA corresponds to version v4.4.0 | |
# See: https://github.com/codecov/codecov-action/releases/tag/v4.4.0 | |
uses: codecov/codecov-action@6d798873df2b1b8e5846dba6fb86631229fbcb17 | |
# Don't run coverage on merge queue CI to avoid duplicating reports to codecov. | |
# Otherwise base coverage from main branch does not render properly. | |
# | |
# See: https://github.com/matplotlib/napari-matplotlib/issues/155#issuecomment-1589377119 | |
if: github.event_name != 'merge_group' | |
with: | |
files: coverage.txt | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: false | |
fuzz: | |
name: Fuzz | |
runs-on: ubuntu-latest | |
needs: | |
- test # Do not bother running the fuzz tests if tests fail | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- name: Fuzz | |
env: | |
FUZZTIME: 30s | |
run: make fuzz | |
- name: Upload fuzz failure seed corpus as run artifact | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
id: testdata-upload | |
with: | |
name: testdata | |
path: '**/testdata/fuzz' | |
- name: Output message | |
if: failure() | |
shell: bash | |
run: | | |
echo -e 'Fuzz test failed on commit https://github.com/${{ github.repository }}/commit/${{ github.event.pull_request.head.sha }}. To troubleshoot locally, use the GitHub CLI to download the seed corpus by running:\n $ gh run download ${ github.run_id } -n testdata\nAlternatively, download from:\n ${{ steps.testdata-upload.outputs.artifact-url }}' | |
- name: Post PR comment | |
uses: actions/github-script@v7 | |
if: failure() && github.event_name == 'pull_request' | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: 'Fuzz test failed on commit ${{ github.event.pull_request.head.sha }}. To troubleshoot locally, download the seed corpus using [GitHub CLI](https://cli.github.com) by running:\n```shell\ngh run download ${{ github.run_id }} -n testdata\n```\nAleternatively, download directly from [here](${{ steps.testdata-upload.outputs.artifact-url }}).' | |
}) | |
generate: | |
name: Generate | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- name: Generate | |
run: make generate | |
- name: Check for changes | |
run: | | |
git diff --exit-code || { echo "##[error] Generated code differs from repository content, run 'make generate' and commit the changes."; exit 1; } |