db: support postgres #231
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: | |
paths: | |
- '**.go' | |
pull_request: | |
paths: | |
- '**.go' | |
env: | |
GOPROXY: "https://proxy.golang.org" | |
jobs: | |
test-mysql: | |
name: Test MySQL | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql:8.0.21 | |
env: | |
MYSQL_ROOT_PASSWORD: root | |
MYSQL_DATABASE: nekobox | |
ports: | |
- 3306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.20.x | |
- name: Run tests | |
run: go test -v -race -coverprofile=coverage.txt -race -covermode=atomic ./... | |
env: | |
DB_TYPE: mysql | |
DB_HOST: localhost | |
DB_PORT: 3306 | |
DB_USER: root | |
DB_PASSWORD: root | |
DB_DATABASE: nekobox | |
test-postgres: | |
name: Test Postgres | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_PASSWORD: postgres | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.20.x | |
- name: Run tests | |
run: go test -v -race -coverprofile=coverage.txt -race -covermode=atomic ./... | |
env: | |
DB_TYPE: postgres | |
DB_HOST: localhost | |
DB_PORT: 5432 | |
DB_USER: postgres | |
DB_PASSWORD: postgres | |
DB_DATABASE: nekobox | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.20.x | |
- name: Run golangci-lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.53 | |
args: --timeout=10m |