Skip to content

Commit

Permalink
github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
drmorr0 committed Aug 27, 2023
1 parent 5163811 commit d656130
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 35 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/verify.yml
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 ./...
38 changes: 3 additions & 35 deletions Makefile
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)
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
![build status](https://github.com/acrlabs/simkube/actions/workflows/verify.yml/badge.svg)

# simkube

A collection of tools for simulating Kubernetes scheduling and autoscaling behaviour
Expand Down

0 comments on commit d656130

Please sign in to comment.