-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
22 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: verify code (lint, test) | ||
on: [push] | ||
jobs: | ||
verify: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
- name: Install Golang | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: go.mod | ||
- uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: v1.53 | ||
- run: go test -v ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,12 @@ | ||
BUILD_DIR=$(shell pwd)/.build | ||
PROJECTS=sk-vnode sk-cloudprov | ||
IMAGE_TARGETS=$(addprefix images/Dockerfile.,$(PROJECTS)) | ||
DOCKER_REGISTRY=localhost:5000 | ||
SHA=$(shell git rev-parse --short HEAD) | ||
UNCLEAN_TREE_SUFFIX=-$(shell test -z "$(git status --porcelain --untracked-files=no)" || \ | ||
GIT_INDEX_FILE=`mktemp` git add -u && git write-tree && git reset -q && rm $$GIT_INDEX_FILE) | ||
ARTIFACTS=sk-vnode sk-cloudprov | ||
|
||
.PHONY: setup default test build image run $(PROJECTS) $(IMAGE_TARGETS) lint cover clean | ||
include build/base.mk | ||
|
||
default: build image run | ||
|
||
test: lint cover | ||
|
||
setup: | ||
pre-commit install | ||
cd k8s && poetry install | ||
|
||
build: $(PROJECTS) | ||
|
||
image: $(IMAGE_TARGETS) | ||
|
||
run: | ||
export CDK8S_OUTDIR=$(BUILD_DIR)/manifests && export BUILD_DIR=$(BUILD_DIR) && cd k8s && poetry run ./main.py | ||
kubectl apply -f $(BUILD_DIR)/manifests | ||
|
||
$(PROJECTS): | ||
$(ARTIFACTS): | ||
CGO_ENABLED=0 go build -trimpath -o $(BUILD_DIR)/$@ ./cmd/$@ | ||
|
||
lint: | ||
golangci-lint run | ||
|
||
cover: | ||
go-carpet -summary | ||
|
||
$(IMAGE_TARGETS): | ||
PROJECT_NAME=$(subst images/Dockerfile.,,$@) && \ | ||
IMAGE_NAME=$(DOCKER_REGISTRY)/$$PROJECT_NAME:$(SHA)$(UNCLEAN_TREE_SUFFIX) && \ | ||
docker build $(BUILD_DIR) -f $@ -t $$IMAGE_NAME && \ | ||
docker push $$IMAGE_NAME && \ | ||
echo -n $$IMAGE_NAME > $(BUILD_DIR)/$${PROJECT_NAME}-image | ||
|
||
clean: | ||
rm -rf $(BUILD_DIR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters