mirror of
https://github.com/fabriziosalmi/caddy-waf.git
synced 2025-12-23 22:27:46 -05:00
67 lines
1.7 KiB
YAML
67 lines
1.7 KiB
YAML
name: Test
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- ci
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
permissions:
|
|
contents: read # for actions/checkout to fetch code
|
|
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
|
|
|
|
env:
|
|
# https://github.com/actions/setup-go/issues/491
|
|
GOTOOLCHAIN: local
|
|
|
|
jobs:
|
|
test:
|
|
strategy:
|
|
# Default is true, cancels jobs for other platforms in the matrix if one fails
|
|
fail-fast: true
|
|
matrix:
|
|
os:
|
|
- ubuntu-latest
|
|
go:
|
|
- '1.25'
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
permissions:
|
|
contents: read
|
|
pull-requests: read
|
|
actions: write # to allow uploading artifacts and cache
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
|
|
|
- name: Install Go
|
|
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
|
|
with:
|
|
go-version: ${{ matrix.go }}
|
|
check-latest: true
|
|
|
|
- name: Get dependencies
|
|
run: |
|
|
go get -v
|
|
|
|
- name: Run linter
|
|
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
|
|
with:
|
|
version: latest
|
|
args: --timeout 5m
|
|
|
|
- name: Download MaxMindDB binary
|
|
run: |
|
|
wget https://github.com/P3TERX/GeoLite.mmdb/releases/latest/download/GeoLite2-Country.mmdb
|
|
|
|
# Commented bits below were useful to allow the job to continue
|
|
# even if the tests fail, so we can publish the report separately
|
|
# For info about set-output, see https://stackoverflow.com/questions/57850553/github-actions-check-steps-status
|
|
- name: Run tests
|
|
run: |
|
|
go test -v -failfast ./... -tags=it
|