-
Notifications
You must be signed in to change notification settings - Fork 7
52 lines (47 loc) · 1.75 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: build
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ '1.21.3', ]
steps:
- uses: actions/checkout@v4
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Install dependencies
run: |
go get ./...
- name: Run unit tests
run: |
go test -coverpkg=./... -coverprofile=coverage_unit_tests.out -covermode=atomic ./app/...
- name: Setup integration tests
uses: isbang/[email protected]
with:
compose-file: "/home/runner/work/fq-connector-go/fq-connector-go/tests/infra/datasource/docker-compose.yaml"
down-flags: "--volumes"
- name: Run integration tests
run: |
go test -c -o fq-connector-go-tests -coverpkg=./... -covermode=atomic ./tests
./fq-connector-go-tests -projectPath=$(pwd) -test.coverprofile=coverage_integration_tests.out
- name: Union coverage
run: |
cat coverage_unit_tests.out | grep -v 'pb.go\|mock.go\|library' > coverage.out
cat coverage_integration_tests.out | grep -v 'atomic\|pb.go\|mock.go\|library' >> coverage.out
go tool cover -func=coverage.out
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4-beta
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.out
- name: Build
run: GOOS=linux go build -v -o fq-connector-go ./app