Skip to content

Build ./dtox.sh Cache Image #9

Build ./dtox.sh Cache Image

Build ./dtox.sh Cache Image #9

name: Build ./dtox.sh Cache Image
on:
schedule:
# 2:00 AM US-Pacific on Wednesdays
- cron: '0 9 * * 3'
workflow_dispatch:
defaults:
run:
shell: bash
env:
SCIENCE_AUTH_API_GITHUB_COM_BEARER: ${{ secrets.GITHUB_TOKEN }}
jobs:
org-check:
name: Check GitHub Organization
if: ${{ github.repository_owner == 'pex-tool' }}
runs-on: ubuntu-24.04
steps:
- name: Noop
if: false
run: |
echo "This is a dummy step that will never run."
setup-matrix:
runs-on: ubuntu-24.04
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: Setup matrix combinations
id: setup-matrix-combinations
run: |
echo ::set-output name=matrix-combinations::$(
tox -qqe build-cache-image -- --list-tox-envs | \
grep -vE "^$" | \
jq -R '{"tox-env":.}' | jq -src '{"include":.}'
)
outputs:
matrix-combinations: ${{ steps.setup-matrix-combinations.outputs.matrix-combinations }}
build-cache-images:
name: Build ./dtox.sh Cache for ${{ matrix.tox-env }}
needs: setup-matrix
runs-on: ubuntu-24.04
strategy:
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix-combinations) }}
steps:
- name: Checkout Pex
uses: actions/checkout@v4
- name: Setup Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Build & Export Cache Image for ${{ matrix.tox-env }}
run: |
python -mvenv .venv
source .venv/bin/activate
python -V
pip install -U pip
pip -V
pip install tox
tox --version
tox -e build-cache-image -- \
--color \
--build-style build \
--dist-dir export \
--post-action export \
--tox-env ${{ matrix.tox-env }}
- uses: actions/upload-artifact@v4
with:
path: |
export/*.tar
.gitignore
name: 'cache-${{ matrix.tox-env }}'
build-cache-image:
name: Merge and push unified ./dtox.sh Cache Image
runs-on: ubuntu-24.04
needs: build-cache-images
steps:
- name: Checkout Pex
uses: actions/checkout@v4
- name: Setup Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Merge & Push Cache Image
run: |
python -mvenv .venv
source .venv/bin/activate
python -V
pip install -U pip
pip -V
pip install tox
tox --version
echo "${{ secrets.GITHUB_TOKEN }}" | \
docker login ghcr.io -u ${{ github.actor }} --password-stdin
tox -e build-cache-image -- \
--color \
--build-style merge \
--dist-dir export \
--post-action push