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