Add code coverage tests to the Github Actions workflow #149
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
name: Aerospike Go Client Tests | |
"on": | |
push: | |
pull_request: | |
env: | |
AEROSPIKE_HOSTS: "127.0.0.1:3000" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go-version: | |
- "1.20" | |
- "1.21" | |
- "1.22" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: "Setup Go ${{ matrix.go-version }}" | |
uses: actions/setup-go@v3 | |
with: | |
go-version: "${{ matrix.go-version }}" | |
cache: true | |
- name: Display Go version | |
run: go version | |
- name: Set up Aerospike Database | |
uses: reugn/github-action-aerospike@v1 | |
- name: Test Lua Code | |
run: go run github.com/onsi/ginkgo/v2/ginkgo -cover -race -r -keep-going -succinct -randomize-suites internal/lua | |
- name: Test types package | |
run: go run github.com/onsi/ginkgo/v2/ginkgo -cover -race -r -keep-going -succinct -randomize-suites types | |
- name: Test pkg tests | |
run: go run github.com/onsi/ginkgo/v2/ginkgo -cover -race -r -keep-going -succinct -randomize-suites pkg | |
- name: Build Benchmark tool | |
run: cd tools/benchmark | go build -o benchmark . | |
- name: Build asinfo tool | |
run: cd tools/asinfo | go build -o asinfo . | |
- name: Build cli tool | |
run: cd tools/cli | go build -o cli . | |
- name: Build example files | |
run: find examples -name "*.go" -type f -print0 | xargs -0 -n1 go build | |
- name: Build with Reflection code removed | |
run: go run github.com/onsi/ginkgo/v2/ginkgo build -tags="as_performance" . | |
- name: Build for Google App Engine (unsafe package removed) | |
run: go run github.com/onsi/ginkgo/v2/ginkgo build -tags="app_engine" . | |
- name: Run the tests | |
run: go run github.com/onsi/ginkgo/v2/ginkgo -coverprofile=./cover_native.out -covermode=atomic -coverpkg=./... -race -keep-going -succinct -randomize-suites -skip="HyperLogLog" | |
- name: Combine Cover Profiles | |
run: go run github.com/wadey/gocovmerge cover_*.out > cover_all.out | |
- name: Check Code Coverage | |
uses: vladopajic/go-test-coverage@v2 | |
with: | |
# Configure action using config file (option 1) | |
config: ./.testcoverage.yml |