Adds Bookstack & Joplin server parser, scenarios and tests #1834
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: | |
- 'scenarios/**.yaml' | |
- 'parsers/**.yaml' | |
- 'postoverflows/**.yaml' | |
- 'collections/**.yaml' | |
- 'scenarios/**.yml' | |
- 'parsers/**.yml' | |
- 'postoverflows/**.yml' | |
- 'collections/**.yml' | |
- '.github/workflows/**.yaml' | |
- '.github/workflows/**.yml' | |
- '.tests/**' | |
push: | |
branches: [ master ] | |
paths: | |
- 'scenarios/**.yaml' | |
- 'parsers/**.yaml' | |
- 'postoverflows/**.yaml' | |
- 'collections/**.yaml' | |
- 'scenarios/**.yml' | |
- 'parsers/**.yml' | |
- 'postoverflows/**.yml' | |
- 'collections/**.yml' | |
- '.github/workflows/**.yaml' | |
- '.github/workflows/**.yml' | |
- '.tests/**' | |
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@v2 | |
- 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 }} | |