forked from krlove/eloquent-model-generator
-
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.
[TASK] Introduce GitHub action workflow as CI check
This change introduces GitHub action workflows to integrate automatic CI checks for pushes and pull requests. This change adds a general php-linting for supported php-versions and executes unit- and integration tests against laravel 9.x and 10.x. This helps contributors a lot, and also helps the maintainer(s) for pull-requests, that tests are green. Maybe this helps to minimze manual work for pull-request reviews and increases merging working pull-requests. Resolves krlove#110
- Loading branch information
Showing
2 changed files
with
218 additions
and
0 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,109 @@ | ||
name: CI against Laravel 10.x | ||
|
||
on: | ||
push: | ||
pull_request: | ||
schedule: | ||
- cron: '56 4 * * *' | ||
|
||
jobs: | ||
lint: | ||
name: "Lint PHP" | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php-version: | ||
- "8.0" | ||
- "8.1" | ||
- "8.2" | ||
steps: | ||
- name: "Checkout" | ||
uses: actions/checkout@v3 | ||
- name: "Install PHP" | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: "${{ matrix.php-version }}" | ||
coverage: none | ||
tools: composer:v2.4 | ||
- name: "Install with Laravel 10.x" | ||
run: | | ||
rm -rf composer.lock vendor/ ; \ | ||
composer require \ | ||
"illuminate/database":"^10.0" \ | ||
"illuminate/support":"^10.0" \ | ||
"illuminate/config":"^10.0" \ | ||
"illuminate/console":"^10.0" ; \ | ||
git restore composer.json | ||
- name: "Lint PHP files" | ||
run: | | ||
find src tests -name '*.php' -print0 | xargs -r -0 -n 1 -P 4 php -l | ||
unit-tests: | ||
name: "Unit tests" | ||
runs-on: ubuntu-22.04 | ||
needs: lint | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php-version: | ||
- "8.0" | ||
- "8.1" | ||
- "8.2" | ||
steps: | ||
- name: "Checkout" | ||
uses: actions/checkout@v3 | ||
- name: "Install PHP" | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: "${{ matrix.php-version }}" | ||
coverage: none | ||
tools: composer:v2.4 | ||
- name: "Install with Laravel 10.x" | ||
run: | | ||
rm -rf composer.lock vendor/ ; \ | ||
composer require \ | ||
"illuminate/database":"^10.0" \ | ||
"illuminate/support":"^10.0" \ | ||
"illuminate/config":"^10.0" \ | ||
"illuminate/console":"^10.0" ; \ | ||
git restore composer.json | ||
- name: "Run tests" | ||
run: | | ||
[[ ! -f vendor/bin/phpunit ]] && echo "PHPUnit binary missing" && exit 1 | ||
php vendor/bin/phpunit -c phpunit.xml.dist tests/unit/ | ||
integration-tests: | ||
name: "Integration tests" | ||
runs-on: ubuntu-22.04 | ||
needs: unit-tests | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php-version: | ||
- "8.0" | ||
- "8.1" | ||
- "8.2" | ||
steps: | ||
- name: "Checkout" | ||
uses: actions/checkout@v3 | ||
- name: "Install PHP" | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: "${{ matrix.php-version }}" | ||
coverage: none | ||
tools: composer:v2.4 | ||
- name: "Install with Laravel 10.x" | ||
run: | | ||
rm -rf composer.lock vendor/ ; \ | ||
composer require \ | ||
"illuminate/database":"^10.0" \ | ||
"illuminate/support":"^10.0" \ | ||
"illuminate/config":"^10.0" \ | ||
"illuminate/console":"^10.0" ; \ | ||
git restore composer.json | ||
- name: "Run tests" | ||
run: | | ||
[[ ! -f vendor/bin/phpunit ]] && echo "PHPUnit binary missing" && exit 1 | ||
php vendor/bin/phpunit -c phpunit.xml.dist tests/integration/ |
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,109 @@ | ||
name: CI against Laravel 9.x | ||
|
||
on: | ||
push: | ||
pull_request: | ||
schedule: | ||
- cron: '56 4 * * *' | ||
|
||
jobs: | ||
lint: | ||
name: "Lint PHP" | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php-version: | ||
- "8.0" | ||
- "8.1" | ||
- "8.2" | ||
steps: | ||
- name: "Checkout" | ||
uses: actions/checkout@v3 | ||
- name: "Install PHP" | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: "${{ matrix.php-version }}" | ||
coverage: none | ||
tools: composer:v2.4 | ||
- name: "Install with Laravel 9.x" | ||
run: | | ||
rm -rf composer.lock vendor/ ; \ | ||
composer require \ | ||
"illuminate/database":"^9.0" \ | ||
"illuminate/support":"^9.0" \ | ||
"illuminate/config":"^9.0" \ | ||
"illuminate/console":"^9.0" ; \ | ||
git restore composer.json | ||
- name: "Lint PHP files" | ||
run: | | ||
find src tests -name '*.php' -print0 | xargs -r -0 -n 1 -P 4 php -l | ||
unit-tests: | ||
name: "Unit tests" | ||
runs-on: ubuntu-22.04 | ||
needs: lint | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php-version: | ||
- "8.0" | ||
- "8.1" | ||
- "8.2" | ||
steps: | ||
- name: "Checkout" | ||
uses: actions/checkout@v3 | ||
- name: "Install PHP" | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: "${{ matrix.php-version }}" | ||
coverage: none | ||
tools: composer:v2.4 | ||
- name: "Install with Laravel 9.x" | ||
run: | | ||
rm -rf composer.lock vendor/ ; \ | ||
composer require \ | ||
"illuminate/database":"^9.0" \ | ||
"illuminate/support":"^9.0" \ | ||
"illuminate/config":"^9.0" \ | ||
"illuminate/console":"^9.0" ; \ | ||
git restore composer.json | ||
- name: "Run tests" | ||
run: | | ||
[[ ! -f vendor/bin/phpunit ]] && echo "PHPUnit binary missing" && exit 1 | ||
php vendor/bin/phpunit -c phpunit.xml.dist tests/unit/ | ||
integration-tests: | ||
name: "Integration tests" | ||
runs-on: ubuntu-22.04 | ||
needs: unit-tests | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php-version: | ||
- "8.0" | ||
- "8.1" | ||
- "8.2" | ||
steps: | ||
- name: "Checkout" | ||
uses: actions/checkout@v3 | ||
- name: "Install PHP" | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: "${{ matrix.php-version }}" | ||
coverage: none | ||
tools: composer:v2.4 | ||
- name: "Install with Laravel 9.x" | ||
run: | | ||
rm -rf composer.lock vendor/ ; \ | ||
composer require \ | ||
"illuminate/database":"^9.0" \ | ||
"illuminate/support":"^9.0" \ | ||
"illuminate/config":"^9.0" \ | ||
"illuminate/console":"^9.0" ; \ | ||
git restore composer.json | ||
- name: "Run tests" | ||
run: | | ||
[[ ! -f vendor/bin/phpunit ]] && echo "PHPUnit binary missing" && exit 1 | ||
php vendor/bin/phpunit -c phpunit.xml.dist tests/integration/ |