Skip to content

Useful Development Commands

Quick reference for common development commands in omegaUp.

Linting and Validation

Run All Linters

./stuff/lint.sh
Runs all code validations. Automatically runs on git push.

Location: Outside Docker container, project root

Validate Style Only

./stuff/lint.sh validate
Validates code style without fixing issues.

Generate i18n Files

./stuff/lint.sh --linters=i18n fix --all
Generates *.lang files based on es.lang, en.lang, and pt.lang.

Testing

Run All PHP Tests

./stuff/runtests.sh
Runs PHPUnit tests, MySQL type validation, and Psalm.

Location: Inside Docker container

Run Specific PHP Test File

./stuff/run-php-tests.sh frontend/tests/controllers/$MY_FILE.php
Runs unit tests for a single PHP file. Omit filename to run all tests.

Run Cypress Tests

npx cypress open
Opens Cypress Test Runner GUI for interactive testing.

Prerequisites: - Node.js installed - npm installed - libasound2 (Linux)

Location: Outside Docker container

Run Vue Unit Tests (Watch Mode)

yarn run test:watch
Runs Vue tests in watch mode, auto-rerunning on code changes.

Run Specific Vue Test File

./node_modules/.bin/jest frontend/www/js/omegaup/components/$MY_FILE.test.ts
Runs a single Vue test file.

Database

Reset Database to Initial State

./stuff/bootstrap-environment.py --purge
Restores database to initial state and populates with test data.

Location: Inside Docker container

Apply Database Migrations

./stuff/db-migrate.py migrate --databases=omegaup,omegaup-test
Applies schema changes from new migration files.

Location: Inside Docker container

Update schema.sql from Migrations

./stuff/update-dao.sh
Applies changes to schema.sql when adding new migration files.

Location: Inside Docker container

PHP Type Validation

Run Psalm on All PHP Files

find frontend/ \
    -name *.php \
    -and -not -wholename 'frontend/server/libs/third_party/*' \
    -and -not -wholename 'frontend/tests/badges/*' \
    -and -not -wholename 'frontend/tests/controllers/*' \
    -and -not -wholename 'frontend/tests/runfiles/*' \
    -and -not -wholename 'frontend/www/preguntas/*' \
  | xargs ./vendor/bin/psalm \
    --long-progress \
    --show-info=false
Runs type validation on PHP files using Psalm.

Location: Inside Docker container

Docker

Restart Docker Service

systemctl restart docker.service
Restarts Docker service. Useful for fixing container access errors.

Location: Outside Docker container (Linux)

Access Container Console

docker exec -it omegaup-frontend-1 /bin/bash
Opens a bash shell inside the frontend container.

Quick Reference

Task Command Location
Lint code ./stuff/lint.sh Outside container
Run PHP tests ./stuff/runtests.sh Inside container
Run Cypress npx cypress open Outside container
Reset DB ./stuff/bootstrap-environment.py --purge Inside container
Migrate DB ./stuff/db-migrate.py migrate Inside container
Vue tests yarn run test:watch Inside container