feat: add go ci #1
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: Go | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build: | |
name: Build and Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.21 # Use the version of Go in your project | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v3 | |
- name: Get dependencies | |
run: | | |
go mod download | |
go mod verify | |
- name: Check formatting | |
run: | | |
if [ -n "$(go fmt ./...)" ]; then | |
echo "Go code is not formatted, please run 'go fmt'" | |
exit 1 | |
fi | |
- name: Test | |
run: go test -v ./... |