Skip to content

Instantly share code, notes, and snippets.

@mohamad-supangat
Forked from amitavroy/.gitlab-ci.yml
Created May 6, 2024 06:26
Show Gist options
  • Save mohamad-supangat/b2bfeb84a8536e5d64bf3d254b4f510e to your computer and use it in GitHub Desktop.
Save mohamad-supangat/b2bfeb84a8536e5d64bf3d254b4f510e to your computer and use it in GitHub Desktop.
Continuous Integration with Gitlab
stages:
- test
# Variables: these have to match
# the .env.example credentials in your Laravel app
# use the default homestead/secret combination, since
# that database gets created in the edbizarro/gitlab-ci-pipeline-php:7.1
# docker image.
variables:
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: homestead
MYSQL_PASSWORD: secret
MYSQL_DATABASE: homestead
DB_HOST: mysql
# Speed up builds
cache:
key: $CI_COMMIT_REF_NAME # changed to $CI_COMMIT_REF_NAME in Gitlab 9.x
paths:
- vendor
- node_modules
- public
- .yarn
test:
stage: test
services:
- mysql:5.7
image: edbizarro/gitlab-ci-pipeline-php:7.1
script:
- yarn config set cache-folder .yarn
- yarn install --pure-lockfile
- composer install --prefer-dist --no-ansi --no-interaction --no-progress --no-scripts
- cp .env.example .env
- php artisan key:generate
- php artisan migrate:refresh --seed
- ./vendor/phpunit/phpunit/phpunit -v --coverage-text --colors=never --stderr
artifacts:
paths:
- ./storage/logs # for debugging
expire_in: 1 days
when: always
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment