crowdsec/.github/workflows/ci_tests.yml

108 lines
2.6 KiB
YAML

name: Tests
# Main workflow for tests, it calls all the others through parallel jobs.
#
# A final step collects and merges coverage output, then pushes it to
# coveralls.io
#
# https://docs.github.com/en/actions/using-workflows/reusing-workflows
on:
push:
branches:
- master
- testing*
paths-ignore:
- 'README.md'
pull_request:
branches:
- master
- testing*
paths-ignore:
- 'README.md'
jobs:
go-tests:
uses: ./.github/workflows/go-tests.yml
bats-sqlite:
uses: ./.github/workflows/bats-sqlite-coverage.yml
bats-mariadb:
uses: ./.github/workflows/bats-mysql.yml
with:
database_image: mariadb:latest
secrets:
DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD}}
bats-mysql:
uses: ./.github/workflows/bats-mysql.yml
with:
database_image: mysql:latest
secrets:
DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD}}
bats-postgres:
uses: ./.github/workflows/bats-postgres.yml
secrets:
DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD}}
bats-hub:
uses: ./.github/workflows/bats-hub.yml
secrets:
GIST_BADGES_ID: ${{ secrets.GIST_BADGES_ID }}
GIST_BADGES_SECRET: ${{ secrets.GIST_BADGES_SECRET }}
coverage:
needs: [go-tests, bats-sqlite]
name: Coverage
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.17
uses: actions/setup-go@v3
with:
go-version: 1.17
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Download unit report
uses: actions/download-artifact@v3
with:
name: coverage.out.bz2
- name: Download bats report
uses: actions/download-artifact@v3
with:
name: coverage-bats.out.bz2
- name: merge coverage reports
run: |
go get -u github.com/wadey/gocovmerge
bunzip2 coverage.out.bz2
bunzip2 coverage-bats.out.bz2
~/go/bin/gocovmerge coverage.out coverage-bats.out > coverage-all.out
bzip2 <coverage-all.out >coverage-all.out.bz2
- name: gcov2lcov
uses: jandelgado/gcov2lcov-action@v1.0.8
with:
infile: coverage-all.out
outfile: coverage-all.txt
- name: Coverage report artifact (merged)
uses: actions/upload-artifact@v2
with:
name: coverage-all.out.bz2
path: ./coverage-all.out.bz2
- name: Coveralls
uses: coverallsapp/github-action@master
continue-on-error: true
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage-all.txt