Skip to content

feat: add instance for model form #103

feat: add instance for model form

feat: add instance for model form #103

Workflow file for this run

name: Tests
on:
pull_request:
push:
branches: [main]
jobs:
tests:
runs-on: ubuntu-latest
services:
selenium:
image: selenium/standalone-firefox:latest
ports:
- "4444:4444" # Selenium
- "5900:5900" # VNC
localstack:
image: localstack/localstack:latest
env:
SERVICES: s3
DEFAULT_REGION: us-west-1
AWS_ACCESS_KEY_ID: test
AWS_SECRET_ACCESS_KEY: test
# enable persistence
DATA_DIR: /var/lib/localstack/data
LAMBDA_EXECUTOR: local
DOCKER_HOST: unix:///var/run/docker.sock
DEBUG: true
volumes:
# It doesn't seem like the scripts in entrypoint are being ran... or they are not copied over since
# the checkout action happens after init services on Github Actions
# - "${{ github.workspace }}/docker-entrypoint-initaws.d:/docker-entrypoint-initaws.d"
- "${{ github.workspace }}/tmp/localstack:/var/lib/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"
ports:
- 4566:4566
- 4571:4571
options: --health-cmd="curl http://localhost:4566/health?reload" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
django-version: ["3.2.16", "4.1.2", "4.2.2"]
poetry-version: ["1.2"]
env:
DJANGO_VERSION: ${{ matrix.django-version }}
PYTHON_VERSION: ${{ matrix.python-version }}
COMPOSE_INTERACTIVE_NO_CLI: 1
AWS_ACCESS_KEY_ID: test
AWS_SECRET_ACCESS_KEY: test
AWS_DEFAULT_REGION: us-west-1
AWS_STORAGE_BUCKET_NAME: "dj${{ matrix.django-version }}-py${{ matrix.python-version }}"
steps:
- name: Update Permissions
run: |
sudo chown -R $USER:$USER ${{ github.workspace }}
# required because actions/checkout@2 wants to delete the /tmp/localstack folder
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "poetry"
- name: Install dependencies
run: |
poetry update django==${{ matrix.django-version }}
poetry install
- name: Attempt to connect to localstack and create bucket
run: |
curl -X GET http://localhost:4566/health
aws --endpoint-url http://localhost:4566 s3 mb s3://${AWS_STORAGE_BUCKET_NAME} 2> /dev/null || true
# Since docker-entrypoint-initaws.d can't be used to create the s3 bucket on CI
- name: Collect Static
run: poetry run python tests/manage.py collectstatic --no-input
- name: Run tests with coverage
run: poetry run coverage run -m pytest
- name: Export result
if: always()
run: poetry run coverage xml
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v3
if: always()
with:
verbose: true
files: coverage.xml
flags: '${{ matrix.django-version }},${{ matrix.python-version }}'
name: codecov-umbrella
fail_ci_if_error: true
gather_all:
if: ${{ always() }}
runs-on: ubuntu-latest
name: Tests (matrix)
needs: tests
steps:
- name: Check build matrix status
if: ${{ needs.tests.result != 'success' }}
run: exit 1