Feat: add recent activity as ML feature #136
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: PR Checks Backend | |
on: | |
pull_request: | |
branches: | |
- staging | |
paths: | |
- 'data/**' | |
- 'Dockerfile-pg' | |
- 'init_pg.sql' | |
- 'docker compose.yml' | |
workflow_dispatch: | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Set up Docker Compose | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11.4' | |
test: | |
runs-on: ubuntu-latest | |
needs: setup | |
defaults: | |
run: | |
working-directory: data/src | |
env: | |
VACANT_LOTS_DB: 'postgresql://postgres:temp-CI-only@localhost:5433/vacantlotdb' | |
services: | |
postgres: | |
image: postgis/postgis:16-3.4 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: temp-CI-only # CI-only, safe to hardcode for temporary container | |
POSTGRES_DB: vacantlotdb | |
ports: | |
- 5433:5432 | |
# Set health checks to wait until postgres is ready | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11.4' | |
- name: Install and configure pipenv | |
run: | | |
python -m pip install --upgrade pip | |
pip install pipenv | |
echo "Using Python: $(which python)" | |
pipenv --python $(which python) install --dev | |
- name: Install awkde | |
working-directory: data/src/awkde | |
run: pipenv run pip install . | |
- name: Run Pytest | |
working-directory: data/src | |
run: PYTHONPATH=$PYTHONPATH:. pipenv run pytest | |
run-formatter: | |
runs-on: ubuntu-latest | |
needs: setup | |
continue-on-error: true | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Run Ruff Formatter in Docker | |
run: | | |
cd data | |
docker compose run --rm formatter | |
run-linter: | |
runs-on: ubuntu-latest | |
needs: setup | |
continue-on-error: true | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Run Ruff Linter in Docker | |
run: | | |
cd data | |
docker compose run --rm linter | |
build-project: | |
runs-on: ubuntu-latest | |
needs: setup | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Build vacant-lots-proj | |
run: | | |
cd data | |
docker compose build vacant-lots-proj | |
run-services: | |
runs-on: ubuntu-latest | |
needs: build-project | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Run all services | |
run: | | |
cd data | |
docker compose up -d | |
check-build-status: | |
runs-on: ubuntu-latest | |
needs: run-services | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Check build status | |
if: failure() | |
run: | | |
echo "One or more services failed to build and run." | |
exit 1 | |
- name: Report success | |
if: success() | |
run: echo "All services built and ran successfully." | |
check-lint-format-status: | |
runs-on: ubuntu-latest | |
needs: [run-formatter, run-linter] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Check formatter and linter status | |
if: failure() | |
run: | | |
echo "Formatting or linting issues found. Please fix the issues." | |
exit 1 | |
- name: Formatter and linter success | |
if: success() | |
run: echo "Formatting and linting passed successfully." |