mirror of https://github.com/go-gitea/gitea.git
Use file filters action instead of Github's files filter (#24877)
Inspired by https://github.com/go-gitea/gitea/pull/24530#issuecomment-1558815301 This PR use a file filter action to do different CI jobs according changed files types. All types are defined in `.github/file-filters.yml`. Now there are 4 types, `docs`, `backend`, `frontend` and `build`. Then if a PR only changed docs files, those CI jobs which passed the conditions will run, and other types are also like this. --------- Co-authored-by: silverwind <me@silverwind.io>pull/24481/head^2
parent
d7e669c371
commit
93c6a9a652
@ -0,0 +1,15 @@
|
|||||||
|
docs: &docs
|
||||||
|
- "**/*.md"
|
||||||
|
- "docs/**"
|
||||||
|
|
||||||
|
backend: &backend
|
||||||
|
- "**/*.go"
|
||||||
|
- "**/*.tmpl"
|
||||||
|
- "go.mod"
|
||||||
|
- "go.sum"
|
||||||
|
|
||||||
|
frontend: &frontend
|
||||||
|
- "**/*.js"
|
||||||
|
- "web_src/**"
|
||||||
|
- "package.json"
|
||||||
|
- "package-lock.json"
|
@ -0,0 +1,32 @@
|
|||||||
|
name: files changed
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
outputs:
|
||||||
|
docs:
|
||||||
|
description: "whether docs files changed"
|
||||||
|
value: ${{ jobs.files-changed.outputs.docs }}
|
||||||
|
backend:
|
||||||
|
description: "whether backend files changed"
|
||||||
|
value: ${{ jobs.files-changed.outputs.backend }}
|
||||||
|
frontend:
|
||||||
|
description: "whether frontend files changed"
|
||||||
|
value: ${{ jobs.files-changed.outputs.frontend }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
files-changed:
|
||||||
|
name: detect which files changed
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 3
|
||||||
|
# Map a step output to a job output
|
||||||
|
outputs:
|
||||||
|
docs: ${{ steps.changes.outputs.docs }}
|
||||||
|
backend: ${{ steps.changes.outputs.backend }}
|
||||||
|
frontend: ${{ steps.changes.outputs.frontend }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Check for backend file changes
|
||||||
|
uses: dorny/paths-filter@v2
|
||||||
|
id: changes
|
||||||
|
with:
|
||||||
|
filters: .github/file-filters.yml
|
@ -1,43 +0,0 @@
|
|||||||
name: compliance
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
paths:
|
|
||||||
- "docs/**"
|
|
||||||
- "*.md"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
compliance-docs:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- run: echo "No build required"
|
|
||||||
|
|
||||||
lint-backend:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- run: echo "No build required"
|
|
||||||
|
|
||||||
lint-go-windows:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- run: echo "No build required"
|
|
||||||
|
|
||||||
lint-go-gogit:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- run: echo "No build required"
|
|
||||||
|
|
||||||
checks-backend:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- run: echo "No build required"
|
|
||||||
|
|
||||||
frontend:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- run: echo "No build required"
|
|
||||||
|
|
||||||
backend:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- run: echo "No build required"
|
|
@ -1,38 +0,0 @@
|
|||||||
name: db-tests
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
paths:
|
|
||||||
- "docs/**"
|
|
||||||
- "*.md"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test-pgsql:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- run: echo "No build required"
|
|
||||||
|
|
||||||
test-sqlite:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- run: echo "No build required"
|
|
||||||
|
|
||||||
test-unit:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- run: echo "No build required"
|
|
||||||
|
|
||||||
test-mysql5:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- run: echo "No build required"
|
|
||||||
|
|
||||||
test-mysql8:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- run: echo "No build required"
|
|
||||||
|
|
||||||
test-mssql:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- run: echo "No build required"
|
|
@ -1,13 +0,0 @@
|
|||||||
name: docker-dryrun
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
paths:
|
|
||||||
- "docs/**"
|
|
||||||
- "*.md"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
docker-dryrun:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- run: echo "No build required"
|
|
@ -1,13 +0,0 @@
|
|||||||
name: e2e-tests
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
paths:
|
|
||||||
- "docs/**"
|
|
||||||
- "*.md"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test-e2e:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- run: echo "No build required"
|
|
Loading…
Reference in New Issue