Generate one-page CLI reference document #128
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: Validate PRs | |
on: | |
pull_request: | |
branches: [ main ] | |
jobs: | |
go: | |
name: Check sources | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.21.6 | |
- name: Check go.mod | |
run: | | |
go mod tidy | |
if ! git diff --quiet; then | |
echo "Go modules need tidying (go mod tidy)" | |
exit 1 | |
fi | |
- name: Check format | |
run: | | |
go fmt ./... | |
if ! git diff --quiet; then | |
echo "Files are not formatted (go fmt ./...)" | |
exit 1 | |
fi | |
- name: Check build | |
run: | | |
if ! go build; then | |
echo "Project does not build" | |
exit 1 | |
fi | |
- name: Run tests | |
run: | | |
if ! go test ./... -v; then | |
echo "Project tests failed" | |
exit 1 | |
fi | |
- name: Check CLI docs generation | |
run: | | |
docs/src/docs/cli/generate.sh > /dev/null | |
if [[ ! -z $(git status -s) ]]; then | |
echo "CLI documentation is out of date" | |
echo "Run docs/src/docs/cli/generate.sh and commit the result" | |
exit 1 | |
fi | |
- name: Check for trailing whitespace | |
run: | | |
files=$(egrep -lI --exclude '*.svg' --exclude 'docs/*' " +$" $(git ls-files)) | |
if [ ! -z $files ]; then | |
echo "Trailing whitespace in files:" | |
echo "$files" | |
exit 1 | |
fi |