summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar tobi <tobi.smethurst@protonmail.com>2025-05-02 20:26:09 +0000
committerLibravatar tobi <kipvandenbos@noreply.codeberg.org>2025-05-02 20:26:09 +0000
commitbf10ca0203e9abcd6a022ee444c8815a3d66899a (patch)
treef0aa8d4dfb97ab542367df8ef2231ac65e4ece18
parent[bugfix/chore] Invalidate prepared statuses when account representation chang... (diff)
downloadgotosocial-bf10ca0203e9abcd6a022ee444c8815a3d66899a.tar.xz
[chore/cicd] conditional tests + linting for pull requests (#4114)
Closes https://codeberg.org/superseriousbusiness/gotosocial/issues/4113 Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4114 Co-authored-by: tobi <tobi.smethurst@protonmail.com> Co-committed-by: tobi <tobi.smethurst@protonmail.com>
-rw-r--r--.woodpecker/pr.yaml27
1 files changed, 21 insertions, 6 deletions
diff --git a/.woodpecker/pr.yaml b/.woodpecker/pr.yaml
index 18b96708d..e116d3e20 100644
--- a/.woodpecker/pr.yaml
+++ b/.woodpecker/pr.yaml
@@ -3,8 +3,14 @@ when:
- event: pull_request
steps:
- # Lint the Go code.
+ # Lint the Go code only if
+ # some Go files have changed.
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)) || any(fromJSON(CI_PIPELINE_FILES), { # startsWith "internal/" || # startsWith "cmd/" || # startsWith "testrig/" || # startsWith "vendor/" })'
+
# We use golangci-lint for linting.
# See: https://golangci-lint.run/
image: golangci/golangci-lint:v1.62.0
@@ -29,8 +35,14 @@ steps:
commands:
- golangci-lint run
- # Test the Go code.
+ # Test the Go code only if
+ # some Go files have changed.
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)) || any(fromJSON(CI_PIPELINE_FILES), { # startsWith "internal/" || # startsWith "cmd/" || # startsWith "testrig/" || # startsWith "vendor/" })'
+
image: golang:1.23-alpine
pull: true
@@ -66,8 +78,14 @@ steps:
# https://woodpecker-ci.org/docs/usage/workflow-syntax#depends_on
depends_on: [lint]
- # Validate the web code.
+ # Validate the web code only
+ # if web source has changed.
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)) || any(fromJSON(CI_PIPELINE_FILES), { # startsWith "web/source/" })'
+
image: node:lts-alpine
pull: true
@@ -93,6 +111,3 @@ steps:
# Ensure build works.
- yarn --cwd ./web/source build
-
- # https://woodpecker-ci.org/docs/usage/workflow-syntax#depends_on
- depends_on: [test]