Add progress bar to derived data update #6482
Workflow file for this run
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: | |
# Currently GH Actions provides no simple method for "sharing" | |
# our setup steps. Ideally this would be in an action, but we would need to use | |
# actions inside of our actions which you cannot currently do (see https://github.com/actions/runner/issues/438) | |
# | |
# As a result, the DRYest method for now is to use a testing matrix and | |
# use conditional steps for actually running the tests. | |
unittests: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
test_env: [django, functional, api] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Cache Docker layers | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache | |
# using `-v3` in key to clear old cache due to errors | |
# See: https://stackoverflow.com/questions/63521430/clear-cache-in-github-actions | |
key: ${{ runner.os }}-buildx-v3-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx-v3- | |
- name: Build Docker dev image | |
run: /usr/bin/docker buildx build --tag seedplatform/seed:develop --cache-from type=local,src=/tmp/.buildx-cache --cache-to type=local,dest=/tmp/.buildx-cache,mode=max --load --file Dockerfile-dev . | |
- name: Start the stack | |
env: | |
DJANGO_LOG_LEVEL: ERROR | |
run: | | |
docker volume create --name=seed_pgdata | |
docker volume create --name=seed_media | |
docker compose -f docker-compose.yml -f docker-compose.dev.yml up -d | |
- name: Migrate | |
env: | |
DJANGO_LOG_LEVEL: ERROR | |
run: | | |
# verify no migrations need to be made... | |
docker exec seed_web python manage.py makemigrations --check --dry-run | |
# run migrations | |
docker exec --env DJANGO_LOG_LEVEL seed_web ./manage.py migrate | |
docker exec --env DJANGO_LOG_LEVEL seed_web ./manage.py create_default_user [email protected] --password=demo123 | |
docker exec --env DJANGO_LOG_LEVEL seed_web /bin/bash -c 'echo "y" | ./manage.py make_superuser --user [email protected]' | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: | | |
npm install | |
sudo apt update | |
sudo apt install -y xvfb | |
- name: Test Django | |
if: ${{ matrix.test_env == 'django' }} | |
env: | |
SEED_PM_UN: ${{ secrets.SEED_PM_UN }} | |
SEED_PM_PW: ${{ secrets.SEED_PM_PW }} | |
SF_INSTANCE: ${{ secrets.SF_INSTANCE }} | |
SF_USERNAME: ${{ secrets.SF_USERNAME }} | |
SF_PASSWORD: ${{ secrets.SF_PASSWORD }} | |
SF_DOMAIN: ${{ vars.SF_DOMAIN }} | |
SF_SECURITY_TOKEN: ${{ secrets.SF_SECURITY_TOKEN }} | |
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} | |
DJANGO_LOG_LEVEL: ERROR | |
run: | | |
docker exec seed_web touch /seed/config/settings/local_untracked.py | |
docker exec --env SEED_PM_UN --env SEED_PM_PW --env DJANGO_LOG_LEVEL --env SF_INSTANCE --env SF_USERNAME --env SF_PASSWORD --env SF_SECURITY_TOKEN --env SF_DOMAIN seed_web coverage run manage.py test --settings=config.settings.docker_dev | |
if [[ ! -z "${COVERALLS_REPO_TOKEN}" ]]; then | |
docker exec --env COVERALLS_REPO_TOKEN seed_web coveralls | |
else | |
echo "INFO: Env var COVERALLS_REPO_TOKEN was not found, skipping coveralls update" | |
fi | |
- name: Test Frontend | |
if: ${{ matrix.test_env == 'functional' }} | |
env: | |
DISPLAY: ':99' | |
run: | | |
Xvfb :99 & | |
npm test | |
- name: Test API | |
if: ${{ matrix.test_env == 'api' }} | |
run: | | |
docker exec seed_web ./manage.py create_test_user_json --username [email protected] --host http://localhost --file ./seed/tests/api/api_test_user.json | |
docker exec seed_web python seed/tests/api/test_seed_host_api.py --noinput --nofile | |
- name: Web container logs | |
if: ${{ always() }} | |
run: docker logs seed_web | |
formatting: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
tox_env: [docs, precommit, mypy, lint] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install deps | |
run: | | |
pip install --upgrade pip | |
pip install tox==3.14.3 | |
sudo apt update | |
sudo apt install gdal-bin | |
- name: Setup config | |
run: | | |
cat <<EOF > config/settings/local_untracked.py | |
{ | |
'default': { | |
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', | |
} | |
} | |
EOF | |
- name: Run tox | |
run: tox -e ${{ matrix.tox_env }} |