Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

travis: add project setup #25

Merged
merged 1 commit into from
Mar 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
language: go

services:
- docker

os:
- linux

go:
- "1.16"

git:
depth: 3

cache:
directories:
- $GOPATH/pkg/mod

# Install must be set to prevent default `go get` to run.
# The dependencies have already been vendored by `dep` so
# we don't need to fetch them.
install:
-

jobs:
include:
- stage: Verify
name: "Verify code"
install:
- make install-tools
script:
- make verify

- stage: Test
name: "Run tests"
install:
- make install-tools
script:
- make tests

notifications:
email: false
67 changes: 46 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,46 @@
CODE_GEN_DIR = pkg/json
GEN = pkg/cmd/codegenerator/generator.go

TCP_ADDRESS = 127.0.0.1:12345
UNIX_Address = /tmp/unix.soc


#.PHONY: build
#build:
# go build

.PHONY: generate
generate:
go run $(GEN) -s ./json/ovn-nb.ovsschema -d $(CODE_GEN_DIR)
go run $(GEN) -s ./json/ovn-sb.ovsschema -d $(CODE_GEN_DIR)
go run $(GEN) -s ./json/_server.ovsschema -d $(CODE_GEN_DIR)
gofmt -s -w $(CODE_GEN_DIR)

.PHONY: run_server
run_server:
go run pkg/cmd/server/server.go -tcp-address $(TCP_ADDRESS) -unix-address $(UNIX_Address)
.PHONY: install-tools
install-tools:
@echo "nothing for now"

VERIFY += generate
.PHONY: generate
generate: CODE_GEN_DIR = pkg/json
generate: GEN = pkg/cmd/codegenerator/generator.go
generate:
go run $(GEN) -s ./json/ovn-nb.ovsschema -d $(CODE_GEN_DIR)
go run $(GEN) -s ./json/ovn-sb.ovsschema -d $(CODE_GEN_DIR)
go run $(GEN) -s ./json/_server.ovsschema -d $(CODE_GEN_DIR)

VERIFY += fmt
.PHONY: fmt
fmt:
go fmt ./... || true

VERIFY += vet
.PHONY: vet
vet:
go vet ./... || true

VERIFY += fix
.PHONY: fix
fix:
go fix ./... || true

VERIFY += tidy
.PHONY: tidy
tidy:
go mod tidy || true

.PHONY: verify
verify: $(VERIFY)
git diff --exit-code || true

.PHONY: tests
tests:
go test ./... || true

.PHONY: server
server: TCP_ADDRESS = 127.0.0.1:12345
server: UNIX_Address = /tmp/unix.soc
server:
go run pkg/cmd/server/server.go -tcp-address $(TCP_ADDRESS) -unix-address $(UNIX_Address)