Fix test suite #108 #3
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: Code Test Suite | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
jobs: | |
laravel-tests: | |
runs-on: ubuntu-latest | |
# Test on multiple PHP versions | |
strategy: | |
matrix: | |
php-version: ["8.2"] | |
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 | |
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 | |
php artisan migrate-tenant | |
working-directory: ./src/backend | |
# Run PHPUnit tests with coverage | |
- name: Execute tests (Unit and Feature tests) via PHPUnit | |
env: | |
DB_CONNECTION: sqlite | |
DB_DATABASE: database/database.sqlite | |
run: | | |
mkdir -p database | |
touch database/database.sqlite | |
php artisan test --coverage | |
continue-on-error: true | |
working-directory: ./src/backend |