mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[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>
This commit is contained in:
@@ -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]
|
||||
|
Reference in New Issue
Block a user