fix the CI coverage generation

This commit is contained in:
alteredCoder 2021-10-05 10:19:19 +02:00
parent 5c7f873e18
commit 079172568a

View file

@ -12,6 +12,8 @@ jobs:
hubtest: hubtest:
name: Hub tests name: Hub tests
runs-on: ubuntu-latest runs-on: ubuntu-latest
env:
PUSH_COVERAGE: ${{ github.ref == 'refs/heads/master' }}
steps: steps:
- name: Set up Go 1.16 - name: Set up Go 1.16
uses: actions/setup-go@v1 uses: actions/setup-go@v1
@ -50,27 +52,25 @@ jobs:
echo "SCENARIOS_COV_NUMBER=$(cscli hubtest coverage --scenarios --percent | cut -d '=' -f2 | tr -d '%')" echo "SCENARIOS_COV_NUMBER=$(cscli hubtest coverage --scenarios --percent | cut -d '=' -f2 | tr -d '%')"
echo "PARSER_BADGE_COLOR=$(if [ $PARSERS_COV_NUMBER -lt '70' ]; then echo 'red'; else echo 'green'; fi)" >> $GITHUB_ENV echo "PARSER_BADGE_COLOR=$(if [ $PARSERS_COV_NUMBER -lt '70' ]; then echo 'red'; else echo 'green'; fi)" >> $GITHUB_ENV
echo "SCENARIO_BADGE_COLOR=$(if [ $SCENARIOS_COV_NUMBER -lt '70' ]; then echo 'red'; else echo 'green'; fi)" >> $GITHUB_ENV echo "SCENARIO_BADGE_COLOR=$(if [ $SCENARIOS_COV_NUMBER -lt '70' ]; then echo 'red'; else echo 'green'; fi)" >> $GITHUB_ENV
coverage: - name: Create Parsers badge
runs-on: ubuntu-latest uses: schneegans/dynamic-badges-action@v1.1.0
if: github.ref == 'refs/heads/master' if: ${{ env.PUSH_COVERAGE }}
steps: with:
- name: Create Parsers badge auth: ${{ secrets.GIST_BADGES_SECRET }}
uses: schneegans/dynamic-badges-action@v1.1.0 gistID: ${{ secrets.GIST_BADGES_ID }}
with: filename: crowdsec_parsers_badge.json
auth: ${{ secrets.GIST_BADGES_SECRET }} label: Hub Parsers
gistID: ${{ secrets.GIST_BADGES_ID }} message: ${{ env.PARSERS_COV }}
filename: crowdsec_parsers_badge.json color: ${{ env.SCENARIO_BADGE_COLOR }}
label: Hub Parsers - name: Create Scenarios badge
message: ${{ env.PARSERS_COV }} uses: schneegans/dynamic-badges-action@v1.1.0
color: ${{ env.SCENARIO_BADGE_COLOR }} if: ${{ env.PUSH_COVERAGE }}
- name: Create Scenarios badge with:
uses: schneegans/dynamic-badges-action@v1.1.0 auth: ${{ secrets.GIST_BADGES_SECRET }}
with: gistID: ${{ secrets.GIST_BADGES_ID }}
auth: ${{ secrets.GIST_BADGES_SECRET }} filename: crowdsec_scenarios_badge.json
gistID: ${{ secrets.GIST_BADGES_ID }} label: Hub Scenarios
filename: crowdsec_scenarios_badge.json message: ${{ env.SCENARIOS_COV }}
label: Hub Scenarios color: ${{ env.SCENARIO_BADGE_COLOR }}
message: ${{ env.SCENARIOS_COV }}
color: ${{ env.SCENARIO_BADGE_COLOR }}