Add initial continuous integration

Currently it will run phpunit, check coding standards and run
phpstan. This can and should be build upon, so that eventually builds
are automated and hopefully reproducable.
This commit is contained in:
Hosh Sadiq
2020-07-26 23:57:36 +01:00
parent 9c14bc24e2
commit 8f568d41ca
7 changed files with 837 additions and 3 deletions

155
.github/workflows/laravel.yml vendored Normal file
View File

@@ -0,0 +1,155 @@
name: Laravel
on:
push:
branches:
- main
- develop
- feature/*
- features/*
pull_request:
branches:
- main
- develop
- feature/*
- features/*
jobs:
prepare:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Copy .env
run: test -f .env || cp ci.env .env
- name: Prepare Dependencies
run: |
set -euxo pipefail
export PATH=$PATH:$HOME/.composer/vendor/bin/
composer global require hirak/prestissimo --no-plugins --no-scripts
composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist --no-suggest
touch ./storage/database/database.sqlite
- name: Prepare Firefly
run: |
chmod -R 777 storage bootstrap/cache
php artisan migrate --seed
php artisan firefly-iii:upgrade-database
- name: Upload database
uses: actions/upload-artifact@v2
with:
name: database
path: storage/database/database.sqlite
- name: Upload cache
uses: actions/upload-artifact@v2
with:
name: cache
path: bootstrap/cache/
- name: Upload composer cache
uses: actions/upload-artifact@v2
with:
name: composer
path: ~/.composer
laravel-tests:
runs-on: ubuntu-latest
needs:
- prepare
steps:
- uses: actions/checkout@v2
- name: Copy .env
run: test -f .env || cp ci.env .env
- name: Download database
uses: actions/download-artifact@v2
with:
name: database
path: storage/database/database.sqlite
- name: Download cache
uses: actions/download-artifact@v2
with:
name: cache
path: bootstrap/cache/
- name: Download vendor
uses: actions/download-artifact@v2
with:
name: composer
path: ~/.composer
- name: install composer
run: composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist --no-suggest
- name: PHPUnit tests
uses: php-actions/phpunit@v1
with:
config: phpunit.xml
memory: 2048M
coding-standards:
runs-on: ubuntu-latest
needs:
- prepare
steps:
- uses: actions/checkout@v2
- name: Copy .env
run: test -f .env || cp ci.env .env
- name: Download database
uses: actions/download-artifact@v2
with:
name: database
path: storage/database/database.sqlite
- name: Download cache
uses: actions/download-artifact@v2
with:
name: cache
path: bootstrap/cache/
- name: Download vendor
uses: actions/download-artifact@v2
with:
name: composer
path: ~/.composer
- name: install depenencies
run: |
composer global require nette/coding-standard
composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist --no-suggest
- name: Execute tests (Unit and Feature tests) via PHPUnit
run: ecs check app tests --config ~/.composer/vendor/nette/coding-standard/coding-standard-php71.yml
phpstan:
runs-on: ubuntu-latest
needs:
- prepare
steps:
- uses: actions/checkout@v2
- name: Copy .env
run: test -f .env || cp ci.env .env
- name: Download database
uses: actions/download-artifact@v2
with:
name: database
path: storage/database/database.sqlite
- name: Download cache
uses: actions/download-artifact@v2
with:
name: cache
path: bootstrap/cache/
- name: Download vendor
uses: actions/download-artifact@v2
with:
name: composer
path: ~/.composer
- name: install depenencies
run: |
composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist --no-suggest
- name: Execute tests (Unit and Feature tests) via PHPUnit
run: vendor/bin/phpstan analyse