diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9ff986e548b3..7c55c88cc9ad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,28 +14,57 @@ concurrency: cancel-in-progress: true jobs: build: - if: github.repository == 'pypi/warehouse' - runs-on: depot-ubuntu-24.04-arm + runs-on: ubuntu-24.04-arm outputs: - buildId: ${{ steps.build.outputs.build-id}} + buildId: ${{ github.run_id }} permissions: - id-token: write + packages: write steps: - name: Check out repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: persist-credentials: false - - name: Set up Depot CLI - uses: depot/setup-action@b0b1ea4f69e92ebf5dea3f8713a1b0c37b2126a5 # v1.6.0 - - name: Build image - id: build - uses: depot/build-push-action@2583627a84956d07561420dcc1d0eb1f2af3fac0 # v1.15.0 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0 + - name: Cache + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 # zizmor: ignore[cache-poisoning] + id: cache with: - save: true + path: | + var-cache-apt + var-lib-apt + root-cache-pip + root-npm + key: cache-${{ hashFiles('Dockerfile') }} + - name: inject cache into docker + uses: reproducible-containers/buildkit-cache-dance@653a570f730e3b9460adc576db523788ba59a0d7 # v3.2.0 + with: + cache-map: | + { + "var-cache-apt": "/var/cache/apt", + "var-lib-apt": "/var/lib/apt", + "root-cache-pip": "/root/.cache/pip", + "root-npm": "/root/.npm" + } + skip-extraction: ${{ steps.cache.outputs.cache-hit }} + - name: Login To GHCR + uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@14487ce63c7a62a4a324b0bfb37086795e31c6c1 # v6.16.0 + with: + context: . + cache-from: type=gha + cache-to: type=gha,mode=max + push: true build-args: | DEVEL=yes CI=yes - tags: pypi/warehouse:ci-${{ github.run_id }} + tags: | + ghcr.io/pypi/warehouse:ci-${{ github.run_id }} test: # Time out if our test suite has gotten hung timeout-minutes: 15 @@ -45,10 +74,8 @@ jobs: include: - name: Tests command: bin/tests --postgresql-host postgres - runs_on: depot-ubuntu-24.04-arm-4 - name: Lint command: bin/lint - runs_on: depot-ubuntu-24.04-arm-4 - name: User Documentation command: bin/user-docs - name: Developer Documentation @@ -59,13 +86,13 @@ jobs: command: bin/licenses - name: Translations command: bin/translations - runs-on: ${{ (matrix.runs_on != null) && matrix.runs_on || 'depot-ubuntu-24.04-arm' }} + runs-on: ubuntu-24.04-arm container: - image: registry.depot.dev/rltf7cln5v:${{ needs.build.outputs.buildId }} + image: ghcr.io/pypi/warehouse:ci-${{ needs.build.outputs.buildId }} env: BILLING_BACKEND: warehouse.subscriptions.services.MockStripeBillingService api_base=http://stripe:12111 api_version=2020-08-27 permissions: - id-token: write + packages: read services: postgres: image: ${{ (matrix.name == 'Tests') && 'postgres:17.5' || '' }} @@ -103,12 +130,12 @@ jobs: check_db: name: Check Database Consistency needs: build - runs-on: depot-ubuntu-24.04-arm + runs-on: ubuntu-24.04-arm continue-on-error: true container: - image: registry.depot.dev/rltf7cln5v:${{ needs.build.outputs.buildId }} + image: ghcr.io/pypi/warehouse:ci-${{ needs.build.outputs.buildId }} permissions: - id-token: write + packages: read services: postgres: image: postgres:17.5 diff --git a/Dockerfile b/Dockerfile index fedfcb836f09..c1b0e287460a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -184,8 +184,8 @@ RUN --mount=type=cache,target=/root/.cache/pip \ FROM python:${PYTHON_IMAGE_VERSION} # Setup some basic environment variables that are ~never going to change. -ENV PYTHONUNBUFFERED 1 -ENV PYTHONPATH /opt/warehouse/src/ +ENV PYTHONUNBUFFERED=1 +ENV PYTHONPATH=/opt/warehouse/src/ ENV PATH="/opt/warehouse/bin:${PATH}" WORKDIR /opt/warehouse/src/