Skip to content

[TEST] Push workflow dry run - DO NOT MERGE #64

[TEST] Push workflow dry run - DO NOT MERGE

[TEST] Push workflow dry run - DO NOT MERGE #64

Workflow file for this run

name: "[TEST] Push workflow dry run"
on:
pull_request:
branches: [main]
jobs:
# ── Lint ────────────────────────────────────────────────────
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install ruff
run: pip install ruff>=0.9.0
- name: Check formatting
run: ruff format --check .
# ── Download prerequisites ──────────────────────────────────
download-prerequisites:
runs-on: ubuntu-latest
if: github.event.head_commit.message != 'Update package version'
env:
MODAL_TOKEN_ID: ${{ secrets.MODAL_TOKEN_ID }}
MODAL_TOKEN_SECRET: ${{ secrets.MODAL_TOKEN_SECRET }}
HUGGING_FACE_TOKEN: ${{ secrets.HUGGING_FACE_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install Modal CLI
run: pip install modal
- name: Download prerequisites on Modal
run: |
modal run modal_app/data_build.py \
--script download_prerequisites \
--branch=${{ github.ref_name }}
# ── Phase 1: Independent datasets (parallel) ───────────────
phase1:
needs: download-prerequisites
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
dataset: [uprating, acs, irs_puf]
env:
MODAL_TOKEN_ID: ${{ secrets.MODAL_TOKEN_ID }}
MODAL_TOKEN_SECRET: ${{ secrets.MODAL_TOKEN_SECRET }}
HUGGING_FACE_TOKEN: ${{ secrets.HUGGING_FACE_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install Modal CLI
run: pip install modal
- name: "Build + test: ${{ matrix.dataset }}"
run: |
modal run modal_app/data_build.py \
--script ${{ matrix.dataset }} \
--run-tests \
--branch=${{ github.ref_name }}
# ── Phase 2: CPS + PUF (depend on Phase 1) ─────────────────
phase2:
needs: phase1
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
dataset: [cps, puf]
env:
MODAL_TOKEN_ID: ${{ secrets.MODAL_TOKEN_ID }}
MODAL_TOKEN_SECRET: ${{ secrets.MODAL_TOKEN_SECRET }}
HUGGING_FACE_TOKEN: ${{ secrets.HUGGING_FACE_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install Modal CLI
run: pip install modal
- name: "Build + test: ${{ matrix.dataset }}"
run: |
modal run modal_app/data_build.py \
--script ${{ matrix.dataset }} \
--run-tests \
--branch=${{ github.ref_name }}
# ── Phase 3: Extended CPS (depends on Phase 2) ─────────────
phase3:
needs: phase2
runs-on: ubuntu-latest
env:
MODAL_TOKEN_ID: ${{ secrets.MODAL_TOKEN_ID }}
MODAL_TOKEN_SECRET: ${{ secrets.MODAL_TOKEN_SECRET }}
HUGGING_FACE_TOKEN: ${{ secrets.HUGGING_FACE_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install Modal CLI
run: pip install modal
- name: "Build + test: extended_cps"
run: |
modal run modal_app/data_build.py \
--script extended_cps \
--run-tests \
--branch=${{ github.ref_name }}
# ── Phase 4: Enhanced + Stratified CPS (depend on Phase 3) ─
phase4:
needs: phase3
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
dataset: [enhanced_cps, stratified_cps]
env:
MODAL_TOKEN_ID: ${{ secrets.MODAL_TOKEN_ID }}
MODAL_TOKEN_SECRET: ${{ secrets.MODAL_TOKEN_SECRET }}
HUGGING_FACE_TOKEN: ${{ secrets.HUGGING_FACE_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install Modal CLI
run: pip install modal
- name: "Build + test: ${{ matrix.dataset }}"
run: |
modal run modal_app/data_build.py \
--script ${{ matrix.dataset }} \
--run-tests \
--branch=${{ github.ref_name }}
# ── Phase 5: Source imputed + Small enhanced (depend on 4) ──
phase5:
needs: phase4
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
dataset: [source_imputed_cps, small_enhanced_cps]
env:
MODAL_TOKEN_ID: ${{ secrets.MODAL_TOKEN_ID }}
MODAL_TOKEN_SECRET: ${{ secrets.MODAL_TOKEN_SECRET }}
HUGGING_FACE_TOKEN: ${{ secrets.HUGGING_FACE_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install Modal CLI
run: pip install modal
- name: "Build + test: ${{ matrix.dataset }}"
run: |
modal run modal_app/data_build.py \
--script ${{ matrix.dataset }} \
--run-tests \
--branch=${{ github.ref_name }}
# ── Remaining integration tests (depend on Phase 4) ─────────
remaining-tests:
needs: phase4
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
test:
- policyengine_us_data/tests/integration/test_census_cps.py
- policyengine_us_data/tests/integration/test_database_build.py
env:
MODAL_TOKEN_ID: ${{ secrets.MODAL_TOKEN_ID }}
MODAL_TOKEN_SECRET: ${{ secrets.MODAL_TOKEN_SECRET }}
HUGGING_FACE_TOKEN: ${{ secrets.HUGGING_FACE_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install Modal CLI
run: pip install modal
- name: "Test: ${{ matrix.test }}"
run: |
modal run modal_app/data_build.py \
--test ${{ matrix.test }} \
--branch=${{ github.ref_name }}
# ── Manual approval gate ────────────────────────────────────
approval-gate:
needs: [phase5, remaining-tests]
runs-on: ubuntu-latest
environment: pipeline-approval
steps:
- run: echo "Pipeline approved. Dispatching H5 build."
# ── Dispatch pipeline ───────────────────────────────────────
trigger-pipeline:
needs: approval-gate
runs-on: ubuntu-latest
steps:
- name: Trigger pipeline workflow
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'pipeline.yaml',
ref: 'main',
inputs: { scope: 'all' }
})
console.log('Pipeline dispatched with scope=all')
# ── PyPI publish (version bump commits only) ────────────────
publish:
runs-on: ubuntu-latest
needs: lint
if: github.event.head_commit.message == 'Update package version'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- uses: astral-sh/setup-uv@v5
- name: Install package
run: uv sync --dev
- name: Build package
run: uv run python -m build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI }}
skip-existing: true