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 # Jobs for Postgres and MySQL can have failing tests on GitHub CI, but they # pass when run on devs' machines or in the release checks. We disable them # here by default. Remove the if..false to enable them. bats-mariadb: if: ${{ false }} uses: ./.github/workflows/bats-mysql.yml with: database_image: mariadb:latest secrets: DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD}} bats-mysql: if: ${{ false }} uses: ./.github/workflows/bats-mysql.yml with: database_image: mysql:latest secrets: DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD}} bats-postgres: if: ${{ false }} 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: Check out code into the Go module directory uses: actions/checkout@v3 with: fetch-depth: 1 path: go/src/github.com/crowdsecurity/crowdsec - 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: Environment # run: env | sort - name: merge coverage reports run: | go install github.com/wadey/gocovmerge@latest bunzip2 coverage.out.bz2 bunzip2 coverage-bats.out.bz2 ~/go/bin/gocovmerge coverage.out coverage-bats.out > coverage-all.out bzip2 coverage-all.out.bz2 # - name: coverage.out # run: cat coverage.out # - name: coverage-bats.out # run: cat coverage-bats.out - name: gcov2lcov uses: jandelgado/gcov2lcov-action@v1.0.8 with: infile: coverage-all.out outfile: coverage-all.txt env: GOPATH: /home/runner/work/crowdsec/crowdsec/go - 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