Skip to content

Merge pull request #9 from tkc/feat/modernize-infrastructure #78

Merge pull request #9 from tkc/feat/modernize-infrastructure

Merge pull request #9 from tkc/feat/modernize-infrastructure #78

Workflow file for this run

name: sql-dog
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
test:
name: Build and Test
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: admin
MYSQL_DATABASE: sql-dog
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping -h localhost"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22'
cache: true
- name: Check out code
uses: actions/checkout@v4
- name: Install dependencies
run: |
go mod download
go get github.com/goccy/go-yaml
go get github.com/bxcodec/faker/v3
- name: Run tests and linting
run: |
# Basic format check instead of using golangci-lint
gofmt -l . | grep -v vendor/ | tee /dev/stderr | (! grep .)
# Run tests
go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
env:
DB_HOST: localhost
DB_PORT: 3306
DB_USER: root
DB_PASSWORD: admin
DB_NAME: sql-dog
- name: Upload coverage report
uses: codecov/codecov-action@v3
with:
files: ./coverage.txt
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false