Skip to content

Add community guidelines, changelog, and CI/CD workflows #1

Add community guidelines, changelog, and CI/CD workflows

Add community guidelines, changelog, and CI/CD workflows #1

Workflow file for this run

name: Tests
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
backend-tests:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
env:
POSTGRES_DB: obsidian_test
POSTGRES_USER: obsidian
POSTGRES_PASSWORD: test_password
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r backend/requirements.txt
- name: Run tests
run: |
cd backend
pytest tests/ -v --cov=. --cov-report=xml
env:
DATABASE_URL: postgresql://obsidian:test_password@localhost/obsidian_test
- name: Upload coverage
uses: codecov/codecov-action@v3
with:
files: ./backend/coverage.xml
frontend-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
run: |
cd frontend
npm ci
- name: Run tests
run: |
cd frontend
npm run test:ci
- name: Run linter
run: |
cd frontend
npm run lint
build:
runs-on: ubuntu-latest
needs: [backend-tests, frontend-tests]
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build backend image
run: |
cd backend
docker build -t obsidian-backend:latest .
- name: Build frontend image
run: |
cd frontend
docker build -t obsidian-frontend:latest .
- name: Test Docker images
run: |
docker run --rm obsidian-backend:latest python -m pytest tests/ --co
docker run --rm obsidian-frontend:latest npm run build --dry-run