# https://woodpecker-ci.org/docs/usage/workflow-syntax#when---global-workflow-conditions when: - event: pull_request steps: # Lint the Go code only if # some Go files have changed. # # CI_PIPELINE_FILES is undefined if # files changed > 500, and empty on # force pushes, so account for this # and run step to be safe. lint: when: # https://woodpecker-ci.org/docs/usage/workflow-syntax#evaluate # https://woodpecker-ci.org/docs/usage/environment#built-in-environment-variables - evaluate: >- (not ("CI_PIPELINE_FILES" in $env)) || CI_PIPELINE_FILES == "[]" || any(fromJSON(CI_PIPELINE_FILES), { # startsWith "internal/" || # startsWith "cmd/" || # startsWith "testrig/" }) || len(fromJSON(CI_PIPELINE_FILES)) == 0 # We use golangci-lint for linting. # See: https://golangci-lint.run/ image: golangci/golangci-lint:v1.64.8 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 only if # some Go files have changed. # # CI_PIPELINE_FILES is undefined if # files changed > 500, and empty on # force pushes, so account for this # and run step to be safe. test: when: # https://woodpecker-ci.org/docs/usage/workflow-syntax#evaluate # https://woodpecker-ci.org/docs/usage/environment#built-in-environment-variables - evaluate: >- (not ("CI_PIPELINE_FILES" in $env)) || CI_PIPELINE_FILES == "[]" || any(fromJSON(CI_PIPELINE_FILES), { # startsWith "internal/" || # startsWith "cmd/" || # startsWith "testrig/" || # startsWith "vendor/" }) || len(fromJSON(CI_PIPELINE_FILES)) == 0 image: golang:1.24-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 # Validate the web code only # if web source has changed. # # CI_PIPELINE_FILES is undefined if # files changed > 500, and empty on # force pushes, so account for this # and run step to be safe. web: when: # https://woodpecker-ci.org/docs/usage/workflow-syntax#evaluate # https://woodpecker-ci.org/docs/usage/environment#built-in-environment-variables - evaluate: >- (not ("CI_PIPELINE_FILES" in $env)) || CI_PIPELINE_FILES == "[]" || any(fromJSON(CI_PIPELINE_FILES), { # startsWith "web/source/" }) || len(fromJSON(CI_PIPELINE_FILES)) == 0 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