1
0
mirror of https://github.com/rancher/steve.git synced 2025-04-27 11:00:48 +00:00

Adding build/test phase for CI

This commit is contained in:
Michael Bolot 2022-10-14 15:02:53 -05:00
parent 7312fe9ef3
commit 7e4a51bda0
4 changed files with 43 additions and 2 deletions

View File

@ -10,4 +10,33 @@ steps:
from_secret: FOSSA_API_KEY
when:
instance:
include:
- drone-publish.rancher.io
exclude:
- drone-pr.rancher.io
---
kind: pipeline
name: build
steps:
- name: build
image: registry.suse.com/bci/golang:1.19
commands:
- make build-bin
when:
event:
- push
- pull_request
---
kind: pipeline
name: test
steps:
- name: test
image: registry.suse.com/bci/golang:1.19
commands:
- make test
when:
event:
- push
- pull_request

View File

@ -1,8 +1,14 @@
build:
docker build -t steve .
build-bin:
bash scripts/build-bin.sh
run: build
docker run $(DOCKER_ARGS) --rm -p 8989:9080 -it -v ${HOME}/.kube:/root/.kube steve --https-listen-port 0
run-host: build
docker run $(DOCKER_ARGS) --net=host --uts=host --rm -it -v ${HOME}/.kube:/root/.kube steve --kubeconfig /root/.kube/config --http-listen-port 8989 --https-listen-port 0
test:
bash scripts/test.sh

3
scripts/build-bin.sh Normal file
View File

@ -0,0 +1,3 @@
#!/bin/bash
CGO_ENABLED=0 go build -ldflags "-extldflags -static -s" -o ./bin/steve

3
scripts/test.sh Normal file
View File

@ -0,0 +1,3 @@
#!/bin/bash
go test ./...