Skip to content

chore: simplify test #59

chore: simplify test

chore: simplify test #59

Workflow file for this run

name: TEST CI
on:
pull_request:
branches:
- master
env:
PUBLIC_API_URL: "http://127.0.0.1:8080"
PUBLIC_API_REQUEST_TIMEOUT_MS: "10000"
PUBLIC_COOKIES_EXPIRATION_SPAN_SECONDS: "5184000"
ALLOWED_ORIGINS: '["http://localhost", "http://localhost:4173", "http://localhost:5173", "http://localhost:5174"]'
IS_SQLALCHEMY_LOG_ENABLED: "True"
SQLALCHEMY_DATABASE_URL: "sqlite:///./project_management.db"
SECRET_KEY: "21cc261d634e34ca74ea7a18b2db1f36423e42a1b047553af12cd40dc13b06ee"
jobs:
test-backend:
name: Test Backend
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.12]
defaults:
run:
working-directory: ./backend
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
cache: "pipenv"
- name: Install pipenv
run: pip install pipenv --user
- name: Install dependencies
run: pipenv install --dev
- name: Run the backend tests
run: pipenv run python -m pytest
test-frontend:
name: Test Frontend
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
defaults:
run:
working-directory: ./frontend
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup java
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "21"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
cache: "pipenv"
- name: Install pipenv
run: pip install pipenv --user
- name: Install dependencies
run: |
cd ../backend
pipenv install
- name: Start backend service
run: |
cd ../backend
setsid pipenv run uvicorn main:app --port 8080 &
attempts=10
for i in $(seq 1 $attempts); do
if curl --silent --head --fail 127.0.0.1:8080/docs; then
echo "Service is up!"
exit 0
fi
if [ $i -eq $attempts ]; then
echo "Service did not respond after $attempts attempts."
exit 1
fi
sleep 1
done
- name: Install dependencies
run: |
pnpm install --frozen-lockfile
pnpm exec playwright install --with-deps
- name: Build the project
run: |
pnpm run open-api:generate:shared
pnpm run open-api:zod:linux
pnpm run build
- name: Run frontend tests (with backend service running)
run: |
pnpm run test:unit
pnpm exec playwright test --project chromium