chore(docs/ex): Mark generated files (#51) #15
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: CI | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: ['*'] | |
jobs: | |
# Checks that the generated code is up-to-date. | |
# Runs in parallel with the other job that runs tests. | |
check-generated: | |
name: Check generated code | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.21.x | |
- name: Download Dependencies | |
run: go mod download | |
- name: Regenerate code | |
run: make generate | |
- name: Verify unchanged | |
run: | | |
if ! git diff --quiet; then | |
echo "Code changed after 'make generate'" | |
git diff | |
exit 1 | |
fi | |
build-test: | |
name: Build and test | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: ["ubuntu-latest"] | |
go: ["1.20.x", "1.21.x"] | |
include: | |
- go: 1.21.x | |
os: "ubuntu-latest" | |
latest: true | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Download Dependencies | |
run: go mod download | |
- name: Lint | |
run: make lint | |
if: matrix.latest | |
- name: Test | |
run: make cover | |
- name: Upload coverage to codecov.io | |
uses: codecov/codecov-action@v3 |