Skip to content

Merge branch 'develop' into feature/user-permissions #356

Merge branch 'develop' into feature/user-permissions

Merge branch 'develop' into feature/user-permissions #356

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Unit tests
on:
workflow_dispatch:
push:
branches:
- 'develop'
- 'main'
- 'feature/**'
- 'bugfix/**'
- 'hotfix/**'
- 'release/**'
jobs:
test-back:
runs-on: ubuntu-22.04
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
POSTGRES_DB: lettercraft
POSTGRES_USER: lettercraft_user
POSTGRES_PASSWORD: lettercraft_pwd
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: 'pip'
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
- name: Install Python dependencies
run: |
cd backend
python -m pip install --upgrade pip
pip install virtualenv
pip install -r requirements.txt
- name: Bootstrap application
env:
# Provide PostgreSQL environment variables in order to default to TCP connection
PGDATABASE: lettercraft
PGHOST: localhost
PGPORT: ${{ job.services.postgres.ports['5432'] }}
PGUSER: lettercraft_user
PGPASSWORD: lettercraft_pwd
run: |
cat bootstrap_ci.txt | python bootstrap.py
- name: Run all tests
run: |
cd backend
pytest
test-front:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
- name: Install dependencies
run: |
yarn fyarn
- name: Run tests
run: |
yarn test-front