Skip to content

Simplify code structure #2

Simplify code structure

Simplify code structure #2

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
service: [api-full, api-simulation, api-tagger]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
- name: Install dependencies
run: |
cd projects/policyengine-${{ matrix.service }}
uv sync --extra test
- name: Run tests
run: |
cd projects/policyengine-${{ matrix.service }}
uv run pytest tests/ -v
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
file: ./projects/policyengine-${{ matrix.service }}/coverage.xml
flags: ${{ matrix.service }}
name: ${{ matrix.service }}
fail_ci_if_error: false
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Install ruff
run: uv tool install ruff
- name: Run ruff format check
run: |
for dir in projects/*/src libs/*/src; do
if [ -d "$dir" ]; then
echo "Checking format in $dir..."
uv run ruff format --check $dir
fi
done
- name: Run ruff lint
run: |
for dir in projects/*/src libs/*/src; do
if [ -d "$dir" ]; then
echo "Linting $dir..."
uv run ruff check $dir
fi
done
docker-build:
runs-on: ubuntu-latest
strategy:
matrix:
service: [api-full, api-simulation, api-tagger]
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
run: |
docker build -f projects/policyengine-${{ matrix.service }}/Dockerfile \
-t policyengine-${{ matrix.service }}:test \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--cache-from type=gha \
--cache-to type=gha,mode=max \
.