Fix makefile.
This commit is contained in:
parent
839ea036c2
commit
5cc74e7443
2 changed files with 22 additions and 27 deletions
25
.github/workflows/test.yml
vendored
25
.github/workflows/test.yml
vendored
|
|
@ -21,48 +21,39 @@ jobs:
|
||||||
with:
|
with:
|
||||||
go-version: '${{ env.GO_VERSION }}'
|
go-version: '${{ env.GO_VERSION }}'
|
||||||
check-latest: true
|
check-latest: true
|
||||||
- name: Run gofmt
|
- run: make test-format
|
||||||
run: test -z $(gofmt -l .) || (gofmt -d . && exit 1)
|
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
name: Lint (golangci-lint)
|
name: Lint (golangci-lint)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [format]
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@main
|
- uses: actions/checkout@main
|
||||||
- uses: actions/setup-go@main
|
- uses: actions/setup-go@main
|
||||||
with:
|
with:
|
||||||
go-version: '${{ env.GO_VERSION }}'
|
go-version: '${{ env.GO_VERSION }}'
|
||||||
check-latest: true
|
check-latest: true
|
||||||
- name: Run golangci-lint
|
- run: make test-lint
|
||||||
run: |
|
|
||||||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.51.1
|
|
||||||
golangci-lint run -v ./...
|
|
||||||
|
|
||||||
test:
|
tests:
|
||||||
name: Test (go test)
|
name: Test (go test)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [lint]
|
needs: [format, lint]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@main
|
- uses: actions/checkout@main
|
||||||
- uses: actions/setup-go@main
|
- uses: actions/setup-go@main
|
||||||
with:
|
with:
|
||||||
go-version: '${{ env.GO_VERSION }}'
|
go-version: '${{ env.GO_VERSION }}'
|
||||||
check-latest: true
|
check-latest: true
|
||||||
- name: Run go test
|
- run: make test-unit
|
||||||
run: go test -race ./...
|
|
||||||
|
|
||||||
build-cli:
|
build-cli:
|
||||||
name: Build CLI (go build)
|
name: Build CLI (go install)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [lint]
|
needs: [tests]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@main
|
- uses: actions/checkout@main
|
||||||
- uses: actions/setup-go@main
|
- uses: actions/setup-go@main
|
||||||
with:
|
with:
|
||||||
go-version: '${{ env.GO_VERSION }}'
|
go-version: '${{ env.GO_VERSION }}'
|
||||||
check-latest: true
|
check-latest: true
|
||||||
- name: Run go build
|
- run: make install-cli && battlesnake --help
|
||||||
run: |
|
|
||||||
go build ./cli/battlesnake
|
|
||||||
./battlesnake --help
|
|
||||||
|
|
|
||||||
24
Makefile
24
Makefile
|
|
@ -1,23 +1,27 @@
|
||||||
GOLANGCI_LINT_VERSION ?= 1.51.1
|
GOPATH ?= $(shell $$(go env GOPATH))
|
||||||
|
|
||||||
/go/bin/golangci-lint:
|
GOLANGCI_LINT_PATH := $(GOPATH)/bin/golangci-lint
|
||||||
|
GOLANGCI_LINT_VERSION := 1.51.1
|
||||||
|
|
||||||
|
|
||||||
|
${GOLANGCI_LINT_PATH}:
|
||||||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ${GOPATH}/bin v${GOLANGCI_LINT_VERSION}
|
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ${GOPATH}/bin v${GOLANGCI_LINT_VERSION}
|
||||||
|
|
||||||
build-cli:
|
install-cli:
|
||||||
go install ./cli/battlesnake
|
go install ./cli/battlesnake
|
||||||
.PHONY: cli
|
.PHONY: install-cli
|
||||||
|
|
||||||
test: test-format test-lint test-unit
|
|
||||||
.PHONY: test
|
|
||||||
|
|
||||||
test-format:
|
test-format:
|
||||||
test -z $(gofmt -l .) || (gofmt -l . && exit 1)
|
test -z $$(gofmt -l .) || (gofmt -l . && exit 1)
|
||||||
.PHONY: test-format
|
.PHONY: test-format
|
||||||
|
|
||||||
test-lint: /go/bin/golangci-lint
|
test-lint: ${GOLANGCI_LINT_PATH}
|
||||||
/go/bin/golangci-lint run -v ./...
|
golangci-lint run -v ./...
|
||||||
.PHONY: test-lint
|
.PHONY: test-lint
|
||||||
|
|
||||||
test-unit:
|
test-unit:
|
||||||
go test -race ./...
|
go test -race ./...
|
||||||
.PHONY: test-unit
|
.PHONY: test-unit
|
||||||
|
|
||||||
|
test: test-format test-lint test-unit
|
||||||
|
.PHONY: test
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue