Skip to content

Merge pull request #391 from weblate/weblate-itsm-ng-itsm-ng #860

Merge pull request #391 from weblate/weblate-itsm-ng-itsm-ng

Merge pull request #391 from weblate/weblate-itsm-ng-itsm-ng #860

Workflow file for this run

name: Run tests
on: [push,pull_request]
jobs:
tests:
name: Run tests
runs-on: ubuntu-latest
env:
DB_DATABASE: test_db
DB_DATABASE_UNIT: unit_db
DB_USER: test
DB_PASSWORD: test
strategy:
matrix:
php-versions: ['8.3']
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv
coverage: none
- name: Install NodeJS
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Run composer install
run: export NODE_OPTIONS=--openssl-legacy-provider && php bin/console dependencies install
- name: Start MySQL
run: |
sudo apt autoremove --purge mysql*
sudo apt update
sudo apt install mariadb-server
sudo mysql -e "CREATE DATABASE IF NOT EXISTS $DB_DATABASE;"
sudo mysql -e "CREATE USER IF NOT EXISTS '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASSWORD';"
sudo mysql -e "GRANT ALL PRIVILEGES ON $DB_DATABASE.* TO '$DB_USER'@'localhost';"
sudo mysql -e "FLUSH PRIVILEGES;"
- name: Install ITSM-ng
run: php bin/console itsmng:database:install -H localhost -u $DB_USER -p $DB_PASSWORD -d $DB_DATABASE -n
- name: Setup Unit environment
run: |
sudo mysql -e "CREATE DATABASE IF NOT EXISTS $DB_DATABASE_UNIT;"
sudo mysql -e "GRANT ALL PRIVILEGES ON $DB_DATABASE_UNIT.* TO '$DB_USER'@'localhost';"
sudo mysql -e "FLUSH PRIVILEGES;"
php bin/console itsmng:database:install --config-dir=/home/runner/work/itsm-ng/itsm-ng/tests/config -H localhost -u $DB_USER -p $DB_PASSWORD -d $DB_DATABASE_UNIT -n
- name: Run PHP Unit tests
run: vendor/bin/atoum -p 'php -d memory_limit=512M' --debug --force-terminal --use-dot-report --bootstrap-file tests/bootstrap.php --fail-if-skipped-methods --max-children-number 10 -d tests/units