Add codecov to CI (#1824)

This should cause codecov to run on all pull requests and all commits to main.

Currently only doing coverage for Go files.
This commit is contained in:
Zach Wasserman 2021-08-26 09:53:10 -07:00 committed by GitHub
parent a9592117a5
commit 8a15f6d270
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 49 additions and 33 deletions

47
.github/workflows/test-go.yaml vendored Normal file
View File

@ -0,0 +1,47 @@
name: Go Tests
on:
push:
branches:
- main
pull_request:
jobs:
test-go:
strategy:
matrix:
os: [ubuntu-latest]
go-version: ['^1.16.0']
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
run: docker-compose up -d mysql_test redis &
# 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: |
MYSQL_TEST=1 make test-go
- name: Upload to Codecov
uses: codecov/codecov-action@v2
with:
files: coverage.txt

View File

@ -143,36 +143,4 @@ jobs:
run: |
yarn prettier:check
test-go:
strategy:
matrix:
os: [ubuntu-latest]
go-version: ['^1.16.0']
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
run: docker-compose up -d mysql_test redis &
# 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: |
MYSQL_TEST=1 make test-go

1
.gitignore vendored
View File

@ -20,6 +20,7 @@ server/bindata/generated.go
*.cover
*.test
*.log
coverage.txt
# typescript generated test files
tmp/

View File

@ -118,7 +118,7 @@ dump-test-schema:
go run ./tools/dbutils ./server/datastore/mysql/schema.sql
test-go: dump-test-schema
go test -tags full,fts5,netgo -parallel 8 ./...
go test -tags full,fts5,netgo -parallel 8 -coverprofile=coverage.txt -covermode=atomic ./...
analyze-go:
go test -tags full,fts5,netgo -race -cover ./...