Fix and update syntax (#49) #285
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: CI | |
on: | |
pull_request: | |
push: | |
branches: | |
- "develop" | |
- "main" | |
jobs: | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
python-version: [3.9, 3.10.9, 3.12] | |
test_env: [python, precommit, mypy] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Display system info | |
run: | | |
python -c "import sys; print(sys.version)" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install tox tox-gh-actions | |
python -m pip install build twine | |
- name: Test with tox | |
run: tox -e ${{ matrix.test_env }} | |
- name: Test syntax of build package | |
run: | | |
python -m build | |
python -m twine check dist/* | |
integration-tests: | |
name: Run integration tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.9" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -r requirements-test.txt | |
- name: Install more recent docker compose | |
uses: ndeloof/[email protected] | |
with: | |
version: v2.20.0 | |
legacy: true | |
- name: Print versions | |
run: | | |
printenv | |
docker --version | |
docker-compose --version | |
which docker-compose | |
- name: Build and run stack | |
run: | | |
docker volume create --name=pyseed_media | |
# verify that the stack wasn't cached | |
docker-compose -f tests/integration/docker-compose.yml stop | |
docker-compose -f tests/integration/docker-compose.yml rm -f | |
docker-compose -f tests/integration/docker-compose.yml up -d | |
- name: Wait for web server | |
uses: nev7n/wait_for_response@v1 | |
with: | |
# Increase the timeout significantly, the EEEJ census tract | |
# migration take ~6 minutes to run along. | |
url: "http://localhost:8000/" | |
responseCode: 200 | |
timeout: 640000 | |
interval: 5000 | |
- name: Wait another 30s | |
uses: jakejarvis/wait-action@master | |
with: | |
time: "30s" | |
- name: Dump docker logs before tests | |
uses: jwalton/gh-docker-logs@v2 | |
- name: Extract API credentials from SEED docker instance | |
run: | | |
docker exec pyseed_web ./manage.py create_test_user_json --username [email protected] --host http://localhost:8000 --pyseed > seed-config.json | |
- name: Run tests with pytest | |
env: | |
SEED_PM_UN: ${{ secrets.SEED_PM_UN }} | |
SEED_PM_PW: ${{ secrets.SEED_PM_PW }} | |
run: | | |
pytest -m integration -s | |
- name: Dump docker logs on failure | |
if: failure() | |
uses: jwalton/gh-docker-logs@v2 |