Merge pull request #229 from Divyesh000/incompletetests #78
This file contains 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: Run tests | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
DB_USER: root # do not change | |
DB_PASSWORD: root # do not change | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.1' | |
extensions: mbstring, intl | |
ini-values: post_max_size=256M, max_execution_time=180, variables_order="EGPCS" | |
coverage: xdebug | |
tools: php-cs-fixer, phpunit | |
- name: Setup database | |
run: | | |
mysql -V | |
sudo /etc/init.d/mysql start | |
mysql -u$DB_USER -p$DB_PASSWORD -hlocalhost -P3306 < "resources/database/cafe_test_schema.sql" | |
mysql -u$DB_USER -p$DB_PASSWORD -hlocalhost -P3306 -Dcafe_test < "resources/database/cafe_test_data.sql" | |
mysql -e "USE cafe_test; SHOW TABLES;" -u$DB_USER -p$DB_PASSWORD | |
- name: Create .env.testing file | |
env: | |
ENV: | | |
DB_HOST="localhost" | |
DB_USERNAME="root" | |
DB_PASSWORD="root" | |
DB_NAME="cafe_test" | |
API_BASE_URI="http://steamy.localhost/api/v1/" | |
run: | | |
echo "$ENV" > .env.testing | |
cat .env.testing | |
- name: Validate composer.json and composer.lock | |
run: composer validate --strict | |
- name: Cache Composer packages | |
id: composer-cache | |
uses: actions/cache@v4 | |
with: | |
path: vendor | |
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-php- | |
- name: Install Composer dependencies | |
run: composer install --prefer-dist --no-progress | |
- name: Run model test suite | |
run: composer modeltest |