1
1
mirror of https://github.com/wader/fq.git synced 2024-11-22 07:16:49 +03:00

github,ci: Add windows, macos and 32-bit linux

Split out lint to own job and only run cli bin test on ubuntu (requires expect)
Add .gitattributes with text=lf for *.fqtest as they should be exact
This commit is contained in:
Mattias Wadman 2021-12-24 17:45:02 +01:00
parent 387c48b7a0
commit e5c620db83
3 changed files with 42 additions and 8 deletions

4
.gitattributes vendored Normal file
View File

@ -0,0 +1,4 @@
# for windows: fqtest uses \n and asserts output so should be exact
*.fqtest eol=lf
# for windows: there are fqtest using json that need to be exact
*.json eol=lf

View File

@ -10,10 +10,40 @@ env:
GOLANGCILINT_VERSION: 1.43.0
jobs:
ci:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Lint
uses: golangci/golangci-lint-action@v2
with:
version: v${{ env.GOLANGCILINT_VERSION }}
test:
strategy:
matrix:
include:
- os: ubuntu-latest
goarch: amd64
go_test_race_flags: -race
# build and test on 32 bit, does not support race
- os: ubuntu-latest
goarch: "386"
go_test_race_flags: ""
- os: macos-latest
goarch: amd64
go_test_race_flags: -race
- os: windows-latest
goarch: amd64
go_test_race_flags: -race
runs-on: ${{ matrix.os }}
steps:
# only run cli binary tests on linux
- name: Install expect
if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt-get install expect
- name: Checkout
uses: actions/checkout@v2
@ -23,9 +53,8 @@ jobs:
uses: actions/setup-go@v2
with:
go-version: 1.17.5
- name: Lint
uses: golangci/golangci-lint-action@v2
with:
version: v${{ env.GOLANGCILINT_VERSION }}
- name: Test
env:
GOARCH: ${{ matrix.goarch }}
GO_TEST_RACE_FLAGS: ${{ matrix.go_test_race_flags }}
run: make test

View File

@ -1,5 +1,6 @@
GO_BUILD_FLAGS=-trimpath
GO_BUILD_LDFLAGS=-s -w
GO_BUILD_FLAGS ?= -trimpath
GO_BUILD_LDFLAGS ?= -s -w
GO_TEST_RACE_FLAGS ?=-race
all: test fq
@ -15,7 +16,7 @@ test: testgo testjq testcli
# figure out all go pakges with test files
testgo: PKGS=$(shell find . -name "*_test.go" | xargs -n 1 dirname | sort | uniq)
testgo:
go test -race ${VERBOSE} ${COVER} ${PKGS}
go test ${GO_TEST_RACE_FLAGS} ${VERBOSE} ${COVER} ${PKGS}
.PHONY: testgov
testgov: export VERBOSE=-v