Skip to content

Merge pull request #79 from carltonnorthern/dependabot/npm_and_yarn/j… #179

Merge pull request #79 from carltonnorthern/dependabot/npm_and_yarn/j…

Merge pull request #79 from carltonnorthern/dependabot/npm_and_yarn/j… #179

Workflow file for this run

name: CI
on:
push:
branches: [master]
tags:
- "*"
pull_request:
branches: [master]
jobs:
python-lint:
defaults:
run:
working-directory: python
name: Lint Python
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
- uses: actions/setup-python@v6
with:
python-version: "3.14"
- name: Install dependencies
run: uv sync --group dev
- name: lint
run: uv run poe check
python-test-and-build:
name: Test and Build Python
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: python
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
python-version: [3.8, 3.9, "3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --group dev
- name: copy data files
run: python cp.py
- name: pytest
run: uv run poe test
js-test-and-lint:
name: Test and Lint JS
runs-on: ubuntu-latest
defaults:
run:
working-directory: js
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v3
with:
node-version: "20"
- name: Install dependencies
run: npm install
- name: Build
# Need to build to generate the data-generated.ts file
run: npm run build
- name: Lint
run: npm run lint
- name: Test
run: npm test
ensure-normalized:
name: Normalize, regenerate, and push csv data
runs-on: ubuntu-latest
defaults:
run:
working-directory: "."
env:
CI_COMMIT_MESSAGE: "chore: normalize data and re-sync"
steps:
- uses: actions/checkout@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 2
- uses: actions/setup-python@v6
- name: Normalize the .csv
run: python normalize.py
- name: Test that SQL data is up to date - normalized
run: python sql/generate_sql.py
- name: Check for changes
id: changes
run: |
if git diff --quiet; then
echo "has_changes=false" >> $GITHUB_OUTPUT
else
echo "has_changes=true" >> $GITHUB_OUTPUT
echo "Changes detected:"
git diff --name-only
fi
- name: Commit and push changes
if: steps.changes.outputs.has_changes == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
# Try to push changes, handle permission failures
if [ "${{ github.event_name }}" = "pull_request" ]; then
git commit -m "chore: normalize data and re-sync"
if ! git push; then
echo "::error::Data normalization is required, but this workflow cannot push to your fork."
echo "::error::Please either:"
echo "::error::1. Run 'python normalize.py' locally and commit the changes, or"
echo "::error::2. Allow maintainer edits on your PR: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork"
exit 1
fi
else
git commit --amend --no-edit
git push --force
fi