From e44e13756ba0a0ac317d3fba1aeb812c135da660 Mon Sep 17 00:00:00 2001 From: Marvin Preuss Date: Thu, 30 Mar 2023 07:36:08 +0000 Subject: [PATCH] ci: add woodpecker --- .gitignore | 1 + .woodpecker.yml | 24 ++++++++++++++++++++++++ Earthfile | 13 +++++++++++-- 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 .woodpecker.yml diff --git a/.gitignore b/.gitignore index 9ecc86e..05de7c1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ report.xml coverage.out *.xlsx +dist/ diff --git a/.woodpecker.yml b/.woodpecker.yml new file mode 100644 index 0000000..8b6ebe3 --- /dev/null +++ b/.woodpecker.yml @@ -0,0 +1,24 @@ +pipeline: + earthly: + image: earthly/earthly:v0.6.30 + volumes: + - /var/run/docker.sock:/var/run/docker.sock + environment: + - FORCE_COLOR=1 + - EARTHLY_EXEC_CMD="/bin/sh" + commands: + - earthly bootstrap + - earthly --ci +ci + when: + event: tag + earthly-release: + image: earthly/earthly:v0.6.30 + volumes: + - /var/run/docker.sock:/var/run/docker.sock + environment: + - FORCE_COLOR=1 + - EARTHLY_EXEC_CMD="/bin/sh" + secrets: [GITEA_TOKEN] + commands: + - earthly bootstrap + - earthly --ci --secret GITEA_TOKEN=$GITEA_TOKEN +ci +release diff --git a/Earthfile b/Earthfile index d7b881a..072c426 100644 --- a/Earthfile +++ b/Earthfile @@ -15,7 +15,7 @@ SAVE_CODE: ci: BUILD +lint BUILD +test - # BUILD +release-dev + BUILD +build code: COPY go.mod go.sum ./ @@ -38,7 +38,6 @@ install-deps: SAVE ARTIFACT /go/bin gobin SAVE ARTIFACT /lib lib SAVE ARTIFACT /usr usr - SAVE IMAGE --push git.wobcom.de:5050/smartmetering/mbuslight:cache-deps deps: COPY +install-deps/gobin /go/bin @@ -79,3 +78,13 @@ tidy: SAVE ARTIFACT go.mod AS LOCAL go.mod SAVE ARTIFACT go.sum AS LOCAL go.sum SAVE ARTIFACT vendor AS LOCAL vendor + +build: + FROM +deps + COPY . . + RUN goreleaser build --snapshot --clean + +release: + FROM +deps + COPY . . + RUN --secret GITEA_TOKEN goreleaser release