chore: Update production Dockerfiles #393
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: Unit Tests | |
on: | |
push: | |
pull_request: | |
branches: | |
- master | |
- dev | |
jobs: | |
test-backend: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
defaults: | |
run: | |
working-directory: backend | |
env: | |
SECRET_KEY: github_actions | |
services: | |
postgres: | |
image: postgres:16.0 | |
env: | |
POSTGRES_DB: github_actions | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
ports: | |
- 5432:5432 | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Setup Python 3.12 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.12" | |
- name: Install psycopg prerequisites | |
run: | | |
sudo apt-get install libpq-dev | |
- name: Install poetry | |
run: | | |
python -m pip install --upgrade poetry wheel | |
- id: cache-poetry | |
uses: actions/cache@v4 | |
with: | |
path: ~/.local/share/virtualenvs | |
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }} | |
- name: Install dependencies | |
if: steps.cache-poetry.outputs.cache-hit != 'true' | |
run: | | |
poetry install | |
- name: Django tests | |
run: | | |
poetry run coverage run manage.py test | |
- name: Code coverage | |
run: | | |
poetry run coverage report -m | |
test-frontend: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
defaults: | |
run: | |
working-directory: frontend | |
strategy: | |
matrix: | |
node: [ 16 ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- name: Install dependencies | |
run: | | |
npm install | |
- name: Run unit tests | |
run: | | |
npm test | |
- name: Run coverage | |
run: | | |
npm run coverage |