Update PolicyEngine US #5473
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Push | |
| on: | |
| push: | |
| branches: [main] | |
| jobs: | |
| Lint: | |
| runs-on: ubuntu-latest | |
| if: | | |
| (github.repository == 'PolicyEngine/policyengine-us') | |
| && (github.event.head_commit.message == 'Update PolicyEngine US') | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v8.1.0 | |
| - name: Install dependencies | |
| run: uv sync --extra dev | |
| - name: Check formatting | |
| run: uv run ruff format --check . | |
| versioning: | |
| name: Update versioning | |
| if: | | |
| (github.repository == 'PolicyEngine/policyengine-us') | |
| && !(github.event.head_commit.message == 'Update PolicyEngine US') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Generate GitHub App token | |
| id: app-token | |
| uses: actions/create-github-app-token@v3 | |
| with: | |
| app-id: ${{ secrets.APP_ID }} | |
| private-key: ${{ secrets.APP_PRIVATE_KEY }} | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ steps.app-token.outputs.token }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v8.1.0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: 3.14 | |
| - name: Install dependencies | |
| run: uv pip install towncrier --system | |
| - name: Bump version and build changelog | |
| run: | | |
| python .github/bump_version.py | |
| VERSION=$(python -c "import re; print(re.search(r'version = \"(.+?)\"', open('pyproject.toml').read()).group(1))") | |
| towncrier build --yes --version "$VERSION" | |
| - name: Update changelog | |
| uses: EndBug/add-and-commit@v10 | |
| with: | |
| add: "." | |
| committer_name: Github Actions[bot] | |
| author_name: Github Actions[bot] | |
| message: Update PolicyEngine US | |
| github_token: ${{ steps.app-token.outputs.token }} | |
| fetch: false | |
| Baseline: | |
| name: Full Suite - Baseline (${{ matrix.group }}) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| if: | | |
| (github.repository == 'PolicyEngine/policyengine-us') | |
| && (github.event.head_commit.message == 'Update PolicyEngine US') | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - group: states-non-ny-shard-1 | |
| cmd: python policyengine_us/tests/test_batched.py policyengine_us/tests/policy/baseline/gov/states --batches 4 --exclude ny --shard 1/2 | |
| - group: states-non-ny-shard-2 | |
| cmd: python policyengine_us/tests/test_batched.py policyengine_us/tests/policy/baseline/gov/states --batches 4 --exclude ny --shard 2/2 | |
| - group: states-ny | |
| cmd: make test-yaml-no-structural-states-ny | |
| - group: irs-household | |
| cmd: make test-yaml-no-structural-other-irs-household | |
| - group: ssa | |
| cmd: make test-yaml-no-structural-other-ssa | |
| - group: rest | |
| cmd: make test-yaml-no-structural-other-rest | |
| - group: contrib | |
| cmd: make test-yaml-no-structural-other-contrib | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: 3.14 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v8.1.0 | |
| - name: Install dependencies | |
| run: uv sync --extra dev | |
| - name: Turn off default branching | |
| shell: bash | |
| run: bash ./update_itemization.sh | |
| - name: Run Baseline YAML tests (${{ matrix.group }}) | |
| env: | |
| PYTHONUNBUFFERED: 1 | |
| run: uv run ${{ matrix.cmd }} | |
| Contrib: | |
| name: Full Suite - Contrib (${{ matrix.group }}) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| if: | | |
| (github.repository == 'PolicyEngine/policyengine-us') | |
| && (github.event.head_commit.message == 'Update PolicyEngine US') | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - group: states-shard-1 | |
| target: test-yaml-structural-heavy-shard-1 | |
| - group: states-shard-2 | |
| target: test-yaml-structural-heavy-shard-2 | |
| - group: other-shard-1 | |
| target: test-yaml-structural-other | |
| - group: other-shard-2 | |
| target: test-yaml-structural-other-shard-2 | |
| - group: congress | |
| target: test-yaml-structural-congress | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: 3.14 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v8.1.0 | |
| - name: Install dependencies | |
| run: uv sync --extra dev | |
| - name: Turn off default branching | |
| shell: bash | |
| run: bash ./update_itemization.sh | |
| - name: Run Contrib YAML tests (${{ matrix.group }}) | |
| env: | |
| PYTHONUNBUFFERED: 1 | |
| run: uv run make ${{ matrix.target }} | |
| Rest: | |
| name: Full Suite - Rest (Python + variables/ YAMLs) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| if: | | |
| (github.repository == 'PolicyEngine/policyengine-us') | |
| && (github.event.head_commit.message == 'Update PolicyEngine US') | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: 3.14 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v8.1.0 | |
| - name: Install dependencies | |
| run: uv sync --extra dev | |
| - name: Turn off default branching | |
| shell: bash | |
| run: bash ./update_itemization.sh | |
| - name: Run Python tests (code_health, core, microsimulation, utilities, top-level) | |
| env: | |
| PYTHONUNBUFFERED: 1 | |
| run: uv run make test-other | |
| - name: Run tests/variables YAML tests | |
| if: always() | |
| env: | |
| PYTHONUNBUFFERED: 1 | |
| run: uv run make test-yaml-variables | |
| - name: Run tests/policy/reform YAML tests | |
| if: always() | |
| env: | |
| PYTHONUNBUFFERED: 1 | |
| run: uv run make test-yaml-reform | |
| Publish: | |
| runs-on: ubuntu-latest | |
| if: | | |
| (github.repository == 'PolicyEngine/policyengine-us') | |
| && (github.event.head_commit.message == 'Update PolicyEngine US') | |
| needs: [Baseline, Contrib, Rest] | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: 3.14 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v8.1.0 | |
| - name: Install package | |
| run: uv pip install -e ".[dev]" --system | |
| - name: Build package | |
| run: make | |
| - name: Publish a Python distribution to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| user: __token__ | |
| password: ${{ secrets.PYPI }} | |
| skip-existing: true |