Release via CI (#94)

* release via CI
* general CI improvements

close #76, close #92

Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/94
This commit is contained in:
6543 2022-06-14 20:35:11 +02:00
parent 4c6164ef05
commit 6dedd55eb3
5 changed files with 57 additions and 12 deletions

View file

@ -9,6 +9,7 @@ pipeline:
lint:
image: golangci/golangci-lint:latest
group: compliant
pull: true
commands:
- go version
@ -16,22 +17,53 @@ pipeline:
- "[ $(gofumpt -extra -l . | wc -l) != 0 ] && { echo 'code not formated'; exit 1; }"
- golangci-lint run --timeout 5m --build-tags integration
test:
image: golang:1.18
commands:
- go test -race codeberg.org/codeberg/pages/server/...
build:
image: golang:1.18
group: compliant
image: a6543/golang_just
commands:
- go build
- go version
- just build
when:
event: [ "pull_request", "push" ]
build-tag:
group: compliant
image: a6543/golang_just
commands:
- go version
- just build-tag ${CI_COMMIT_TAG##v}
when:
event: [ "tag" ]
test:
image: a6543/golang_just
group: test
commands:
- just test
integration-tests:
image: golang:1.18
image: a6543/golang_just
group: test
commands:
- go test -race -tags integration codeberg.org/codeberg/pages/integration/...
- just integration
environment:
- ACME_API=https://acme.mock.directory
- PAGES_DOMAIN=localhost.mock.directory
- RAW_DOMAIN=raw.localhost.mock.directory
- PORT=4430
- PORT=4430
release:
image: plugins/gitea-release
settings:
base_url: https://codeberg.org
file_exists: overwrite
files: build/codeberg-pages-server
api_key:
from_secret: bot_token
environment:
- DRONE_REPO_OWNER=${CI_REPO_OWNER}
- DRONE_REPO_NAME=${CI_REPO_NAME}
- DRONE_BUILD_EVENT=${CI_BUILD_EVENT}
- DRONE_COMMIT_REF=${CI_COMMIT_REF}
when:
event: [ "tag" ]