Skip to content

Merge pull request #626 from NASA-IMPACT/dev #1195

Merge pull request #626 from NASA-IMPACT/dev

Merge pull request #626 from NASA-IMPACT/dev #1195

Workflow file for this run

name: Tests
on:
- push
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.11']
defaults:
run:
working-directory: ./app
env:
DB_ENGINE: django.contrib.gis.db.backends.postgis
DB_NAME: admg
DB_USER: admg
DB_PASSWORD: admg
DB_HOST: 127.0.0.1
DB_PORT: 5432
DJANGO_SETTINGS_MODULE: config.settings.local
DJANGO_SECRET_KEY: "secret key here"
DJANGO_ADMIN_URL: admg/
GH_TOKEN: faketokenhere
GCMD_SYNC_SOURCE_EMAIL: gcmdadmg@localhost
GCMD_SYNC_RECIPIENTS: gcmd@localhost
CELERY_BROKER_URL: amqp://guest:guest@localhost:5672/
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Setup PostgreSQL with Postgis
uses: huaxk/[email protected]
with:
postgresql version: latest
postgresql db: admg
postgresql user: admg
postgresql password: admg
- name: Setup RabbitMQ
uses: nijel/[email protected]
with:
rabbitmq version: latest
- name: Install GDAL
run: |
sudo apt-get update -y
sudo apt-get install -y libgdal-dev
- name: Set user-site-path
id: user-site
run: |
USER_SITE_PATH=$(python -m site --user-site)
echo "USER_SITE_PATH=$USER_SITE_PATH" >> $GITHUB_ENV
# NOTE: The cache does not seem to detect changes in the requirements files reliably
- uses: actions/cache@v2
id: cache-dependencies
with:
path: ${{ env.USER_SITE_PATH }}
key: ${{ env.USER_SITE_PATH }}-${{ hashFiles('requirements/base.txt') }}-${{ hashFiles('requirements/local.txt') }}
- name: Install Dependencies
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: |
python -m pip install --upgrade pip
pip install \
--user \
--upgrade \
--upgrade-strategy eager \
-r requirements/base.txt \
-r requirements/local.txt
- name: Install Playwright Browsers
run: |
python -m playwright install --with-deps
- name: Check for missing migrations
run: |
python manage.py makemigrations --check --dry-run
- name: Run Tests
run: |
python -m coverage run -m pytest
python -m coverage report -m --skip-covered
python -m coverage json -o coverage.json
- name: Save Test Videos
uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: videos
path: app/videos/
- name: Save Code Coverage
uses: actions/upload-artifact@v3
with:
name: code_coverage
path: app/coverage.json