Add Codecov to GitHub actions

This commit is contained in:
Sebastian Serth
2023-03-31 16:54:41 +02:00
committed by Sebastian Serth
parent a720553dd1
commit 5c2b53f4bc
4 changed files with 57 additions and 7 deletions

6
.github/codecov.yml vendored Normal file
View File

@ -0,0 +1,6 @@
codecov:
notify:
after_n_builds: 2
ignore:
- "**/*_mock.go"

View File

@ -37,7 +37,7 @@ jobs:
run: date +%s > ~/.cache/go-build/trim.txt
continue-on-error: true
- name: Build
run: make build
run: make build-cover
- name: Upload Poseidon binary
uses: actions/upload-artifact@v3
with:
@ -84,19 +84,26 @@ jobs:
continue-on-error: true
- name: Run tests
run: make coverhtml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
if: ${{ success() || failure() }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Publish code coverage
uses: paambaati/codeclimate-action@v3.2.0
if: ${{ success() || failure() }}
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
prefix: github.com/openHPI/poseidon/
coverageLocations: |
${{github.workspace}}/coverage_cleaned.cov:gocov
${{github.workspace}}/coverage/coverage.cov:gocov
- name: Upload coverage report
uses: actions/upload-artifact@v3
if: ${{ success() || failure() }}
with:
name: coverage
path: coverage_unit.html
path: coverage/coverage_unit.html
dep-scan:
runs-on: ubuntu-latest
@ -130,6 +137,7 @@ jobs:
POSEIDON_AWS_ENDPOINT: ${{ secrets.POSEIDON_AWS_ENDPOINT }}
POSEIDON_AWS_FUNCTIONS: ""
POSEIDON_NOMAD_DISABLEFORCEPULL: true
GOCOVERDIR: coverage
steps:
- name: Checkout repository
uses: actions/checkout@v3
@ -204,6 +212,7 @@ jobs:
sudo ./nomad agent -dev -log-level=WARN -config e2e-config.hcl &
until curl -s --fail http://localhost:4646/v1/agent/health ; do sleep 1; done
chmod +x ./poseidon
mkdir -p ${GOCOVERDIR}
./poseidon &
until curl -s --fail http://localhost:7200/api/v1/health ; do sleep 1; done
make e2e-test
@ -211,3 +220,18 @@ jobs:
run: |
killall poseidon
make e2e-test-recovery
if: ${{ success() || failure() }}
- name: Convert coverage reports
run: make convert-run-coverage
if: ${{ success() || failure() }}
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
if: ${{ success() || failure() }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload coverage report
uses: actions/upload-artifact@v3
if: ${{ success() || failure() }}
with:
name: coverage
path: coverage/coverage_run.html