-
Notifications
You must be signed in to change notification settings - Fork 150
85 lines (82 loc) · 2.99 KB
/
test_configurations.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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 }}