From c37d491e86ea9ce384f8784d78e8658f30a143fe Mon Sep 17 00:00:00 2001 From: Mike Shoup Date: Thu, 4 Oct 2018 17:57:39 -0600 Subject: [PATCH] Moved to GitLab and setup CI * Renamed temp-gopher references to tempgopher * Added to GitLab CI --- .gitignore | 2 +- .gitlab-ci.yml | 36 ++++++++++++++++++++++++++++++++++++ README.md | 10 +++++----- 3 files changed, 42 insertions(+), 6 deletions(-) create mode 100644 .gitlab-ci.yml diff --git a/.gitignore b/.gitignore index 0ca6025..490ab2c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ # Things -temp-gopher +tempgopher *~ *.swp diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..0b6ac6b --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,36 @@ +image: golang:1.11 + +variables: + binary_name: tempgopher + project_prefix: gitlab.com/shouptech + project_path: $project_prefix/tempgopher + + +stages: +- test +- build + +before_script: +- mkdir -p ${GOPATH}/src/${project_prefix} +- cp -r ${CI_PROJECT_DIR} ${GOPATH}/src/${project_path} +- cd ${GOPATH}/src/${project_path} +- go get -v ./... + +test: + stage: test + variables: + GIN_MODE: debug + script: + - go get -v -t ./... + - go test -v + +build: + stage: build + variables: + build_binary: $CI_PROJECT_DIR/${binary_name} + script: + - go get -v github.com/gobuffalo/packr/... + - GOOS=linux GOARCH=arm GOARM=6 packr build -v -a -ldflags '-s -w -extldflags "-static"' -o ${build_binary} + artifacts: + paths: + - tempgopher diff --git a/README.md b/README.md index 5115a03..8740f94 100644 --- a/README.md +++ b/README.md @@ -17,10 +17,10 @@ You can build on a Raspberry Pi, however, it can take a long time! I recommend b ``` go get -u github.com/gobuffalo/packr/... -go get gitea.shoup.io/mike/temp-gopher -cd $GOPATH/src/gitea.shoup.io/mike/temp-gopher +go get gitea.shoup.io/mike/tempgopher +cd $GOPATH/src/gitea.shoup.io/mike/tempgopher GOOS=linux GOARCH=arm GOARM=6 packr build -a -ldflags '-w -s -extldflags "-static"' -scp temp-gopher :~/somepath +scp tempgopher :~/somepath ``` ## Configuration @@ -49,13 +49,13 @@ sensors: You can run it directly in the comment line like: ``` -./temp-gopher -c config.yml run +./tempgopher -c config.yml run ``` You can run it in the background using `nohup`: ``` -nohup ./temp-gopher -c config.yml run & +nohup ./tempgopher -c config.yml run & ``` Or use `systemctl` or some other process supervisor to run it.