2022-03-21 14:51:05 +00:00
|
|
|
name: bats / hub tests
|
2022-03-09 13:45:36 +00:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
name: "Build the application"
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
timeout-minutes: 20
|
|
|
|
steps:
|
|
|
|
|
2022-03-22 11:33:36 +00:00
|
|
|
- name: "Force machineid"
|
|
|
|
run: |
|
|
|
|
sudo chmod +w /etc/machine-id
|
|
|
|
echo githubciXXXXXXXXXXXXXXXXXXXXXXXX | sudo tee /etc/machine-id
|
|
|
|
|
2022-03-09 13:45:36 +00:00
|
|
|
- name: "Set up Go 1.17"
|
|
|
|
uses: actions/setup-go@v1
|
|
|
|
with:
|
|
|
|
go-version: 1.17
|
|
|
|
id: go
|
|
|
|
|
|
|
|
- name: "Clone CrowdSec"
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
submodules: true
|
|
|
|
|
|
|
|
- name: "Install bats dependencies"
|
|
|
|
run: |
|
2022-03-23 10:13:23 +00:00
|
|
|
sudo apt install -qq daemonize netcat-openbsd
|
2022-03-09 13:45:36 +00:00
|
|
|
GO111MODULE=on go get github.com/mikefarah/yq/v4
|
|
|
|
|
|
|
|
- name: "BATS: build crowdsec"
|
|
|
|
run: make bats-clean bats-build
|
|
|
|
|
2022-03-21 14:51:05 +00:00
|
|
|
- name: "BATS: run hub tests"
|
|
|
|
run: make bats-test-hub
|
2022-03-09 13:45:36 +00:00
|
|
|
|
|
|
|
- name: "BATS: collect hub coverage"
|
|
|
|
run: ./tests/collect-hub-coverage >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: "Create Parsers badge"
|
|
|
|
uses: schneegans/dynamic-badges-action@v1.1.0
|
|
|
|
if: ${{ github.ref == 'refs/heads/master' }}
|
|
|
|
with:
|
|
|
|
auth: ${{ secrets.GIST_BADGES_SECRET }}
|
|
|
|
gistID: ${{ secrets.GIST_BADGES_ID }}
|
|
|
|
filename: crowdsec_parsers_badge.json
|
|
|
|
label: Hub Parsers
|
|
|
|
message: ${{ env.PARSERS_COV }}
|
|
|
|
color: ${{ env.SCENARIO_BADGE_COLOR }}
|
|
|
|
|
|
|
|
- name: "Create Scenarios badge"
|
|
|
|
uses: schneegans/dynamic-badges-action@v1.1.0
|
|
|
|
if: ${{ github.ref == 'refs/heads/master' }}
|
|
|
|
with:
|
|
|
|
auth: ${{ secrets.GIST_BADGES_SECRET }}
|
|
|
|
gistID: ${{ secrets.GIST_BADGES_ID }}
|
|
|
|
filename: crowdsec_scenarios_badge.json
|
|
|
|
label: Hub Scenarios
|
|
|
|
message: ${{ env.SCENARIOS_COV }}
|
|
|
|
color: ${{ env.SCENARIO_BADGE_COLOR }}
|