Skip to content

Build ./duvrc.sh Cache Image #74

Build ./duvrc.sh Cache Image

Build ./duvrc.sh Cache Image #74

name: Build ./duvrc.sh Cache Image
on:
schedule:
# 2:00 AM US-Pacific on Wednesdays
- cron: '0 9 * * 3'
workflow_dispatch:
inputs:
seed:
required: false
default: true
type: boolean
description: Seed the cache from the prior image.
defaults:
run:
shell: bash
env:
# We fetch Windows script executable stubs when building Pex.
_PEX_FETCH_WINDOWS_STUBS_BEARER: ${{ secrets.GITHUB_TOKEN }}
# These timeouts help with flaky CI / oversubscription issues.
_PEX_HTTP_SERVER_TIMEOUT: 30
_PEX_PEXPECT_TIMEOUT: 10
# We have integration tests that exercise `--scie` support and these can trigger downloads from
# GitHub Releases that need elevated rate limit quota, which this gives.
SCIENCE_AUTH_API_GITHUB_COM_BEARER: ${{ secrets.GITHUB_TOKEN }}
# We have integration tests that exercise `--scie` support and these can trigger downloads from
# GitHub Releases that can be slow which this timeout accounts for.
SCIENCE_NET_TIMEOUT: 30.0
jobs:
org-check:
name: Check GitHub Organization
if: ${{ github.repository_owner == 'pex-tool' }}
runs-on: ubuntu-slim
steps:
- name: Noop
if: false
run: |
echo "This is a dummy step that will never run."
setup-matrix:
runs-on: ubuntu-slim
needs: org-check
steps:
- name: Checkout Pex
uses: actions/checkout@v4
- name: Setup Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Setup matrix combinations
id: setup-test-cmds
run: |
echo test-cmds="$(
uv -q run dev-cmd -q build-cache-image -- --list-test-cmds | \
jq -R . | jq -src .
)" >> "$GITHUB_OUTPUT"
outputs:
test-cmds: ${{ steps.setup-test-cmds.outputs.test-cmds }}
build-cache-images:
name: Build ./duvrc.sh Cache for ${{ matrix.test-cmd }}
needs: setup-matrix
runs-on: ubuntu-24.04
strategy:
matrix:
test-cmd: ${{ fromJson(needs.setup-matrix.outputs.test-cmds) }}
steps:
- name: Free Up Disk Space
uses: jlumbroso/free-disk-space@v1.3.1
with:
android: true # ~14GB
dotnet: true # ~2GB
tool-cache: true # ~12GB
# Too little space savings or too slow.
haskell: false
large-packages: false
docker-images: false
swap-storage: false
- name: Checkout Pex
uses: actions/checkout@v4
- name: Setup Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Build & Export Cache Image for ${{ matrix.test-cmd }}
run: |
uv run dev-cmd build-cache-image -- \
--color \
--build-style build \
${{ inputs.seed && '--seed' || '--no-seed' }} \
--dist-dir export \
--post-action export \
--test-cmd ${{ matrix.test-cmd }}
- uses: actions/upload-artifact@v4
with:
path: |
export/*.tar
.gitignore
name: 'cache-${{ matrix.test-cmd }}'
build-cache-image:
name: Merge and push unified ./duvrc.sh Cache Image
runs-on: ubuntu-24.04
needs: build-cache-images
steps:
- name: Free Up Disk Space
uses: jlumbroso/free-disk-space@v1.3.1
with:
android: true # ~14GB
dotnet: true # ~2GB
tool-cache: true # ~12GB
# Too little space savings or too slow.
haskell: false
large-packages: false
docker-images: false
swap-storage: false
- name: Checkout Pex
uses: actions/checkout@v4
- name: Setup Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install uv
uses: astral-sh/setup-uv@v5
- uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Merge & Push Cache Image
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | \
docker login ghcr.io -u ${{ github.actor }} --password-stdin
uv run dev-cmd build-cache-image -- \
--color \
--build-style merge \
--dist-dir export \
--post-action push