diff options
| author | 2025-04-27 11:22:35 +0000 | |
|---|---|---|
| committer | 2025-04-27 11:22:35 +0000 | |
| commit | 5bfccdad3c3f7cd768992e63e6f7fcc4298a9e64 (patch) | |
| tree | 716063de33340eab68538cb0c8f883b23155b0c2 /.woodpecker | |
| parent | [chore] Fix daenney being bad at sed (#4060) (diff) | |
| download | gotosocial-5bfccdad3c3f7cd768992e63e6f7fcc4298a9e64.tar.xz | |
[chore] add woodpecker ci/cd pipelines (#4061)
Removes our now unused drone stuff and adds pipelines for our new woodpecker instance.
Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4061
Co-authored-by: tobi <tobi.smethurst@protonmail.com>
Co-committed-by: tobi <tobi.smethurst@protonmail.com>
Diffstat (limited to '.woodpecker')
| -rw-r--r-- | .woodpecker/pr.yaml | 98 | ||||
| -rw-r--r-- | .woodpecker/release.yaml | 41 | ||||
| -rw-r--r-- | .woodpecker/snapshot.yaml | 47 |
3 files changed, 186 insertions, 0 deletions
diff --git a/.woodpecker/pr.yaml b/.woodpecker/pr.yaml new file mode 100644 index 000000000..18b96708d --- /dev/null +++ b/.woodpecker/pr.yaml @@ -0,0 +1,98 @@ +# https://woodpecker-ci.org/docs/usage/workflow-syntax#when---global-workflow-conditions +when: + - event: pull_request + +steps: + # Lint the Go code. + lint: + # We use golangci-lint for linting. + # See: https://golangci-lint.run/ + image: golangci/golangci-lint:v1.62.0 + pull: true + + # https://woodpecker-ci.org/docs/administration/configuration/backends/docker#run-user + backend_options: + docker: + user: 1000:1000 + + # https://woodpecker-ci.org/docs/usage/volumes + volumes: + - /woodpecker/gotosocial/go-build-cache:/.cache/go-build + - /woodpecker/gotosocial/go-pkg-cache:/go/pkg + - /woodpecker/gotosocial/golangci-lint-cache:/.cache/golangci-lint + + # https://woodpecker-ci.org/docs/usage/environment + environment: + GOFLAGS: "-buildvcs=false" + + # https://woodpecker-ci.org/docs/usage/workflow-syntax#commands + commands: + - golangci-lint run + + # Test the Go code. + test: + image: golang:1.23-alpine + pull: true + + # https://woodpecker-ci.org/docs/administration/configuration/backends/docker#run-user + backend_options: + docker: + user: 1000:1000 + + # https://woodpecker-ci.org/docs/usage/volumes + volumes: + - /woodpecker/gotosocial/go-build-cache:/.cache/go-build + - /woodpecker/gotosocial/go-pkg-cache:/go/pkg + - /woodpecker/gotosocial/wazero-compilation-cache:/.cache/wazero + - /woodpecker/gotosocial/test-tmp:/tmp + + # https://woodpecker-ci.org/docs/usage/environment + environment: + CGO_ENABLED: "0" + GTS_WAZERO_COMPILATION_CACHE: "/.cache/wazero" + + # https://woodpecker-ci.org/docs/usage/workflow-syntax#commands + commands: + - >- + go test + -ldflags="-s -w -extldflags '-static'" + -tags="netgo osusergo static_build kvformat timetzdata" + -failfast + -timeout=30m + ./... + - ./test/envparsing.sh + - ./test/swagger.sh + + # https://woodpecker-ci.org/docs/usage/workflow-syntax#depends_on + depends_on: [lint] + + # Validate the web code. + web: + image: node:lts-alpine + pull: true + + # https://woodpecker-ci.org/docs/administration/configuration/backends/docker#run-user + backend_options: + docker: + user: 1000:1000 + + # https://woodpecker-ci.org/docs/usage/volumes + volumes: + - /woodpecker/gotosocial/node_modules:/woodpecker/src/codeberg.org/superseriousbusiness/gotosocial/web/source/node_modules + - /woodpecker/gotosocial/yarn-cache:/.cache/yarn + - /woodpecker/gotosocial/web-dist-test:/woodpecker/src/codeberg.org/superseriousbusiness/gotosocial/web/assets/dist + + # https://woodpecker-ci.org/docs/usage/workflow-syntax#commands + commands: + # Install web dependencies. + - yarn --cwd ./web/source install --frozen-lockfile --cache-folder /.cache/yarn + - yarn --cwd ./web/source ts-patch install # https://typia.io/docs/setup/#manual-setup + + # Lint web source. + - yarn --cwd ./web/source lint + + # Ensure build works. + - yarn --cwd ./web/source build + + # https://woodpecker-ci.org/docs/usage/workflow-syntax#depends_on + depends_on: [test] diff --git a/.woodpecker/release.yaml b/.woodpecker/release.yaml new file mode 100644 index 000000000..8a2e2c3d7 --- /dev/null +++ b/.woodpecker/release.yaml @@ -0,0 +1,41 @@ +# https://woodpecker-ci.org/docs/usage/workflow-syntax#when---global-workflow-conditions +when: + - event: push + branch: main + +steps: + release: + # https://github.com/superseriousbusiness/gotosocial-drone-build + image: superseriousbusiness/gotosocial-drone-build:0.8.0 + pull: true + + # https://woodpecker-ci.org/docs/usage/volumes + volumes: + - /woodpecker/gotosocial/go-build-cache-root:/root/.cache/go-build + - /woodpecker/gotosocial/go-pkg-cache-root:/go/pkg + - /var/run/docker.sock:/var/run/docker.sock + + # https://woodpecker-ci.org/docs/usage/environment + # https://woodpecker-ci.org/docs/usage/secrets#usage + environment: + DOCKER_USERNAME: gotosocial + DOCKER_PASSWORD: + from_secret: gts_docker_password + GITHUB_TOKEN: + from_secret: github_token + + # https://woodpecker-ci.org/docs/usage/workflow-syntax#commands + commands: + - git fetch --tags + - /go/dockerlogin.sh + + # When releasing, compare commits to the most recent tag that is not the + # current one AND is not a release candidate tag (ie., no "rc" in the name). + # + # The DRONE_TAG env var should point to the tag that triggered this build. + # See: https://docs.drone.io/pipeline/environment/reference/drone-tag/ + # + # Note, this may cause annoyances when doing backport releases, for example, + # releasing v0.10.1 when we've already released v0.15.0 or whatever, but + # they should only be superficial annoyances related to the release notes. + - GORELEASER_PREVIOUS_TAG=$(git tag -l | grep -v "rc\|${DRONE_TAG}" | sort -V -r | head -n 1) goreleaser release --clean diff --git a/.woodpecker/snapshot.yaml b/.woodpecker/snapshot.yaml new file mode 100644 index 000000000..b268f0ce2 --- /dev/null +++ b/.woodpecker/snapshot.yaml @@ -0,0 +1,47 @@ +# https://woodpecker-ci.org/docs/usage/workflow-syntax#when---global-workflow-conditions +when: + - event: tag + +steps: + snapshot: + # https://github.com/superseriousbusiness/gotosocial-drone-build + image: superseriousbusiness/gotosocial-drone-build:0.8.0 + pull: true + + # https://woodpecker-ci.org/docs/usage/volumes + volumes: + - /woodpecker/gotosocial/go-build-cache-root:/root/.cache/go-build + - /woodpecker/gotosocial/go-pkg-cache-root:/go/pkg + - /var/run/docker.sock:/var/run/docker.sock + + # https://woodpecker-ci.org/docs/usage/environment + # https://woodpecker-ci.org/docs/usage/secrets#usage + environment: + DOCKER_USERNAME: gotosocial + DOCKER_PASSWORD: + from_secret: gts_docker_password + S3_ACCESS_KEY_ID: + from_secret: gts_s3_access_key_id + S3_SECRET_ACCESS_KEY: + from_secret: gts_s3_secret_access_key + S3_HOSTNAME: "https://s3.superseriousbusiness.org" + S3_BUCKET_NAME: "gotosocial-snapshots" + + # https://woodpecker-ci.org/docs/usage/workflow-syntax#commands + commands: + # Create a snapshot build with GoReleaser. + - git fetch --tags + - goreleaser release --clean --snapshot + + # Login to Docker, push Docker image snapshots + manifests. + - /go/dockerlogin.sh + - docker push superseriousbusiness/gotosocial:snapshot-arm64v8 + - docker push superseriousbusiness/gotosocial:snapshot-amd64 + - | + docker manifest create superseriousbusiness/gotosocial:snapshot \ + superseriousbusiness/gotosocial:snapshot-amd64 \ + superseriousbusiness/gotosocial:snapshot-arm64v8 + - docker manifest push superseriousbusiness/gotosocial:snapshot + + # Publish binary .tar.gz snapshots to S3. + - /go/snapshot_publish.sh |
