Skip to content

Improved CI/CD pipeline, added dependencies, and other miscellaneous improvements #66

Improved CI/CD pipeline, added dependencies, and other miscellaneous improvements

Improved CI/CD pipeline, added dependencies, and other miscellaneous improvements #66

# Workflow that runs on code changes to a pull request.
name: PR code changes
on:
pull_request:
branches:
- main
paths:
- policyengine_us_data/**
- tests/**
- .github/workflows/**
jobs:
Lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check formatting
uses: "lgeiger/black-action@master"
with:
args: ". -l 79 --check"
SmokeTestForMultipleVersions:
name: Test Minimal Install & Import (${{ matrix.os }}, py${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
needs: Lint
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ['3.10', '3.11', '3.12']
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install package ONLY (no dev deps)
run: python -m pip install .
- name: Test basic import
run: python -c "import policyengine_us_data; print('Minimal import OK')"
- name: Test specific core import
run: python -c "from policyengine_core.data import Dataset; print('Core import OK')"
Test:
runs-on: ${{ matrix.os }}
needs: Lint
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
env:
HUGGING_FACE_TOKEN: ${{ secrets.HUGGING_FACE_TOKEN }}
POLICYENGINE_US_DATA_GITHUB_TOKEN: ${{ secrets.POLICYENGINE_US_DATA_GITHUB_TOKEN }}
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.12'
- name: Install package
run: uv pip install -e .[dev] --system
- name: Download data inputs
run: make download
env:
HUGGING_FACE_TOKEN: ${{ secrets.HUGGING_FACE_TOKEN }}
- name: Build datasets
run: make data
env:
LITE_MODE: true
- name: Run tests
run: pytest
- name: Test documentation builds
run: make documentation
#Test-Windows: # New parallel job for Windows
# runs-on: windows-latest
# needs: Lint
# steps:
# - name: Checkout repo
# uses: actions/checkout@v4
# - name: Install uv
# uses: astral-sh/setup-uv@v1
# - name: Set up Python
# uses: actions/setup-python@v5
# with:
# python-version: '3.12'
# - name: Install package and dev dependencies
# # Use default shell (PowerShell) for Windows runner
# run: uv pip install -e .[dev] --system
# shell: pwsh # Explicitly state shell if needed, though usually default
# - name: Download data inputs
# # Replaced 'make download' using Python scripts
# run: |
# python policyengine_us_data/storage/download_public_prerequisites.py
# python policyengine_us_data/storage/download_private_prerequisites.py
# env:
# HUGGING_FACE_TOKEN: ${{ secrets.HUGGING_FACE_TOKEN }}
# POLICYENGINE_US_DATA_GITHUB_TOKEN: ${{ secrets.POLICYENGINE_US_DATA_GITHUB_TOKEN }}
# shell: pwsh # Or cmd if python paths work better there, test needed
# - name: Build datasets
# run: |
# python policyengine_us_data/datasets/acs/acs.py
# python policyengine_us_data/datasets/cps/cps.py
# python policyengine_us_data/datasets/puf/irs_puf.py
# python policyengine_us_data/datasets/puf/puf.py
# python policyengine_us_data/datasets/cps/extended_cps.py
# python policyengine_us_data/datasets/cps/enhanced_cps.py
# env:
# LITE_MODE: "true"
# shell: pwsh
# - name: Run tests
# run: pytest
# shell: pwsh