2023-08-27 09:10:55 +00:00
|
|
|
steps:
|
2022-03-27 19:54:06 +00:00
|
|
|
# use vendor to cache dependencies
|
|
|
|
vendor:
|
2023-02-10 03:00:14 +00:00
|
|
|
image: golang:1.20
|
2022-03-27 19:54:06 +00:00
|
|
|
commands:
|
|
|
|
- go mod vendor
|
|
|
|
|
|
|
|
lint:
|
2022-06-11 21:17:43 +00:00
|
|
|
image: golangci/golangci-lint:latest
|
2022-06-14 18:35:11 +00:00
|
|
|
group: compliant
|
2022-06-11 21:17:43 +00:00
|
|
|
pull: true
|
2022-03-27 19:54:06 +00:00
|
|
|
commands:
|
|
|
|
- go version
|
|
|
|
- go install mvdan.cc/gofumpt@latest
|
|
|
|
- "[ $(gofumpt -extra -l . | wc -l) != 0 ] && { echo 'code not formated'; exit 1; }"
|
2022-06-11 21:17:43 +00:00
|
|
|
- golangci-lint run --timeout 5m --build-tags integration
|
2022-03-27 19:54:06 +00:00
|
|
|
|
2022-11-11 22:51:45 +00:00
|
|
|
editor-config:
|
|
|
|
group: compliant
|
|
|
|
image: mstruebing/editorconfig-checker
|
|
|
|
|
2022-06-14 18:35:11 +00:00
|
|
|
build:
|
|
|
|
group: compliant
|
2022-10-10 21:27:33 +00:00
|
|
|
image: codeberg.org/6543/docker-images/golang_just
|
2022-03-30 19:31:09 +00:00
|
|
|
commands:
|
2022-06-14 18:35:11 +00:00
|
|
|
- go version
|
|
|
|
- just build
|
|
|
|
when:
|
|
|
|
event: [ "pull_request", "push" ]
|
2022-03-27 19:54:06 +00:00
|
|
|
|
2022-08-12 04:14:39 +00:00
|
|
|
docker-dryrun:
|
|
|
|
group: compliant
|
2022-07-15 22:59:55 +00:00
|
|
|
image: plugins/kaniko
|
|
|
|
settings:
|
|
|
|
dockerfile: Dockerfile
|
|
|
|
no_push: true
|
|
|
|
tags: latest
|
|
|
|
when:
|
|
|
|
event: [ "pull_request", "push" ]
|
|
|
|
path: Dockerfile
|
|
|
|
|
2022-06-14 18:35:11 +00:00
|
|
|
build-tag:
|
|
|
|
group: compliant
|
2022-10-10 21:27:33 +00:00
|
|
|
image: codeberg.org/6543/docker-images/golang_just
|
2022-03-27 19:54:06 +00:00
|
|
|
commands:
|
2022-06-14 18:35:11 +00:00
|
|
|
- go version
|
|
|
|
- just build-tag ${CI_COMMIT_TAG##v}
|
|
|
|
when:
|
|
|
|
event: [ "tag" ]
|
|
|
|
|
|
|
|
test:
|
|
|
|
group: test
|
2022-10-10 21:27:33 +00:00
|
|
|
image: codeberg.org/6543/docker-images/golang_just
|
2022-06-14 18:35:11 +00:00
|
|
|
commands:
|
|
|
|
- just test
|
2022-06-11 21:17:43 +00:00
|
|
|
|
|
|
|
integration-tests:
|
2022-06-14 18:35:11 +00:00
|
|
|
group: test
|
2022-10-10 21:27:33 +00:00
|
|
|
image: codeberg.org/6543/docker-images/golang_just
|
2022-06-11 21:17:43 +00:00
|
|
|
commands:
|
2022-06-14 18:35:11 +00:00
|
|
|
- just integration
|
2022-06-11 21:17:43 +00:00
|
|
|
environment:
|
|
|
|
- ACME_API=https://acme.mock.directory
|
|
|
|
- PAGES_DOMAIN=localhost.mock.directory
|
|
|
|
- RAW_DOMAIN=raw.localhost.mock.directory
|
2022-06-14 18:35:11 +00:00
|
|
|
- PORT=4430
|
|
|
|
|
2023-02-10 03:00:14 +00:00
|
|
|
# TODO: remove in next version
|
|
|
|
integration-tests-legacy:
|
|
|
|
group: test
|
|
|
|
image: codeberg.org/6543/docker-images/golang_just
|
|
|
|
commands:
|
|
|
|
- just integration
|
|
|
|
environment:
|
|
|
|
- ACME_API=https://acme.mock.directory
|
|
|
|
- PAGES_DOMAIN=localhost.mock.directory
|
|
|
|
- RAW_DOMAIN=raw.localhost.mock.directory
|
|
|
|
- PORT=4430
|
|
|
|
- DB_TYPE=
|
|
|
|
|
2022-06-14 18:35:11 +00:00
|
|
|
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" ]
|
2022-08-12 04:14:39 +00:00
|
|
|
|
|
|
|
docker-next:
|
|
|
|
image: plugins/kaniko
|
|
|
|
settings:
|
|
|
|
registry: codeberg.org
|
|
|
|
dockerfile: Dockerfile
|
2022-08-12 05:02:24 +00:00
|
|
|
repo: codeberg.org/codeberg/pages-server
|
2022-08-12 04:14:39 +00:00
|
|
|
tags: next
|
|
|
|
username:
|
|
|
|
from_secret: bot_user
|
|
|
|
password:
|
|
|
|
from_secret: bot_token
|
|
|
|
when:
|
|
|
|
event: [ "push" ]
|
2022-11-11 23:23:45 +00:00
|
|
|
branch: ${CI_REPO_DEFAULT_BRANCH}
|
2022-08-12 04:14:39 +00:00
|
|
|
|
|
|
|
docker-tag:
|
|
|
|
image: plugins/kaniko
|
|
|
|
settings:
|
|
|
|
registry: codeberg.org
|
|
|
|
dockerfile: Dockerfile
|
2022-08-12 05:02:24 +00:00
|
|
|
repo: codeberg.org/codeberg/pages-server
|
2022-11-22 21:30:53 +00:00
|
|
|
tags: [ latest, "${CI_COMMIT_TAG}" ]
|
2022-08-12 04:14:39 +00:00
|
|
|
username:
|
|
|
|
from_secret: bot_user
|
|
|
|
password:
|
|
|
|
from_secret: bot_token
|
|
|
|
when:
|
|
|
|
event: [ "tag" ]
|