Skip to content

Commit

Permalink
improv: adjust test suite steps
Browse files Browse the repository at this point in the history
  • Loading branch information
beesaferoot committed Dec 18, 2024
1 parent 9208959 commit 9684921
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 23 deletions.
38 changes: 16 additions & 22 deletions .github/workflows/test_suite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ jobs:
tests:
runs-on: ubuntu-latest

# Test on multiple PHP versions
strategy:
matrix:
php-version: ["8.2"]
Expand All @@ -19,47 +18,42 @@ jobs:
mariadb:
image: mariadb:10.11
env:
MYSQL_DATABASE: micro_power_manager
MYSQL_DATABASE: testing_test_company_db
MYSQL_ROOT_PASSWORD: wF9zLp2qRxaS2e
ports:
- 3306:3306

steps:
# Checkout code
- uses: actions/checkout@v3

# Setup PHP with extensions
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, dom, fileinfo, mysql
coverage: xdebug

# Setup GitHub environment
- name: Copy .env
run: php -r "file_exists('./dev/.env.micropowermanager-backend') || copy('./dev/.env.micropowermanager-backend', '.env');"

# Install composer dependencies
- name: Install Composer Dependencies
run: |
composer install --no-interaction --prefer-dist
composer dump-autoload
working-directory: ./src/backend

# Generate application key
# - name: Generate key
# run: php artisan key:generate
# working-directory: ./src/backend

# Run database migrations for testing
# - name: Run Migrations
# run: |
# php artisan migrate --env=.env
# php artisan migrate-tenant --env=.env
# - name: Generate key
# run: php artisan key:generate
# working-directory: ./src/backend

# Run PHPUnit tests with coverage
- name: Execute tests (Unit and Feature tests) via PHPUnit
- name: Run Migrations
run: php artisan migrate:fresh --seed
working-directory: ./src/backend
env:
DB_CONNECTION: testing
DB_HOST: 127.0.0.1
DB_PORT: 3306
DB_DATABASE: micro_power_manager
DB_USERNAME: root
DB_PASSWORD: wF9zLp2qRxaS2e

- name: Execute tests
run: php artisan test
continue-on-error: true
working-directory: ./src/backend
3 changes: 2 additions & 1 deletion src/backend/phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<env name="APP_ENV" value="testing"/>
<env name="DB_CONNECTION" value="testing"/>
<env name="TEST_DB_CONNECTION" value="testing_test_company_db"/>

<env name="DB_USERNAME" value="root" />
<env name="DB_PASSWORD" value="wF9zLp2qRxaS2e" />
</php>
</phpunit>

0 comments on commit 9684921

Please sign in to comment.