Skip to content

CI for frontend

CI for frontend #23

Workflow file for this run

name: CI for frontend
on:
pull_request:
push:
branches:
- master
schedule:
- cron: "0 0 * * *"
jobs:
lint-type-check:
defaults:
run:
working-directory: web
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16 # TODO: use latest version when we update to Vue 3
- name: Install Vue app
run: yarn install
- name: Lint Vue app
run: yarn run lint --no-fix
- name: Type-check Vue app
run: yarn run type
- name: Build Vue app
run: yarn run build
test-e2e:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
env:
POSTGRES_DB: django
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
rabbitmq:
image: rabbitmq:management
ports:
- 5672:5672
minio:
# This image does not require any command arguments (which GitHub Actions don't support)
image: bitnami/minio:latest
env:
MINIO_ROOT_USER: minioAccessKey
MINIO_ROOT_PASSWORD: minioSecretKey
ports:
- 9000:9000
env:
# API server env vars
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: dandi-bucket
DJANGO_DANDI_DANDISETS_BUCKET_NAME: dandi-bucket
DJANGO_DANDI_DANDISETS_LOG_BUCKET_NAME: dandiapi-dandisets-logs
DJANGO_DANDI_DANDISETS_EMBARGO_BUCKET_NAME: dandi-embargo-dandisets
DJANGO_DANDI_DANDISETS_EMBARGO_LOG_BUCKET_NAME: dandiapi-embargo-dandisets-logs
DJANGO_DANDI_WEB_APP_URL: http://localhost:8085
DJANGO_DANDI_API_URL: http://localhost:8000
DJANGO_DANDI_JUPYTERHUB_URL: https://hub.dandiarchive.org/
DANDI_ALLOW_LOCALHOST_URLS: 1
# Web client env vars
VUE_APP_DANDI_API_ROOT: http://localhost:8000/api/
VUE_APP_OAUTH_API_ROOT: http://localhost:8000/oauth/
VUE_APP_OAUTH_CLIENT_ID: Dk0zosgt1GAAKfN8LT4STJmLJXwMDPbYWYzfNtAl
# E2E tests env vars
CLIENT_URL: http://localhost:8085
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '16'
cache: 'yarn'
cache-dependency-path: web/yarn.lock
- name: Install web app
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile --prefer-offline
working-directory: web
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install latest version of pip
run: pip install --upgrade pip
- uses: actions/cache@v3
id: pip-cache
with:
path: ${{ env.pythonLocation}}/lib/python3.11/site-packages/*
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('setup.py') }}
- name: Install dandi-api dependencies
run: pip install --upgrade --upgrade-strategy eager -e .[dev]
- name: Apply migrations to API server
run: python manage.py migrate
- name: Create any cache tables
run: python manage.py createcachetable
- name: Install E2E tests
run: yarn install --frozen-lockfile
working-directory: web/test
- name: Lint E2E tests
run: yarn run lint --no-fix --max-warnings=0
working-directory: web/test
- name: Run E2E tests
run: |
# start vue dev server and wait for it to start
yarn --cwd .. run serve 2> /dev/null &
while ! nc -z localhost 8085; do
sleep 3
done
# start the dandi-api server
python ../../manage.py runserver &
# run the E2E tests
yarn run test
working-directory: web/test