add alert context for appsec/waf #2697
Workflow file for this run
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: HubTest | |
on: | |
pull_request: | |
branches: [ master ] | |
paths: | |
- 'collections/**.yaml' | |
- 'collections/**.yml' | |
- 'contexts/**.yaml' | |
- 'contexts/**.yml' | |
- 'parsers/**.yaml' | |
- 'parsers/**.yml' | |
- 'postoverflows/**.yaml' | |
- 'postoverflows/**.yml' | |
- 'scenarios/**.yaml' | |
- 'scenarios/**.yml' | |
- '.github/workflows/**.yaml' | |
- '.github/workflows/**.yml' | |
- '.tests/**' | |
- '!.github/workflows/update_taxonomy.yaml' | |
push: | |
branches: [ master ] | |
paths: | |
- 'collections/**.yaml' | |
- 'collections/**.yml' | |
- 'contexts/**.yaml' | |
- 'contexts/**.yml' | |
- 'parsers/**.yaml' | |
- 'parsers/**.yml' | |
- 'postoverflows/**.yaml' | |
- 'postoverflows/**.yml' | |
- 'scenarios/**.yaml' | |
- 'scenarios/**.yml' | |
- '.github/workflows/**.yaml' | |
- '.github/workflows/**.yml' | |
- '.tests/**' | |
- '!.github/workflows/update_taxonomy.yaml' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
run-hub-tests: | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/crowdsecurity/crowdsec | |
options: "--entrypoint bash" | |
env: | |
DISABLE_LOCAL_API: "true" | |
env: | |
RESULTS_PATH: . | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- name: run tests on last crowdsec tag | |
run: | | |
mkdir -p /etc/crowdsec && cp -r /staging/etc/* /etc/ | |
cscli hubtest run --all --clean | |
echo "PARSERS_COV=$(cscli hubtest coverage --parsers --percent | cut -d '=' -f2)" >> $GITHUB_ENV | |
echo "SCENARIOS_COV=$(cscli hubtest coverage --scenarios --percent | cut -d '=' -f2)" >> $GITHUB_ENV | |
PARSERS_COV_NUMBER=$(cscli hubtest coverage --parsers --percent | cut -d '=' -f2 | tr -d '%' | tr -d '[[:space:]]') | |
SCENARIOS_COV_NUMBER=$(cscli hubtest coverage --scenarios --percent | cut -d '=' -f2 | tr -d '%' | tr -d '[[:space:]]') | |
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 | |
- name: Create Parsers badge | |
uses: schneegans/[email protected] | |
if: ${{ github.ref == 'refs/heads/master' }} | |
with: | |
auth: ${{ secrets.GIST_BADGES_SECRET }} | |
gistID: ${{ secrets.GIST_BADGES_ID }} | |
filename: hub_parsers_badge.json | |
label: Hub Parsers | |
message: ${{ env.PARSERS_COV }} | |
color: ${{ env.SCENARIO_BADGE_COLOR }} | |
- name: Create Scenarios badge | |
uses: schneegans/[email protected] | |
if: ${{ github.ref == 'refs/heads/master' }} | |
with: | |
auth: ${{ secrets.GIST_BADGES_SECRET }} | |
gistID: ${{ secrets.GIST_BADGES_ID }} | |
filename: hub_scenarios_badge.json | |
label: Hub Scenarios | |
message: ${{ env.SCENARIOS_COV }} | |
color: ${{ env.SCENARIO_BADGE_COLOR }} | |