Use multiple caches #319
Workflow file for this run
This file contains 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: API Pipeline | |
on: | |
pull_request: | |
branches: | |
- 'main' | |
- 'develop' | |
paths: | |
- 'api/**.py' | |
- 'api/requirements*.*' | |
- 'api/Dockerfile' | |
- 'docker-compose.yml' | |
- '.github/workflows/api_pipeline.yml' | |
jobs: | |
static_analysis: | |
name: Run black formatting check | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out Git repository | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 | |
- name: Install Black with latest pip | |
run: | | |
python -m pip install --upgrade pip | |
cat ./api/requirements-dev.txt | grep black== | cut -d' ' -f1 | xargs pip install | |
- name: Check formatting with black | |
run: | | |
black --line-length 120 --target-version py311 --exclude migrations --check ./api | |
tests: | |
name: Run api tests | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out Git repository | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r ./api/requirements-dev.txt | |
- name: Run tests | |
run: | | |
ENVIRONMENT=test DJANGO_SETTINGS_MODULE=seismic_site.settings.test ./api/manage.py test |