mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 00:45:19 +00:00
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:
parent
a9592117a5
commit
8a15f6d270
47
.github/workflows/test-go.yaml
vendored
Normal file
47
.github/workflows/test-go.yaml
vendored
Normal 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
|
32
.github/workflows/test.yml
vendored
32
.github/workflows/test.yml
vendored
@ -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
1
.gitignore
vendored
@ -20,6 +20,7 @@ server/bindata/generated.go
|
||||
*.cover
|
||||
*.test
|
||||
*.log
|
||||
coverage.txt
|
||||
|
||||
# typescript generated test files
|
||||
tmp/
|
||||
|
2
Makefile
2
Makefile
@ -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 ./...
|
||||
|
Loading…
Reference in New Issue
Block a user