Skip to content

Add liquid asset variables for SSI modeling #20282

Add liquid asset variables for SSI modeling

Add liquid asset variables for SSI modeling #20282

Workflow file for this run

name: Pull request
on:
pull_request:
branches: [master]
jobs:
Lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check formatting
uses: "lgeiger/black-action@master"
with:
args: ". -l 79 --check"
check-version:
name: Check version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 100
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.13
- name: Install dependencies
run: |
uv pip install -e . --system
uv pip install "yaml-changelog>=0.1.7" --system
- name: Build changelog
run: make changelog
Test:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 10 # Need full history for git diff
- name: Fetch base branch
run: |
git fetch origin ${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.13
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Install dependencies
run: |
# Install core package and its dependencies
uv pip install -e . --system
# Install only coverage for testing (not docs dependencies)
uv pip install coverage --system
- name: Turn off default branching
shell: bash
run: ./update_itemization.sh
- name: Run selective tests based on changed files
env:
PYTHONUNBUFFERED: 1
GITHUB_EVENT_NAME: ${{ github.event_name }}
GITHUB_BASE_REF: ${{ github.base_ref }}
run: |
echo "Running selective tests based on changed files..."
python policyengine_us/tests/run_selective_tests.py --base-branch ${{ github.base_ref }} --coverage
- name: Generate coverage report
id: coverage
if: always()
run: |
echo "📊 Coverage Report"
echo "=================="
# Show files below 100% coverage (won't fail CI)
coverage report --fail-under=0 --skip-covered --skip-empty || echo "No coverage data available."
# Count files below 100%
TOTAL_FILES=$(coverage report --skip-covered --skip-empty 2>/dev/null | grep -E "^[a-zA-Z].*\.py " | wc -l || echo "0")
if [ "$TOTAL_FILES" -gt "0" ]; then
echo ""
echo "⚠️ $TOTAL_FILES file(s) have less than 100% coverage"
echo "Consider adding tests to improve coverage."
else
echo ""
echo "✅ All files have 100% coverage!"
fi
# Generate XML for Codecov
coverage xml || echo "No coverage data to generate XML report."
# Expose whether we have coverage for later steps
if [ -f coverage.xml ]; then
echo "has_coverage=true" >> "$GITHUB_OUTPUT"
else
echo "has_coverage=false" >> "$GITHUB_OUTPUT"
fi
- name: Upload coverage to Codecov
if: ${{ always() && steps.coverage.outputs.has_coverage == 'true' }}
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
fail_ci_if_error: false
flags: unittests
name: codecov-umbrella
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
- name: Build package
run: uv build