Merge pull request #23 from Gelio/add-force-rebuild-flag #82
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: | |
jobs: | |
build-and-test: | |
strategy: | |
matrix: | |
go-version: ["1.18", "1.19", "1.20", "1.21", "stable"] | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
# Continue other jobs if one matrix job fails | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Verify formatting | |
# NOTE: only verify formatting on Linux and the latest go version. | |
# It only needs to happen once, and formatting | |
# is not consistent on Windows. | |
if: | |
${{ startsWith(matrix.os, 'ubuntu') && matrix.go-version == 'stable'}} | |
# NOTE: hacky bash `if` because gofumpt always returns 0 exit code | |
# @see https://github.com/mvdan/gofumpt/issues/114 | |
run: | | |
go install mvdan.cc/gofumpt@latest | |
formatting_result=$(gofumpt -d .) | |
echo "$formatting_result" | |
if [[ "$formatting_result" ]]; then | |
echo "Invalid formatting" | |
exit 1 | |
fi | |
- run: go build | |
- run: go test ./... | |
verify-table-of-contents: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "18" | |
- run: npm install | |
- run: npm run generate-toc | |
- name: Verify table of contents | |
run: git diff --exit-code | |
- name: Check formatting of Markdown documents | |
run: npm run format-docs:check |