Skip to content

Commit

Permalink
Add basic workflow for checking format, etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
amisevsk committed Feb 7, 2024
1 parent df5a8a2 commit 0cecbd4
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
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

0 comments on commit 0cecbd4

Please sign in to comment.