Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add code build workflow #4

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build
on:
push:
branches:
- main
paths-ignore:
- '**.md'
- 'vulns/**'
- 'LICENSE'
pull_request:
paths-ignore:
- '**.md'
- 'vulns/**'
- 'LICENSE'
env:
GO_VERSION: '1.22'
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- name: Checkout code into the Go module directory
uses: actions/checkout@v4

- name: Tidy
run: |
go mod tidy
if [ -n "$(git status --porcelain)" ]; then
echo "Run 'go mod tidy' and push it"
exit 1
fi

- name: Fmt
run: |
go fmt ./...
if [ -n "$(git status --porcelain)" ]; then
echo "Run 'go fmt ./...' and push it"
exit 1
fi

- name: Lint
uses: golangci/[email protected]
with:
version: v1.59
args: --verbose

- name: Test
run: |
go test -v ./...
Loading