mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-12 21:16:14 +01:00
Only run docker-dryrun
when necessary (#25329)
`docker-dryrun` runs on almost any PR, which is a huge waste of CI resources. Run it only when the Dockerfiles change and also add a step that verifies the rootless file. --------- Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
parent
f98ffff64a
commit
51c2aebe1f
2 changed files with 21 additions and 8 deletions
13
.github/workflows/files-changed.yml
vendored
13
.github/workflows/files-changed.yml
vendored
|
@ -4,24 +4,20 @@ on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
outputs:
|
outputs:
|
||||||
backend:
|
backend:
|
||||||
description: "whether backend files changed"
|
|
||||||
value: ${{ jobs.detect.outputs.backend }}
|
value: ${{ jobs.detect.outputs.backend }}
|
||||||
frontend:
|
frontend:
|
||||||
description: "whether frontend files changed"
|
|
||||||
value: ${{ jobs.detect.outputs.frontend }}
|
value: ${{ jobs.detect.outputs.frontend }}
|
||||||
docs:
|
docs:
|
||||||
description: "whether docs files changed"
|
|
||||||
value: ${{ jobs.detect.outputs.docs }}
|
value: ${{ jobs.detect.outputs.docs }}
|
||||||
actions:
|
actions:
|
||||||
description: "whether actions files changed"
|
|
||||||
value: ${{ jobs.detect.outputs.actions }}
|
value: ${{ jobs.detect.outputs.actions }}
|
||||||
templates:
|
templates:
|
||||||
description: "whether templates files changed"
|
|
||||||
value: ${{ jobs.detect.outputs.templates }}
|
value: ${{ jobs.detect.outputs.templates }}
|
||||||
|
docker:
|
||||||
|
value: ${{ jobs.detect.outputs.docker }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
detect:
|
detect:
|
||||||
name: detect which files changed
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 3
|
timeout-minutes: 3
|
||||||
# Map a step output to a job output
|
# Map a step output to a job output
|
||||||
|
@ -31,6 +27,7 @@ jobs:
|
||||||
docs: ${{ steps.changes.outputs.docs }}
|
docs: ${{ steps.changes.outputs.docs }}
|
||||||
actions: ${{ steps.changes.outputs.actions }}
|
actions: ${{ steps.changes.outputs.actions }}
|
||||||
templates: ${{ steps.changes.outputs.templates }}
|
templates: ${{ steps.changes.outputs.templates }}
|
||||||
|
docker: ${{ steps.changes.outputs.docker }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: dorny/paths-filter@v2
|
- uses: dorny/paths-filter@v2
|
||||||
|
@ -59,3 +56,7 @@ jobs:
|
||||||
templates:
|
templates:
|
||||||
- "templates/**/*.tmpl"
|
- "templates/**/*.tmpl"
|
||||||
- "poetry.lock"
|
- "poetry.lock"
|
||||||
|
docker:
|
||||||
|
- "Dockerfile"
|
||||||
|
- "Dockerfile.rootless"
|
||||||
|
- "docker/**"
|
||||||
|
|
16
.github/workflows/pull-docker-dryrun.yml
vendored
16
.github/workflows/pull-docker-dryrun.yml
vendored
|
@ -11,8 +11,8 @@ jobs:
|
||||||
files-changed:
|
files-changed:
|
||||||
uses: ./.github/workflows/files-changed.yml
|
uses: ./.github/workflows/files-changed.yml
|
||||||
|
|
||||||
docker-dryrun:
|
regular:
|
||||||
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true' || needs.files-changed.outputs.actions == 'true'
|
if: needs.files-changed.outputs.docker == 'true' || needs.files-changed.outputs.actions == 'true'
|
||||||
needs: files-changed
|
needs: files-changed
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
@ -21,3 +21,15 @@ jobs:
|
||||||
with:
|
with:
|
||||||
push: false
|
push: false
|
||||||
tags: gitea/gitea:linux-amd64
|
tags: gitea/gitea:linux-amd64
|
||||||
|
|
||||||
|
rootless:
|
||||||
|
if: needs.files-changed.outputs.docker == 'true' || needs.files-changed.outputs.actions == 'true'
|
||||||
|
needs: files-changed
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: docker/setup-buildx-action@v2
|
||||||
|
- uses: docker/build-push-action@v4
|
||||||
|
with:
|
||||||
|
push: false
|
||||||
|
file: Dockerfile.rootless
|
||||||
|
tags: gitea/gitea:linux-amd64
|
||||||
|
|
Loading…
Reference in a new issue