Skip to content

Update ci.yml

Update ci.yml #19

Workflow file for this run

name: Go CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
name: Test & Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'
cache: true
- name: Install dependencies
run: go mod tidy
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
- name: Run tests
run: go test -race -coverprofile=coverage.out -covermode=atomic ./...
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: coverage.out
fail_ci_if_error: true
verify:
name: Verify
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'
cache: true
- name: Verify dependencies
run: go mod verify
- name: Build
run: go build -v ./...
- name: Run vet
run: go vet ./...
- name: Check format
run: |
if [ -n "$(go fmt ./...)" ]; then
echo "Code is not formatted, run 'go fmt ./...'"
exit 1
fi