Feature/hide internal import behind interfaces #27
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: CI | |
on: | |
push: | |
branches: master | |
pull_request: | |
branches: master | |
permissions: | |
contents: read | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
cache-dependency-path: "**/go.sum" | |
- name: Setup Swagger | |
run: | | |
go install github.com/swaggo/swag/cmd/swag@0b9e347c196710ea155a147782bf51707a600c2c # https://github.com/swaggo/swag/releases/tag/v1.16.4 | |
swag init -g cmd/service/main.go | |
- uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # https://github.com/golangci/golangci-lint-action/releases/tag/v6.1.1 | |
with: | |
version: v1.61 | |
unit-tests: | |
name: Unit Tests | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql:8.0 | |
ports: | |
- 3306:3306 | |
env: | |
MYSQL_DATABASE: test | |
MYSQL_ROOT_PASSWORD: db_password | |
options: >- | |
--health-cmd "mysqladmin ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
cache-dependency-path: "**/go.sum" | |
- name: Setup Swagger | |
run: | | |
go install github.com/swaggo/swag/cmd/swag@0b9e347c196710ea155a147782bf51707a600c2c # https://github.com/swaggo/swag/releases/tag/v1.16.4 | |
swag init -g cmd/service/main.go | |
- name: Run tests | |
run: | | |
cp .env.testing.github-ci .env.testing | |
go install github.com/pressly/goose/cmd/goose@latest | |
goose -dir "./internal/db/migrations" mysql "root:db_password@tcp(localhost:3306)/test?parseTime=true" up | |
go test -race ./... | |
detect-secrets: | |
name: Detect Secrets | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: detect-secrets | |
uses: reviewdog/action-detect-secrets@ec43c7e1b118c103185508d77db482c818baeec0 # https://github.com/reviewdog/action-detect-secrets/releases/tag/v0.27.1 | |
with: | |
reporter: github-pr-review | |
detect_secrets_flags: --exclude-files '.*_test\.go$' | |
govulncheck: | |
name: Run govulncheck | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
cache-dependency-path: "**/go.sum" | |
- name: Setup Swagger | |
run: | | |
go install github.com/swaggo/swag/cmd/swag@0b9e347c196710ea155a147782bf51707a600c2c # https://github.com/swaggo/swag/releases/tag/v1.16.4 | |
swag init -g cmd/service/main.go | |
- name: Run govulncheck | |
run: | | |
go install golang.org/x/vuln/cmd/govulncheck@4ea4418106cea3bb2c9aa098527c924e9e1fbbb4 # https://go.googlesource.com/vuln/+/refs/tags/v1.1.3 | |
govulncheck -C . -format text ./... |