73 lines
2.0 KiB
YAML
73 lines
2.0 KiB
YAML
################
|
|
# Build & Test #
|
|
################
|
|
|
|
kind: pipeline
|
|
name: run_tests
|
|
|
|
steps:
|
|
# Check PHP syntax
|
|
- name: check_php_syntax
|
|
image: php:8.1-cli
|
|
commands:
|
|
- echo "Checking PHP syntax in all files..."
|
|
- set -e
|
|
- find . -type f -name '*.php' -exec php -l {} \; || echo "PHP syntax errors found!"
|
|
|
|
# Check HTML syntax
|
|
- name: check_html_syntax
|
|
image: ubuntu:20.04
|
|
commands:
|
|
- set -e
|
|
- apt-get update && apt-get install -y tidy
|
|
- echo "Checking HTML syntax in all files..."
|
|
- find . -type f -name '*.html' -exec tidy -q -e {} \; || echo "HTML syntax errors found!"
|
|
|
|
# Run tests for React client
|
|
- name: client_test
|
|
image: node:18-alpine
|
|
commands:
|
|
- set -e
|
|
- echo "Running tests for React client..."
|
|
- if [ -d services/client ]; then
|
|
cd services/client;
|
|
if [ -f package.json ]; then
|
|
yarn install --frozen-lockfile;
|
|
CI=true yarn test --coverage;
|
|
else
|
|
echo "package.json not found! Skipping client tests.";
|
|
fi
|
|
else
|
|
echo "services/client directory not found!";
|
|
fi
|
|
|
|
# Run tests for Python backend
|
|
- name: engine_test
|
|
image: python:3.9-alpine
|
|
commands:
|
|
- set -e
|
|
- echo "Running tests for Python backend..."
|
|
- if [ -d services/game ]; then
|
|
cd services/game;
|
|
if [ -f requirements.txt ]; then
|
|
pip install -r requirements.txt;
|
|
pytest --cov=app --cov-report=term-missing;
|
|
else
|
|
echo "requirements.txt not found! Skipping backend tests.";
|
|
fi
|
|
else
|
|
echo "services/game directory not found!";
|
|
fi
|
|
environment:
|
|
FLASK_ENV: production
|
|
APP_SETTINGS: project.config.TestingConfig
|
|
DATABASE_TEST_URL: postgres://postgres:postgres@gamedb:5432/game_test
|
|
|
|
services:
|
|
- name: gamedb
|
|
image: postgres:15-alpine
|
|
environment:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_DB: game_test
|