fix: refactoring code #11
This file contains hidden or 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: CI | |
on: | |
pull_request: | |
branches: [main] | |
push: | |
branches: [main] | |
jobs: | |
tests: | |
name: Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.22.1' | |
- name: Install dependencies | |
run: | | |
go mod tidy | |
go mod download | |
- name: Run Tests | |
run: go test -v -coverprofile=coverage.out ./... | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
file: coverage.out | |
style: | |
name: Style | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.22.1' | |
- name: Install dependencies | |
run: | | |
go mod tidy | |
go mod download | |
- name: Check formatting | |
run: gofmt -l . || exit 1 | |
- name: Install staticcheck | |
run: go install honnef.co/go/tools/cmd/staticcheck@latest | |
- name: Run staticcheck | |
run: staticcheck ./... | |
- name: Install gosec | |
run: go install github.com/securego/gosec/v2/cmd/gosec@latest | |
- name: Run gosec | |
run: gosec ./... | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.22.1' | |
- name: Install dependencies | |
run: | | |
go mod tidy | |
go mod download | |
- name: Install golangci-lint | |
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest | |
- name: Run golangci-lint | |
run: golangci-lint run ./... |