YQ-2745: Extended integration tests #98
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |