Skip to content

Merge pull request #25 from Gelio/release-v0.2.4 #87

Merge pull request #25 from Gelio/release-v0.2.4

Merge pull request #25 from Gelio/release-v0.2.4 #87

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
jobs:
build-and-test:
strategy:
matrix:
go-version: ["1.18", "1.19", "1.20", "1.21", "1.22", "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