diff --git a/.github/workflows/codegen_image_cache.yml b/.github/workflows/codegen_image_cache.yml new file mode 100644 index 0000000000..83e3584435 --- /dev/null +++ b/.github/workflows/codegen_image_cache.yml @@ -0,0 +1,35 @@ +name: Codegen image cache + +# Seeds the buildkit cache for codegen.Dockerfile from main so pull request +# runs of generated_files.yml warm-start. PR-scoped cache writes are not +# readable by other PRs, so main is the only scope worth writing to. +on: + push: + branches: [main] + paths: + - 'codegen.Dockerfile' + - 'packages/connect-python/**' + - '.github/workflows/codegen_image_cache.yml' + workflow_dispatch: + +permissions: + contents: read + +jobs: + seed: + name: Seed codegen image cache + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build codegen image and export cache + uses: docker/build-push-action@v6 + with: + context: . + file: codegen.Dockerfile + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/generated_files.yml b/.github/workflows/generated_files.yml index 39d1a85dc7..772c48fda6 100644 --- a/.github/workflows/generated_files.yml +++ b/.github/workflows/generated_files.yml @@ -81,8 +81,10 @@ jobs: file: codegen.Dockerfile tags: codegen-env:latest load: true # makes the image available for `docker run` + # Cache is seeded from main by codegen_image_cache.yml. No cache-to + # here: PR-scoped writes are unreadable by other PRs and only fill + # the repo's 10 GB Actions cache, evicting other caches. cache-from: type=gha - cache-to: type=gha,mode=max - name: Run codegen run: CODEGEN_IMAGE=codegen-env:latest make codegen