folder trimming #12
This file contains hidden or 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: CI | |
on: | |
push: | |
branches: [ main, development ] | |
pull_request: | |
branches: [ main, development ] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Copy environment file | |
run: cp .env.development .env | |
- name: Build and test | |
run: | | |
docker compose version | |
# Ensure tests directory exists and is copied to the right place | |
mkdir -p docker/backend/tests | |
cp tests/test_api.py docker/backend/tests/ | |
docker compose -f docker-compose.dev.yml build | |
docker compose -f docker-compose.dev.yml up -d | |
docker compose -f docker-compose.dev.yml exec -T reproschema-server pip install pytest pytest-asyncio pytest-cov | |
docker compose -f docker-compose.dev.yml exec -T reproschema-server python -m pytest /app/tests/ | |
docker compose -f docker-compose.dev.yml down | |
env: | |
# Core settings | |
NODE_ENV: development | |
CONTAINER_NAME: reproschema-server | |
# Schema configuration | |
SCHEMA_SOURCE: https://raw.githubusercontent.com/ReproNim/demo-protocol/main/DemoProtocol/DemoProtocol_schema | |
SCHEMA_PATH: ./schemas | |
# Data paths | |
DATA_PATH: ./data | |
# Project configuration | |
PROJECT_NAME: development # Match development environment | |
# Development settings | |
DEV_MODE: 1 | |
ADMIN_MODE: true | |
DEBUG_MODE: true | |
docker: | |
needs: test | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push Docker images | |
env: | |
NODE_ENV: production # Ensure production build | |
PROJECT_NAME: reproschema # Use production name | |
run: | | |
docker compose -f docker-compose.yml build | |
docker compose -f docker-compose.yml push |