-
Notifications
You must be signed in to change notification settings - Fork 6
62 lines (57 loc) · 2.12 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
53
54
55
56
57
58
59
60
61
62
# 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.22.0', ]
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/... ./common/... ./tests/utils/...
- name: Setup integration tests
uses: hoverkraft-tech/[email protected]
with:
compose-file: "tests/infra/datasource/docker-compose.yaml"
up-flags: "--build"
down-flags: "--volumes"
- name: Run integration tests
run: |
# cleanup some cache
go clean -cache
sudo rm -rf /usr/share/dotnet
docker logs runner-fq-connector-go-tests-ms_sql_server
go test -c -o fq-connector-go-tests -coverpkg=./... -covermode=atomic ./tests
./fq-connector-go-tests -projectPath=$(pwd) -test.coverprofile=coverage_integration_tests.out -test.failfast
- name: Union coverage
run: |
cat coverage_unit_tests.out > coverage.out
cat coverage_integration_tests.out | grep -v 'mode: atomic' >> coverage.out
go tool cover -func=coverage.out
rm coverage_unit_tests.out coverage_integration_tests.out
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4-beta
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.out
- name: Build
run: |
# FIXME: this script can't handle backticks in commit messages
# git fetch --prune --unshallow
# go run ./tools/version git
GOOS=linux go build -v -o fq-connector-go ./app