2021-08-26 16:53:10 +00:00
|
|
|
name: Go Tests
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
2021-10-18 21:49:32 +00:00
|
|
|
- patch-*
|
2021-11-18 23:14:29 +00:00
|
|
|
paths:
|
|
|
|
- '**.go'
|
2021-08-26 16:53:10 +00:00
|
|
|
pull_request:
|
2021-08-26 18:25:25 +00:00
|
|
|
paths:
|
|
|
|
- '**.go'
|
2022-02-14 15:13:02 +00:00
|
|
|
workflow_dispatch: # Manual
|
2021-08-26 16:53:10 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
test-go:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest]
|
2021-11-05 02:50:00 +00:00
|
|
|
go-version: ['^1.17.0']
|
2022-01-12 01:44:37 +00:00
|
|
|
mysql: ["mysql:5.7", "mysql:8"]
|
2021-08-26 16:53:10 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Install Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go-version }}
|
|
|
|
|
|
|
|
- name: Checkout Code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
# Pre-starting dependencies here means they are ready to go when we need them.
|
|
|
|
- name: Start Infra Dependencies
|
|
|
|
# Use & to background this
|
2022-01-12 01:44:37 +00:00
|
|
|
run: FLEET_MYSQL_IMAGE=${{ matrix.mysql }} docker-compose up -d mysql_test redis redis-cluster-1 redis-cluster-2 redis-cluster-3 redis-cluster-4 redis-cluster-5 redis-cluster-6 redis-cluster-setup &
|
2021-08-26 16:53:10 +00:00
|
|
|
|
|
|
|
# It seems faster not to cache Go dependencies
|
|
|
|
- name: Install Go Dependencies
|
|
|
|
run: make deps-go
|
|
|
|
|
|
|
|
- name: Generate static files
|
|
|
|
run: |
|
|
|
|
export PATH=$PATH:~/go/bin
|
|
|
|
make generate-go
|
|
|
|
|
|
|
|
- name: Run Go Tests
|
|
|
|
run: |
|
2021-09-20 18:09:38 +00:00
|
|
|
NETWORK_TEST=1 REDIS_TEST=1 MYSQL_TEST=1 make test-go
|
2021-08-26 16:53:10 +00:00
|
|
|
|
|
|
|
- name: Upload to Codecov
|
|
|
|
uses: codecov/codecov-action@v2
|
|
|
|
with:
|
|
|
|
files: coverage.txt
|