Skip to content

Fix dropCalculatedValues models import #455

Fix dropCalculatedValues models import

Fix dropCalculatedValues models import #455

name: Unit Tests
on: push
jobs:
test:
name: Set up and test
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
services:
postgres:
image: postgis/postgis:14-3.2
env:
# must specify password for PG Docker container image, see: https://registry.hub.docker.com/_/postgres?tab=description&page=1&name=10
POSTGRES_USER: manyfews
POSTGRES_PASSWORD: manyfews
POSTGRES_DB: manyfews
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v2
-
name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y binutils libproj-dev gdal-bin
-
name: Cache Miniconda environment
uses: actions/cache@v3
with:
path: /usr/share/miniconda3/envs/anaconda-client-env
key: conda-${{ runner.os }}--${{ runner.arch }}--${{ steps.get-date.outputs.today }}-${{ hashFiles('config/manyFEWS.base.yml') }}-${{ env.CACHE_NUMBER }}
env:
# Increase this to manually invalidate the cache
CACHE_NUMBER: 0 +
id: cache
-
name: Install chromedriver
uses: nanasess/setup-chromedriver@v2
-
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: anaconda-client-env
environment-file: config/manyFEWS.base.yml
python-version: 3.9
auto-activate-base: false
use-mamba: true
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
# https://github.com/conda-incubator/setup-miniconda/issues/105#issuecomment-730243912
-
name: Install dev dependencies and list packages
shell: bash -l {0}
run: |
conda env update -n anaconda-client-env -f config/manyFEWS.devel.yml
conda info
conda list
-
name: Install npm
uses: actions/setup-node@v2
with:
node-version: '16'
-
name: Run Django migrations
run: |
cp ./manyfews/.env.CI ./manyfews/.env
python manage.py migrate
working-directory: manyfews
-
name: Start XVFB
run: |
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # optional
-
name: Run Django tests
env:
ZENTRA_UN: ${{ secrets.ZENTRA_CLOUD_USERNAME }}
ZENTRA_PW: ${{ secrets.ZENTRA_CLOUD_PASSWORD }}
MAP_URL: ${{ secrets.MAP_URL }}
EMAIL_HOST_USER: ${{ secrets.EMAIL_HOST_USER }}
EMAIL_HOST_PASSWORD: ${{ secrets.EMAIL_HOST_PASSWORD }}
STATION_SN: ${{ vars.STATION_SN }}
DISPLAY: :99
run: coverage run --source='.' manage.py test
working-directory: manyfews
-
name: Check npm and webpack
run: |
npm install
npm run build
working-directory: manyfews
-
name: Check built assets are up-to-date
run: |
if [[ `git status --porcelain manyfews/webapp/static` ]]; then
echo "Static files are not up to date:"
git status --porcelain manyfews/webapp/static
echo "Run 'npm run build' from the 'manyfews' directory and commit the changes."
exit 1
fi
working-directory: manyfews
-
name: Create coverage.py XML report
run: |
coverage xml
working-directory: manyfews
-
name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}