implementation: Woodpecker based CI

Signed-off-by: Loïc Dachary <loic@dachary.org>
forgejo
Loïc Dachary 2022-11-05 00:00:07 +01:00
parent 19d76aa497
commit 41fabe9784
No known key found for this signature in database
GPG Key ID: 992D23B392F9E4F2
6 changed files with 193 additions and 1 deletions

View File

@ -0,0 +1,32 @@
platform: linux/amd64
workspace:
base: /go
path: src/codeberg/gitea
pipeline:
deps-backend:
image: golang:1.19
pull: true
commands:
- make deps-backend
security-check:
image: golang:1.19
pull: true
commands:
- make security-check
lint-backend:
image: gitea/test_env:linux-amd64
pull: true
environment:
- TAGS=bindata sqlite sqlite_unlock_notify
- GOSUMDB=sum.golang.org
commands:
- make lint-backend
checks-backend:
image: golang:1.19
commands:
- make --always-make checks-backend

View File

@ -0,0 +1,28 @@
platform: linux/amd64
depends_on:
- testing-amd64
pipeline:
fetch-tags:
image: docker:git
pull: true
commands:
- git config --add safe.directory '*'
- git fetch --tags --force
publish:
image: woodpeckerci/plugin-docker-buildx
pull: true
settings:
platforms: linux/amd64
registry:
from_secret: domain
tag: ${CI_COMMIT_TAG##v}
repo: ${CI_REPO_LINK##https://}
password:
from_secret: releaseteamtoken
username:
from_secret: releaseteamuser
when:
event: tag

View File

@ -0,0 +1,65 @@
platform: linux/amd64
depends_on:
- testing-amd64
workspace:
base: /source
path: /
pipeline:
fetch-tags:
image: docker:git
pull: true
commands:
- git config --add safe.directory '*'
- git fetch --tags --force
deps-frontend:
image: node:18
pull: true
commands:
- make deps-frontend
deps-backend:
image: golang:1.19
pull: true
commands:
- make deps-backend
static:
image: techknowlogick/xgo:go-1.19.x
pull: true
commands:
- curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get -qqy install nodejs
- export PATH=$PATH:$GOPATH/bin
- make CI=true LINUX_ARCHS=linux/amd64,linux/arm64 release
environment:
TAGS: bindata sqlite sqlite_unlock_notify
DEBIAN_FRONTEND: noninteractive
gpg-sign:
image: plugins/gpgsign:1
pull: true
settings:
detach_sign: true
excludes:
- "dist/release/*.sha256"
files:
- "dist/release/*"
key:
from_secret: releaseteamgpg
release:
image: golang:1.19
commands:
- curl -sL https://dl.gitea.io/tea/0.9.0/tea-0.9.0-linux-amd64 > /bin/tea && chmod +x /bin/tea
- REMOTE=$(echo $CI_REPO_LINK | sed -e 's|.*://||' -e 's|/.*||')
- GITEA_SERVER_URL=$CI_REPO_LINK GITEA_SERVER_TOKEN=$RELEASETEAMTOKEN tea login add --name $RELEASETEAMUSER --url $REMOTE
- ASSETS=$(ls dist/release/* | sed -e 's/^/-a /')
- tea release create $ASSETS --tag $CI_COMMIT_TAG --title $CI_COMMIT_TAG
when:
event: tag
secrets:
- releaseteamtoken
- releaseteamuser

View File

@ -0,0 +1,63 @@
platform: linux/amd64
depends_on:
- compliance
workspace:
base: /go
path: src/codeberg/gitea
pipeline:
fetch-tags:
image: docker:git
pull: true
commands:
- git config --add safe.directory '*'
- git fetch --tags --force
deps-backend:
image: golang:1.19
pull: true
commands:
- make deps-backend
tag-pre-condition:
image: drone/git
pull: true
commands:
- git update-ref refs/heads/tag_test ${CI_COMMIT_SHA}
prepare-test-env:
image: gitea/test_env:linux-amd64
pull: true
commands:
- ./build/test-env-prepare.sh
build:
image: gitea/test_env:linux-amd64
environment:
- GOSUMDB=sum.golang.org
- TAGS=bindata sqlite sqlite_unlock_notify
commands:
- su gitea -c './build/test-env-check.sh'
- su gitea -c 'make backend'
unit-test:
image: gitea/test_env:linux-amd64
environment:
- TAGS=bindata sqlite sqlite_unlock_notify
- RACE_ENABLED=true
secrets:
- github_read_token
commands:
- su gitea -c 'make unit-test-coverage test-check'
test-sqlite:
image: gitea/test_env:linux-amd64
environment:
- USE_REPO_TEST_DIR=1
- GOPROXY=off
- TAGS=bindata gogit sqlite sqlite_unlock_notify
- TEST_TAGS=bindata gogit sqlite sqlite_unlock_notify
commands:
- su gitea -c 'timeout -s ABRT 120m make test-sqlite-migration test-sqlite'

4
Dockerfile.tmp Normal file
View File

@ -0,0 +1,4 @@
FROM golang:1.19-alpine3.16
RUN pwd

View File

@ -751,7 +751,7 @@ $(EXECUTABLE): $(GO_SOURCES) $(TAGS_PREREQ)
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) build $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@ CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) build $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@
.PHONY: release .PHONY: release
release: frontend generate release-windows release-linux release-darwin release-copy release-compress vendor release-sources release-docs release-check release: frontend generate release-linux release-copy release-compress vendor release-sources release-check
$(DIST_DIRS): $(DIST_DIRS):
mkdir -p $(DIST_DIRS) mkdir -p $(DIST_DIRS)