Tests #976
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: Tests | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: "0 0 * * *" | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Install tox | |
run: | | |
pip install --upgrade pip | |
pip install tox | |
- name: Run linting | |
run: | | |
tox -e lint | |
check-migrations-graph: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:latest | |
env: | |
POSTGRES_DB: django | |
POSTGRES_PASSWORD: postgres | |
ports: | |
- 5432:5432 | |
minio: | |
# This image does not require any command arguments (which GitHub Actions don't support) | |
image: bitnami/minio:2022.3.5-debian-10-r3 | |
env: | |
MINIO_ROOT_USER: minioAccessKey | |
MINIO_ROOT_PASSWORD: minioSecretKey | |
ports: | |
- 9000:9000 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Install tox | |
run: | | |
pip install --upgrade pip | |
pip install tox | |
- name: Install graphviz | |
run: | | |
sudo apt update | |
sudo apt-get install --no-install-recommends --yes graphviz libgraphviz-dev | |
- name: Run check migrations and graph models | |
run: | | |
tox -e check-migrations | |
tox -e graph-models | |
env: | |
DJANGO_DATABASE_URL: postgres://postgres:postgres@localhost:5432/django | |
DJANGO_MINIO_STORAGE_ENDPOINT: localhost:9000 | |
DJANGO_MINIO_STORAGE_ACCESS_KEY: minioAccessKey | |
DJANGO_MINIO_STORAGE_SECRET_KEY: minioSecretKey | |
DJANGO_STORAGE_BUCKET_NAME: django-storage | |
- name: Upload model graphs | |
uses: actions/upload-artifact@v2 | |
with: | |
name: graphs | |
path: .tox/graphs/*.png | |
test: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:latest | |
env: | |
POSTGRES_DB: django | |
POSTGRES_PASSWORD: postgres | |
ports: | |
- 5432:5432 | |
minio: | |
# This image does not require any command arguments (which GitHub Actions don't support) | |
image: bitnami/minio:2022.3.5-debian-10-r3 | |
env: | |
MINIO_ROOT_USER: minioAccessKey | |
MINIO_ROOT_PASSWORD: minioSecretKey | |
ports: | |
- 9000:9000 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Install tox | |
run: | | |
pip install --upgrade pip | |
pip install tox | |
- name: Run tests | |
run: | | |
tox -e test | |
env: | |
DJANGO_DATABASE_URL: postgres://postgres:postgres@localhost:5432/django | |
DJANGO_MINIO_STORAGE_ENDPOINT: localhost:9000 | |
DJANGO_MINIO_STORAGE_ACCESS_KEY: minioAccessKey | |
DJANGO_MINIO_STORAGE_SECRET_KEY: minioSecretKey | |
DJANGO_STORAGE_BUCKET_NAME: django-storage | |
- name: Stash coverage | |
uses: actions/upload-artifact@v2 | |
with: | |
name: .coverage | |
path: project/coverage.xml | |
- uses: codecov/codecov-action@v2 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: project/coverage.xml | |
verbose: true | |
test-demo: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Install Dependencies | |
run: | | |
pip install --upgrade pip | |
pip install -e .[colormaps] -r demo/requirements.txt | |
- name: Run tests | |
working-directory: demo | |
run: | | |
rm -rf ./data && mkdir ./data | |
python manage.py migrate | |
pytest --cov=django_large_image -v . | |
coverage xml -o coverage.xml | |
env: | |
DJANGO_SETTINGS_MODULE: myimages.settings | |
DJANGO_DEBUG: true | |
- name: Stash coverage | |
uses: actions/upload-artifact@v2 | |
with: | |
name: .coverage | |
path: demo/coverage.xml | |
- uses: codecov/codecov-action@v2 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: demo/coverage.xml | |
verbose: true |