aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2023-06-19 04:53:20 +0200
committerGitHub <noreply@github.com>2023-06-18 22:53:20 -0400
commit51c2aebe1f5124f1a93f7ccd082792c26e6da291 (patch)
tree96be42d068ebdff18b1d3979e127e7069c4b8400
parentf98ffff64a3c07d10c2ef2bcedfeb62495742af8 (diff)
downloadgitea-51c2aebe1f5124f1a93f7ccd082792c26e6da291.tar.gz
gitea-51c2aebe1f5124f1a93f7ccd082792c26e6da291.zip
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>
-rw-r--r--.github/workflows/files-changed.yml13
-rw-r--r--.github/workflows/pull-docker-dryrun.yml16
2 files changed, 21 insertions, 8 deletions
diff --git a/.github/workflows/files-changed.yml b/.github/workflows/files-changed.yml
index e209be8e8d..398fb6eae3 100644
--- a/.github/workflows/files-changed.yml
+++ b/.github/workflows/files-changed.yml
@@ -4,24 +4,20 @@ on:
workflow_call:
outputs:
backend:
- description: "whether backend files changed"
value: ${{ jobs.detect.outputs.backend }}
frontend:
- description: "whether frontend files changed"
value: ${{ jobs.detect.outputs.frontend }}
docs:
- description: "whether docs files changed"
value: ${{ jobs.detect.outputs.docs }}
actions:
- description: "whether actions files changed"
value: ${{ jobs.detect.outputs.actions }}
templates:
- description: "whether templates files changed"
value: ${{ jobs.detect.outputs.templates }}
+ docker:
+ value: ${{ jobs.detect.outputs.docker }}
jobs:
detect:
- name: detect which files changed
runs-on: ubuntu-latest
timeout-minutes: 3
# Map a step output to a job output
@@ -31,6 +27,7 @@ jobs:
docs: ${{ steps.changes.outputs.docs }}
actions: ${{ steps.changes.outputs.actions }}
templates: ${{ steps.changes.outputs.templates }}
+ docker: ${{ steps.changes.outputs.docker }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
@@ -59,3 +56,7 @@ jobs:
templates:
- "templates/**/*.tmpl"
- "poetry.lock"
+ docker:
+ - "Dockerfile"
+ - "Dockerfile.rootless"
+ - "docker/**"
diff --git a/.github/workflows/pull-docker-dryrun.yml b/.github/workflows/pull-docker-dryrun.yml
index 916de6b27d..61f1fd5632 100644
--- a/.github/workflows/pull-docker-dryrun.yml
+++ b/.github/workflows/pull-docker-dryrun.yml
@@ -11,8 +11,8 @@ jobs:
files-changed:
uses: ./.github/workflows/files-changed.yml
- docker-dryrun:
- if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true' || needs.files-changed.outputs.actions == 'true'
+ regular:
+ if: needs.files-changed.outputs.docker == 'true' || needs.files-changed.outputs.actions == 'true'
needs: files-changed
runs-on: ubuntu-latest
steps:
@@ -21,3 +21,15 @@ jobs:
with:
push: false
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