-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ColoredCow/feature/ci-workflow
Add Laravel CI workflow
- Loading branch information
Showing
9 changed files
with
982 additions
and
93 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: Laravel CI Test | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
laravel-tests: | ||
runs-on: ubuntu-latest | ||
|
||
services: | ||
mysql: | ||
image: mysql:8 | ||
env: | ||
MYSQL_DATABASE: testing_db | ||
MYSQL_USER: user | ||
MYSQL_PASSWORD: password | ||
MYSQL_ROOT_PASSWORD: root | ||
ports: | ||
- 3306:3306 | ||
options: >- | ||
--health-cmd="mysqladmin ping --host=localhost --user=root --password=root" | ||
--health-interval=10s | ||
--health-timeout=5s | ||
--health-retries=3 | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 8.2 | ||
extensions: mbstring, bcmath, pdo, pdo_mysql | ||
coverage: none | ||
|
||
- name: Install Composer Dependencies | ||
run: composer install --no-progress --prefer-dist --optimize-autoloader | ||
|
||
- name: Setup Laravel Environment | ||
run: | | ||
cp .env.example .env | ||
php artisan key:generate | ||
- name: Run Migrations | ||
env: | ||
DB_CONNECTION: mysql | ||
DB_DATABASE: testing_db | ||
DB_USERNAME: user | ||
DB_PASSWORD: password | ||
DB_HOST: 127.0.0.1 | ||
run: php artisan migrate --force | ||
|
||
# Check PHP code formatting with PHPFMT | ||
- name: Run PHPFMT | ||
run: ./vendor/bin/phpmd app,routes text codesize,controversial,design,naming,unusedcode | ||
|
||
# Static analysis using Larastan | ||
- name: Run Larastan | ||
run: ./vendor/bin/phpstan analyse app routes --memory-limit=2G | ||
|
||
# Run PHPUnit Tests | ||
- name: Run PHPUnit Tests | ||
env: | ||
DB_CONNECTION: mysql | ||
DB_DATABASE: testing_db | ||
DB_USERNAME: user | ||
DB_PASSWORD: password | ||
DB_HOST: 127.0.0.1 | ||
run: | | ||
php artisan config:clear | ||
php artisan cache:clear | ||
php artisan test --testsuite=Feature --stop-on-failure |
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
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
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
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
Oops, something went wrong.