wip #1378
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: test | |
on: [push, pull_request] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
services: | |
redis: | |
image: redis | |
ports: | |
- 6379:6379 | |
mysql: | |
image: mysql:5.7 | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: yes | |
MYSQL_DATABASE: test | |
ports: | |
- 33306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: '1.21' | |
- name: Setup minio | |
run: | | |
docker run -d -p 9000:9000 --name minio \ | |
-e "MINIO_ACCESS_KEY=minioadmin" \ | |
-e "MINIO_SECRET_KEY=minioadmin" \ | |
minio/minio server /data | |
- name: Setup Nsq | |
run: | | |
docker run --name nsqlookupd -p 4160:4160 -p 4161:4161 -d nsqio/nsq /nsqlookupd | |
docker run --name nsqd -p 4150:4150 -p 4151:4151 -d nsqio/nsq /nsqd | |
- name: Run coverage | |
env: | |
DB_PORT: ${{ job.services.mysql.ports[3306] }} | |
DB_USERNAME: root | |
DB_DATABASE: test | |
S3_ENDPOINT: localhost:9000 | |
REDIS_HOST: localhost | |
REDIS_PORT: 6379 | |
NSQ_ADDR: localhost:4150 | |
NSQ_LOOKUPD_ADDR: localhost:4161 | |
run: | | |
mkdir frontend/build && touch frontend/build/dummy | |
go test ./... -race -coverprofile=coverage.txt -covermode=atomic | |
- name: Upload coverage to Codecov | |
run: bash <(curl -s https://codecov.io/bash) |