Skip to content

Commit

Permalink
feat: utilize uv CI cache
Browse files Browse the repository at this point in the history
This removes need to build binary wheels repeatedly.

Fixes WeblateOrg#2588
  • Loading branch information
nijel committed Nov 5, 2024
1 parent 624d714 commit 6bb853e
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 4 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/bleeding.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,20 @@ jobs:
run: .github/bin/bleeding ${{needs.bleeding.outputs.weblate_sha}} ${{needs.bleeding.outputs.weblate_date}}
- name: Configure Docker build
run: .github/bin/get-buildx-args
- name: Cache
uses: actions/cache@v3
id: cache
with:
path: uv-cache
key: uv-cache-${{ hashFiles('Dockerfile') }}-${{ matrix.architecture }}
- name: inject cache into docker
uses: reproducible-containers/[email protected]
with:
cache-map: |
{
"uv-cache": "/root/.cache"
}
skip-extraction: ${{ steps.cache.outputs.cache-hit }}
- name: Build the Docker image
run: .github/bin/docker-build

Expand Down Expand Up @@ -80,6 +94,20 @@ jobs:
run: .github/bin/bleeding ${{needs.bleeding.outputs.weblate_sha}} ${{needs.bleeding.outputs.weblate_date}}
- name: Configure Docker build
run: .github/bin/get-buildx-args
- name: Cache
uses: actions/cache@v3
id: cache
with:
path: uv-cache
key: uv-cache-${{ hashFiles('Dockerfile') }}-${{ matrix.architecture }}
- name: inject cache into docker
uses: reproducible-containers/[email protected]
with:
cache-map: |
{
"uv-cache": "/root/.cache"
}
skip-extraction: ${{ steps.cache.outputs.cache-hit }}
- name: Build the Docker image
run: .github/bin/docker-build

Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/dockerimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@ jobs:
version: v0.18.0
- name: Configure Docker build
run: .github/bin/get-buildx-args
- name: Cache
uses: actions/cache@v3
id: cache
with:
path: uv-cache
key: uv-cache-${{ hashFiles('Dockerfile') }}-${{ matrix.architecture }}
- name: inject cache into docker
uses: reproducible-containers/[email protected]
with:
cache-map: |
{
"uv-cache": "/root/.cache"
}
skip-extraction: ${{ steps.cache.outputs.cache-hit }}
- name: Build the Docker image
run: .github/bin/docker-build

Expand Down Expand Up @@ -62,6 +76,20 @@ jobs:
version: v0.18.0
- name: Configure Docker build
run: .github/bin/get-buildx-args
- name: Cache
uses: actions/cache@v3
id: cache
with:
path: uv-cache
key: uv-cache-${{ hashFiles('Dockerfile') }}-${{ matrix.architecture }}
- name: inject cache into docker
uses: reproducible-containers/[email protected]
with:
cache-map: |
{
"uv-cache": "/root/.cache"
}
skip-extraction: ${{ steps.cache.outputs.cache-hit }}
- name: Build the Docker image
run: .github/bin/docker-build

Expand Down
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ COPY --link requirements.txt patches /app/src/

# Install dependencies
# hadolint ignore=DL3008,DL3013,SC2046,DL3003
RUN \
RUN --mount=type=cache,target=/root/.cache \
uv venv /app/venv \
&& . /app/venv/bin/activate \
&& case "$WEBLATE_VERSION" in \
*+* ) \
uv pip install \
--no-cache-dir \
--compile-bytecode \
-r /app/src/requirements.txt \
"https://github.com/translate/translate/archive/master.zip" \
Expand All @@ -26,12 +25,12 @@ RUN \
;; \
* ) \
uv pip install \
--no-cache-dir \
--compile-bytecode \
-r /app/src/requirements.txt \
"Weblate[$WEBLATE_EXTRAS]==$WEBLATE_VERSION" \
;; \
esac
esac \
&& uv cache prune --ci
RUN /app/venv/bin/python -c 'from phply.phpparse import make_parser; make_parser()'
RUN ln -s /app/venv/share/weblate/examples/ /app/

Expand Down

0 comments on commit 6bb853e

Please sign in to comment.