summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar tobi <tobi.smethurst@protonmail.com>2025-05-04 07:58:17 +0000
committerLibravatar tobi <kipvandenbos@noreply.codeberg.org>2025-05-04 07:58:17 +0000
commit056c67f396aef017535cb8ad4c0bc5eac07ed640 (patch)
treece1fdcf4dbfc85042a93aca55d964cf31a379118
parent[chore] more NoLLaMas proof-of-work tweaking (#4096) (diff)
downloadgotosocial-056c67f396aef017535cb8ad4c0bc5eac07ed640.tar.xz
[chore/cicd] Account for force pushes in conditional runs (#4121)
CI_PIPELINE_FILES seems to be empty on force pushes to an open pull request, so this PR just accounts for that and runs all steps if it's the case, as we can't tell then what's actually changed. Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4121 Co-authored-by: tobi <tobi.smethurst@protonmail.com> Co-committed-by: tobi <tobi.smethurst@protonmail.com>
-rw-r--r--.woodpecker/pr.yaml39
-rw-r--r--.woodpecker/snapshot.yaml15
2 files changed, 50 insertions, 4 deletions
diff --git a/.woodpecker/pr.yaml b/.woodpecker/pr.yaml
index e116d3e20..78c7ccc43 100644
--- a/.woodpecker/pr.yaml
+++ b/.woodpecker/pr.yaml
@@ -5,11 +5,23 @@ when:
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)) || any(fromJSON(CI_PIPELINE_FILES), { # startsWith "internal/" || # startsWith "cmd/" || # startsWith "testrig/" || # startsWith "vendor/" })'
+ - evaluate: >-
+ (not ("CI_PIPELINE_FILES" in $env)) ||
+ len(CI_PIPELINE_FILES) == 0 ||
+ any(fromJSON(CI_PIPELINE_FILES), {
+ # startsWith "internal/" ||
+ # startsWith "cmd/" ||
+ # startsWith "testrig/"
+ })
# We use golangci-lint for linting.
# See: https://golangci-lint.run/
@@ -37,11 +49,24 @@ steps:
# 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)) || any(fromJSON(CI_PIPELINE_FILES), { # startsWith "internal/" || # startsWith "cmd/" || # startsWith "testrig/" || # startsWith "vendor/" })'
+ - evaluate: >-
+ (not ("CI_PIPELINE_FILES" in $env)) ||
+ len(CI_PIPELINE_FILES) == 0 ||
+ any(fromJSON(CI_PIPELINE_FILES), {
+ # startsWith "internal/" ||
+ # startsWith "cmd/" ||
+ # startsWith "testrig/" ||
+ # startsWith "vendor/"
+ })
image: golang:1.23-alpine
pull: true
@@ -80,11 +105,19 @@ steps:
# 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)) || any(fromJSON(CI_PIPELINE_FILES), { # startsWith "web/source/" })'
+ - evaluate: >-
+ (not ("CI_PIPELINE_FILES" in $env)) ||
+ len(CI_PIPELINE_FILES) == 0 ||
+ any(fromJSON(CI_PIPELINE_FILES), { # startsWith "web/source/" })
image: node:lts-alpine
pull: true
diff --git a/.woodpecker/snapshot.yaml b/.woodpecker/snapshot.yaml
index bfa0efcb5..fe28814ab 100644
--- a/.woodpecker/snapshot.yaml
+++ b/.woodpecker/snapshot.yaml
@@ -15,10 +15,23 @@ steps:
snapshot:
# Snapshot only if some interesting
# source code files have changed.
+ #
+ # CI_PIPELINE_FILES is undefined if
+ # files changed > 500, so account for
+ # this and snapshot anyway if so.
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/" || # startsWith "web/" || # == "Dockerfile" })'
+ - evaluate: >-
+ (not ("CI_PIPELINE_FILES" in $env)) ||
+ any(fromJSON(CI_PIPELINE_FILES), {
+ # startsWith "internal/" ||
+ # startsWith "cmd/" ||
+ # startsWith "testrig/" ||
+ # startsWith "vendor/" ||
+ # startsWith "web/" ||
+ # == "Dockerfile"
+ })
# https://codeberg.org/superseriousbusiness/gotosocial-woodpecker-build
image: superseriousbusiness/gotosocial-woodpecker-build:0.10.0