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 5422489
Showing 1 changed file with 37 additions and 19 deletions.
56 changes: 37 additions & 19 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 @@ -25,41 +24,60 @@ jobs:
- 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');"
- name: Copy .env file
run: |
cp ./dev/.env.micropowermanager-backend ./src/backend/.env
if [ -f ./src/backend/.env ]; then
echo ".env file successfully copied to backend directory"
else
echo "Error: Failed to copy .env file"
exit 1
fi
# 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
- name: Generate key
run: php artisan key:generate
working-directory: ./src/backend
env:
DB_CONNECTION: mysql
DB_HOST: 127.0.0.1
DB_PORT: 3306
DB_DATABASE: micro_power_manager
DB_USERNAME: root
DB_PASSWORD: wF9zLp2qRxaS2e

# Run database migrations for testing
# - name: Run Migrations
# run: |
# php artisan migrate --env=.env
# php artisan migrate-tenant --env=.env
- name: Run Migrations
run: php artisan migrate:fresh --seed
working-directory: ./src/backend
env:
DB_CONNECTION: mysql
DB_HOST: 127.0.0.1
DB_PORT: 3306
DB_DATABASE: micro_power_manager
DB_USERNAME: root
DB_PASSWORD: wF9zLp2qRxaS2e

# Run PHPUnit tests with coverage
- name: Execute tests (Unit and Feature tests) via PHPUnit
- name: Execute tests
run: php artisan test
continue-on-error: true
working-directory: ./src/backend
env:
DB_CONNECTION: mysql
DB_HOST: 127.0.0.1
DB_PORT: 3306
DB_DATABASE: micro_power_manager
DB_USERNAME: root
DB_PASSWORD: wF9zLp2qRxaS2e

Check failure on line 83 in .github/workflows/test_suite.yaml

View workflow job for this annotation

GitHub Actions / Run yamllint

83:38 [new-line-at-end-of-file] no new line character at the end of file

0 comments on commit 5422489

Please sign in to comment.