github.com/crowdsecurity/crowdsec@v1.6.1/.github/workflows/bats-hub.yml (about)

     1  name: (sub) Bats / Hub
     2  
     3  on:
     4    workflow_call:
     5      secrets:
     6        GIST_BADGES_SECRET:
     7          required: true
     8        GIST_BADGES_ID:
     9          required: true
    10  
    11  jobs:
    12    build:
    13      strategy:
    14        matrix:
    15          test-file: ["hub-1.bats", "hub-2.bats", "hub-3.bats"]
    16  
    17      name: "Functional tests"
    18      runs-on: ubuntu-latest
    19      timeout-minutes: 30
    20      steps:
    21  
    22      - name: "Force machineid"
    23        run: |
    24            sudo chmod +w /etc/machine-id
    25            echo githubciXXXXXXXXXXXXXXXXXXXXXXXX | sudo tee /etc/machine-id
    26  
    27      - name: "Check out CrowdSec repository"
    28        uses: actions/checkout@v4
    29        with:
    30          fetch-depth: 0
    31          submodules: true
    32  
    33      - name: "Set up Go"
    34        uses: actions/setup-go@v5
    35        with:
    36          go-version: "1.21.9"
    37  
    38      - name: "Install bats dependencies"
    39        env:
    40          GOBIN: /usr/local/bin
    41        run: |
    42          sudo apt -qq -y -o=Dpkg::Use-Pty=0 install build-essential daemonize jq libre2-dev
    43  
    44      - name: "Build crowdsec and fixture"
    45        run: make bats-clean bats-build bats-fixture BUILD_STATIC=1
    46  
    47      - name: "Run hub tests"
    48        run: |
    49            ./test/bin/generate-hub-tests
    50            ./test/run-tests ./test/dyn-bats/${{ matrix.test-file }} --formatter $(pwd)/test/lib/color-formatter
    51  
    52      - name: "Collect hub coverage"
    53        run: ./test/bin/collect-hub-coverage >> $GITHUB_ENV
    54  
    55      - name: "Create Parsers badge"
    56        uses: schneegans/dynamic-badges-action@v1.7.0
    57        if: ${{ github.ref == 'refs/heads/master' && github.repository_owner == 'crowdsecurity' }}
    58        with:
    59          auth: ${{ secrets.GIST_BADGES_SECRET }}
    60          gistID: ${{ secrets.GIST_BADGES_ID }}
    61          filename: crowdsec_parsers_badge.json
    62          label: Hub Parsers
    63          message: ${{ env.PARSERS_COV }}
    64          color: ${{ env.SCENARIO_BADGE_COLOR }}
    65  
    66      - name: "Create Scenarios badge"
    67        uses: schneegans/dynamic-badges-action@v1.7.0
    68        if: ${{ github.ref == 'refs/heads/master' && github.repository_owner == 'crowdsecurity' }}
    69        with:
    70          auth: ${{ secrets.GIST_BADGES_SECRET }}
    71          gistID: ${{ secrets.GIST_BADGES_ID }}
    72          filename: crowdsec_scenarios_badge.json
    73          label: Hub Scenarios
    74          message: ${{ env.SCENARIOS_COV }}
    75          color: ${{ env.SCENARIO_BADGE_COLOR }}