Update github actions ci to use Makefile
Signed-off-by: Derek McGowan <derek@mcg.dev>
This commit is contained in:
parent
fe03193c28
commit
99a30d2437
31
.github/workflows/ci.yml
vendored
31
.github/workflows/ci.yml
vendored
@ -84,12 +84,12 @@ jobs:
|
|||||||
- name: Test
|
- name: Test
|
||||||
working-directory: src/github.com/containerd/ttrpc
|
working-directory: src/github.com/containerd/ttrpc
|
||||||
run: |
|
run: |
|
||||||
go test -v -race -coverprofile=coverage_txt -covermode=atomic ./...
|
make coverage TESTFLAGS_RACE=-race
|
||||||
|
|
||||||
- name: Code Coverage
|
- name: Code Coverage
|
||||||
uses: codecov/codecov-action@v2
|
uses: codecov/codecov-action@v2
|
||||||
with:
|
with:
|
||||||
files: coverage_txt
|
files: coverage.txt
|
||||||
if: matrix.os == 'ubuntu-latest'
|
if: matrix.os == 'ubuntu-latest'
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -119,27 +119,18 @@ jobs:
|
|||||||
path: src/github.com/containerd/ttrpc
|
path: src/github.com/containerd/ttrpc
|
||||||
fetch-depth: 25
|
fetch-depth: 25
|
||||||
|
|
||||||
- name: Install protoc
|
- name: Install dependencies
|
||||||
run: |
|
|
||||||
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v3.5.0/protoc-3.5.0-linux-x86_64.zip
|
|
||||||
sudo unzip -x protoc-3.5.0-linux-x86_64.zip -d /usr/local
|
|
||||||
sudo chmod -R go+rX /usr/local/include
|
|
||||||
sudo chmod go+x /usr/local/bin/protoc
|
|
||||||
|
|
||||||
- name: Install protoc-gen-go
|
|
||||||
run: |
|
|
||||||
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.27.1
|
|
||||||
|
|
||||||
- name: Build protoc-gen-go-ttrpc
|
|
||||||
working-directory: src/github.com/containerd/ttrpc
|
working-directory: src/github.com/containerd/ttrpc
|
||||||
run: |
|
run: |
|
||||||
go build ./cmd/protoc-gen-go-ttrpc
|
sudo make install-protobuf
|
||||||
|
make install-protobuild
|
||||||
|
|
||||||
|
- name: Install protoc-gen-go-ttrpc
|
||||||
|
working-directory: src/github.com/containerd/ttrpc
|
||||||
|
run: |
|
||||||
|
make install
|
||||||
|
|
||||||
- name: Run Protobuild
|
- name: Run Protobuild
|
||||||
working-directory: src/github.com/containerd/ttrpc
|
working-directory: src/github.com/containerd/ttrpc
|
||||||
run: |
|
run: |
|
||||||
export PATH=$GOPATH/bin:$PWD:$PATH
|
make check-protos
|
||||||
go install github.com/containerd/protobuild@7e5ee24bc1f70e9e289fef15e2631eb3491320bf
|
|
||||||
protobuild
|
|
||||||
(cd example && protobuild)
|
|
||||||
git diff --exit-code
|
|
||||||
|
25
Makefile
25
Makefile
@ -33,7 +33,8 @@ GO_BUILDTAGS ?=
|
|||||||
GO_TAGS=$(if $(GO_BUILDTAGS),-tags "$(strip $(GO_BUILDTAGS))",)
|
GO_TAGS=$(if $(GO_BUILDTAGS),-tags "$(strip $(GO_BUILDTAGS))",)
|
||||||
|
|
||||||
# Project packages.
|
# Project packages.
|
||||||
PACKAGES=$(shell $(GO) list ${GO_TAGS} ./... | grep -v /integration | grep -v /example)
|
PACKAGES=$(shell $(GO) list ${GO_TAGS} ./... | grep -v /example)
|
||||||
|
TESTPACKAGES=$(shell $(GO) list ${GO_TAGS} ./... | grep -v /cmd | grep -v /integration | grep -v /example)
|
||||||
BINPACKAGES=$(addprefix ./cmd/,$(COMMANDS))
|
BINPACKAGES=$(addprefix ./cmd/,$(COMMANDS))
|
||||||
|
|
||||||
#Replaces ":" (*nix), ";" (windows) with newline for easy parsing
|
#Replaces ":" (*nix), ";" (windows) with newline for easy parsing
|
||||||
@ -56,7 +57,7 @@ TESTFLAGS_PARALLEL ?= 8
|
|||||||
# Use this to replace `go test` with, for instance, `gotestsum`
|
# Use this to replace `go test` with, for instance, `gotestsum`
|
||||||
GOTEST ?= $(GO) test
|
GOTEST ?= $(GO) test
|
||||||
|
|
||||||
.PHONY: clean all AUTHORS build binaries test integration generate protos checkprotos coverage ci check help install vendor install-deps
|
.PHONY: clean all AUTHORS build binaries test integration generate protos checkprotos coverage ci check help install vendor install-protobuf install-protobuild
|
||||||
.DEFAULT: default
|
.DEFAULT: default
|
||||||
|
|
||||||
# Forcibly set the default goal to all, in case an include above brought in a rule definition.
|
# Forcibly set the default goal to all, in case an include above brought in a rule definition.
|
||||||
@ -106,11 +107,11 @@ build: ## build the go packages
|
|||||||
|
|
||||||
test: ## run tests, except integration tests and tests that require root
|
test: ## run tests, except integration tests and tests that require root
|
||||||
@echo "$(WHALE) $@"
|
@echo "$(WHALE) $@"
|
||||||
@$(GOTEST) ${TESTFLAGS} ${PACKAGES}
|
@$(GOTEST) ${TESTFLAGS} ${TESTPACKAGES}
|
||||||
|
|
||||||
#integration: ## run integration tests
|
integration: ## run integration tests
|
||||||
# @echo "$(WHALE) $@"
|
@echo "$(WHALE) $@"
|
||||||
# @cd "${ROOTDIR}/integration" && $(GO) mod download && $(GOTEST) -v ${TESTFLAGS} -parallel ${TESTFLAGS_PARALLEL} .
|
@cd "${ROOTDIR}/integration" && $(GOTEST) -v ${TESTFLAGS} -parallel ${TESTFLAGS_PARALLEL} .
|
||||||
|
|
||||||
benchmark: ## run benchmarks tests
|
benchmark: ## run benchmarks tests
|
||||||
@echo "$(WHALE) $@"
|
@echo "$(WHALE) $@"
|
||||||
@ -138,13 +139,19 @@ install: ## install binaries
|
|||||||
@echo "$(WHALE) $@ $(BINPACKAGES)"
|
@echo "$(WHALE) $@ $(BINPACKAGES)"
|
||||||
@$(GO) install $(BINPACKAGES)
|
@$(GO) install $(BINPACKAGES)
|
||||||
|
|
||||||
install-deps:
|
install-protobuf:
|
||||||
script/install-protobuf
|
@echo "$(WHALE) $@"
|
||||||
|
@script/install-protobuf
|
||||||
|
|
||||||
|
install-protobuild:
|
||||||
|
@echo "$(WHALE) $@"
|
||||||
|
@$(GO) install google.golang.org/protobuf/cmd/protoc-gen-go@v1.27.1
|
||||||
|
@$(GO) install github.com/containerd/protobuild@7e5ee24bc1f70e9e289fef15e2631eb3491320bf
|
||||||
|
|
||||||
coverage: ## generate coverprofiles from the unit tests, except tests that require root
|
coverage: ## generate coverprofiles from the unit tests, except tests that require root
|
||||||
@echo "$(WHALE) $@"
|
@echo "$(WHALE) $@"
|
||||||
@rm -f coverage.txt
|
@rm -f coverage.txt
|
||||||
@$(GO) test -i ${TESTFLAGS} ${PACKAGES} 2> /dev/null
|
@$(GO) test -i ${TESTFLAGS} ${TESTPACKAGES} 2> /dev/null
|
||||||
@( for pkg in ${PACKAGES}; do \
|
@( for pkg in ${PACKAGES}; do \
|
||||||
$(GO) test ${TESTFLAGS} \
|
$(GO) test ${TESTFLAGS} \
|
||||||
-cover \
|
-cover \
|
||||||
|
Loading…
Reference in New Issue
Block a user