Skip to content

Instantly share code, notes, and snippets.

@PeterDKC
Last active April 5, 2020 23:56
Show Gist options
  • Save PeterDKC/f27d2085c6f3e04a6b9e4b18bab28edc to your computer and use it in GitHub Desktop.
Save PeterDKC/f27d2085c6f3e04a6b9e4b18bab28edc to your computer and use it in GitHub Desktop.
Working .gitlab-ci.yml for a non-Dockerized Laravel App
stages:
- build
- test
# Speed up builds
cache:
key: $CI_BUILD_REF_NAME # changed to $CI_COMMIT_REF_NAME in Gitlab 9.x
paths:
- vendor/
image: edbizarro/gitlab-ci-pipeline-php:7.2-alpine
build:
stage: build
script:
- composer install --prefer-dist --no-ansi --no-interaction --no-progress --no-suggest
- cp .env.testing.example .env.testing && php artisan key:gen --env=testing
- echo "Testing Environment Set."
artifacts:
paths:
- vendor/
- .env.testing
expire_in: 7 days
when: always
test-phpunit:
stage: test
script:
- composer test
test-phpcs:
stage: test
script:
- composer cs
test-phpmd:
stage: test
script:
- composer phpmd
{
"scripts": {
"test": "phpdbg -qrr -b vendor/bin/phpunit",
"coverage": "phpdbg -qrr -dmemory_limit=2G vendor/bin/phpunit --coverage-html coverage && open coverage/index.html",
"cs": "vendor/bin/php-cs-fixer fix --dry-run --diff --config=.php_cs.dist --using-cache=no -v --ansi",
"cs-fix": "vendor/bin/php-cs-fixer fix --config=.php_cs.dist --using-cache=no -v --ansi",
"phpmd": "vendor/bin/phpmd app text phpmd.xml",
"ci": "composer test && composer cs && composer phpmd"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment