diff --git a/.woodpecker/compliance.yml b/.woodpecker/compliance.yml new file mode 100644 index 0000000000..6077385b8c --- /dev/null +++ b/.woodpecker/compliance.yml @@ -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 diff --git a/.woodpecker/docker-linux-amd64-release-version.yml b/.woodpecker/docker-linux-amd64-release-version.yml new file mode 100644 index 0000000000..8d34e3f2b7 --- /dev/null +++ b/.woodpecker/docker-linux-amd64-release-version.yml @@ -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 diff --git a/.woodpecker/release-version.yml b/.woodpecker/release-version.yml new file mode 100644 index 0000000000..2267f3b2bb --- /dev/null +++ b/.woodpecker/release-version.yml @@ -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 diff --git a/.woodpecker/testing-amd64.yml b/.woodpecker/testing-amd64.yml new file mode 100644 index 0000000000..227c8be268 --- /dev/null +++ b/.woodpecker/testing-amd64.yml @@ -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' diff --git a/Dockerfile.tmp b/Dockerfile.tmp new file mode 100644 index 0000000000..32b6c1de5d --- /dev/null +++ b/Dockerfile.tmp @@ -0,0 +1,4 @@ +FROM golang:1.19-alpine3.16 + +RUN pwd + diff --git a/Makefile b/Makefile index 5bb297c317..67fe1a442e 100644 --- a/Makefile +++ b/Makefile @@ -733,7 +733,7 @@ $(EXECUTABLE): $(GO_SOURCES) $(TAGS_PREREQ) CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) build $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@ .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): mkdir -p $(DIST_DIRS)