81 lines
2 KiB
YAML
81 lines
2 KiB
YAML
name: Go tests (windows)
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- releases/**
|
|
paths-ignore:
|
|
- 'README.md'
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
- releases/**
|
|
paths-ignore:
|
|
- 'README.md'
|
|
|
|
env:
|
|
RICHGO_FORCE_COLOR: 1
|
|
CROWDSEC_FEATURE_DISABLE_HTTP_RETRY_BACKOFF: true
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
matrix:
|
|
go-version: ["1.20.5"]
|
|
|
|
name: "Build + tests"
|
|
runs-on: windows-2022
|
|
|
|
steps:
|
|
|
|
- name: "Set up Go ${{ matrix.go-version }}"
|
|
uses: actions/setup-go@v3
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
|
|
- name: Check out CrowdSec repository
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
submodules: false
|
|
|
|
- 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-
|
|
|
|
- name: Build
|
|
run: |
|
|
make build
|
|
|
|
- name: Run tests
|
|
run: |
|
|
go install github.com/kyoh86/richgo@v0.3.10
|
|
go test -coverprofile coverage.out -covermode=atomic ./... > out.txt
|
|
if(!$?) { cat out.txt | sed 's/ *coverage:.*of statements in.*//' | richgo testfilter; Exit 1 }
|
|
cat out.txt | sed 's/ *coverage:.*of statements in.*//' | richgo testfilter
|
|
|
|
- name: Upload unit coverage to Codecov
|
|
uses: codecov/codecov-action@v3
|
|
with:
|
|
files: coverage.out
|
|
flags: unit-windows
|
|
|
|
- name: golangci-lint
|
|
uses: golangci/golangci-lint-action@v3
|
|
with:
|
|
version: v1.51
|
|
args: --issues-exit-code=1 --timeout 10m
|
|
only-new-issues: false
|
|
# the cache is already managed above, enabling it here
|
|
# gives errors when extracting
|
|
skip-pkg-cache: true
|
|
skip-build-cache: true
|