2022-06-17 14:12:49 +00:00
|
|
|
name: Go tests (windows)
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2022-11-28 09:52:42 +00:00
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
- releases/**
|
2022-06-17 14:12:49 +00:00
|
|
|
paths-ignore:
|
|
|
|
- 'README.md'
|
|
|
|
pull_request:
|
2022-11-28 09:52:42 +00:00
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
- releases/**
|
2022-06-17 14:12:49 +00:00
|
|
|
paths-ignore:
|
|
|
|
- 'README.md'
|
|
|
|
|
|
|
|
env:
|
|
|
|
RICHGO_FORCE_COLOR: 1
|
2023-01-09 13:49:21 +00:00
|
|
|
CROWDSEC_FEATURE_DISABLE_HTTP_RETRY_BACKOFF: true
|
2022-06-17 14:12:49 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
2023-02-28 16:25:09 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
go-version: ["1.20.1"]
|
|
|
|
|
2022-06-17 14:12:49 +00:00
|
|
|
name: "Build + tests"
|
|
|
|
runs-on: windows-2022
|
|
|
|
|
|
|
|
steps:
|
|
|
|
|
2023-02-28 16:25:09 +00:00
|
|
|
- name: "Set up Go ${{ matrix.go-version }}"
|
2022-06-17 14:12:49 +00:00
|
|
|
uses: actions/setup-go@v3
|
|
|
|
with:
|
2023-02-28 16:25:09 +00:00
|
|
|
go-version: ${{ matrix.go-version }}
|
2022-06-17 14:12:49 +00:00
|
|
|
id: go
|
|
|
|
|
|
|
|
- name: Check out CrowdSec repository
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
submodules: false
|
|
|
|
|
2023-02-28 16:25:09 +00:00
|
|
|
- name: Cache Go modules
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/go/pkg/mod
|
|
|
|
~/.cache/go-build
|
|
|
|
~/Library/Caches/go-build
|
|
|
|
%LocalAppData%\go-build
|
|
|
|
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-${{ matrix.go-version }}-go-
|
|
|
|
|
2022-06-17 14:12:49 +00:00
|
|
|
- name: Build
|
|
|
|
run: |
|
|
|
|
make build
|
|
|
|
|
|
|
|
- name: Run tests
|
|
|
|
run: |
|
|
|
|
go install github.com/kyoh86/richgo@v0.3.10
|
2022-07-22 08:59:23 +00:00
|
|
|
go test -coverprofile coverage.out -covermode=atomic ./... > out.txt
|
2022-09-28 14:18:00 +00:00
|
|
|
if(!$?) { cat out.txt | sed 's/ *coverage:.*of statements in.*//' | richgo testfilter; Exit 1 }
|
2022-07-22 08:59:23 +00:00
|
|
|
cat out.txt | sed 's/ *coverage:.*of statements in.*//' | richgo testfilter
|
2022-06-17 14:12:49 +00:00
|
|
|
|
|
|
|
- name: Upload unit coverage to Codecov
|
2022-10-24 10:48:25 +00:00
|
|
|
uses: codecov/codecov-action@v3
|
2022-06-17 14:12:49 +00:00
|
|
|
with:
|
|
|
|
files: coverage.out
|
|
|
|
flags: unit-windows
|