Skip to content

Backend state migration #3094

Backend state migration

Backend state migration #3094

Workflow file for this run

name: Unit Tests
on:
pull_request:
branches: [dev, main, CIRCLES-331/user-data-to-backend, 331-staging]
jobs:
event_file:
name: Event File
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@v3
with:
name: Event File
path: ${{ github.event_path }}
backend:
name: Backend CI Testing
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
steps:
- name: Checking out repository
uses: actions/checkout@v3
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r backend/requirements.txt
- name: Set up docker compose
run: |
mkdir env
echo "MONGODB_USERNAME=github-ci" >> env/backend.env
echo "MONGODB_PASSWORD=github-ci" >> env/backend.env
echo "MONGODB_SERVICE_HOSTNAME=mongodb" >> env/backend.env
echo "MONGO_INITDB_ROOT_USERNAME=github-ci" >> env/mongodb.env
echo "MONGO_INITDB_ROOT_PASSWORD=github-ci" >> env/mongodb.env
echo "VITE_BACKEND_API_BASE_URL=http://localhost:8000/" >> env/frontend.env
docker compose run ci-backend
- name: Run mypy checks
run: cd backend && python -m mypy . && cd ..
- name: Test algorithm with pytest
run: |
cd backend
pip install pytest-cov
python -m pytest --junitxml=junit/be-test-results.xml --cov=. --cov-report=xml --cov-report=html
- uses: actions/upload-artifact@v3 # upload test results
if: always()
with:
name: be-test-results
path: backend/junit/be-test-results.xml # Path to test results
frontend:
name: Frontend CI Testing
runs-on: ubuntu-latest
steps:
- name: Checking out repository
uses: actions/checkout@v3
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Run frontend tests
run: |
cd frontend
npm ci
npm run test
- uses: actions/upload-artifact@v3
if: always()
with:
name: fe-test-results
path: frontend/junit/fe-test-results.xml
- name: Test the frontend successfully builds
run: |
mkdir env
echo "MONGODB_USERNAME=github-ci" >> env/backend.env
echo "MONGODB_PASSWORD=github-ci" >> env/backend.env
echo "MONGODB_SERVICE_HOSTNAME=mongodb" >> env/backend.env
echo "MONGO_INITDB_ROOT_USERNAME=github-ci" >> env/mongodb.env
echo "MONGO_INITDB_ROOT_PASSWORD=github-ci" >> env/mongodb.env
echo "VITE_BACKEND_API_BASE_URL=http://localhost:8000/" >> env/frontend.env
docker compose up -d frontend-prod