Created
July 8, 2018 03:22
-
-
Save chalcedonyt/4fd862ca92426622f8852b60ce2a209f to your computer and use it in GitHub Desktop.
Sample gitlab-ci for laravel
This file contains hidden or 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 is a template, and might need editing before it works on your project. | |
| # Select image from https://hub.docker.com/_/php/ | |
| stages: | |
| - build_npm | |
| - build_and_test | |
| # Select what we should cache between builds | |
| cache: | |
| paths: | |
| - vendor/ | |
| - .composercache | |
| - node_modules | |
| before_script: | |
| # https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc//ci/ssh_keys/README.md | |
| # Install ssh-agent if not already installed, it is required by Docker. | |
| # (change apt-get to yum if you use a CentOS-based image) | |
| - 'which ssh-agent || ( apk --no-cache add openssh-client)' | |
| # Run ssh-agent (inside the build environment) | |
| - eval $(ssh-agent -s) | |
| # Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store so that private repos can be pulled. | |
| - echo "$SSH_PRIVATE_KEY" > ./priv_key && chmod 400 ./priv_key | |
| - ssh-add ./priv_key && rm -f ./priv_key | |
| # For Docker builds disable host key checking. Be aware that by adding that | |
| # you are suspectible to man-in-the-middle attacks. | |
| # WARNING: Use this only with the Docker executor, if you use it with shell | |
| # you will overwrite your user's SSH config. | |
| - mkdir -p ~/.ssh | |
| - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config' | |
| - echo "$GITLAB_HOST_KEY" >> ~/.ssh/known_hosts | |
| # Bring in any services we need http://docs.gitlab.com/ee/ci/docker/using_docker_images.html#what-is-a-service | |
| # See http://docs.gitlab.com/ce/ci/services/README.html for examples. | |
| services: | |
| - mysql:5.7 | |
| # Set any variables we need | |
| variables: | |
| # Configure mysql environment variables (https://hub.docker.com/r/_/mysql/) | |
| MYSQL_DATABASE: "$DB_DATABASE" | |
| MYSQL_ROOT_PASSWORD: "$DB_PASSWORD" | |
| build_npm: | |
| stage: build_npm | |
| image: mhart/alpine-node:8.10.0 | |
| artifacts: | |
| paths: | |
| - public | |
| script: | |
| - npm i npm@latest -g | |
| - npm install | |
| - npm run dev | |
| # Run our tests | |
| build_and_test: | |
| stage: build_and_test | |
| image: timothyteoh/php-71-centos7-imagick-xdebug:latest | |
| coverage: '/^\s*Lines:\s*\d+.\d+\%/' | |
| artifacts: | |
| paths: | |
| - build/coverage-clover.xml | |
| - build/coverage-junit.xml | |
| expire_in: 3 days | |
| script: | |
| # Install and run Composer | |
| - curl -sS https://getcomposer.org/installer | php | |
| - php composer.phar config cache-files-dir .composercache | |
| - php composer.phar install --prefer-dist | |
| # Seed the database with predefined clients and test users | |
| - php artisan migrate --seed | |
| - vendor/bin/phpunit -d memory_limit=256M --colors=never --configuration phpunit.xml |
This file contains hidden or 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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <phpunit backupGlobals="false" | |
| backupStaticAttributes="false" | |
| bootstrap="vendor/autoload.php" | |
| colors="true" | |
| convertErrorsToExceptions="true" | |
| convertNoticesToExceptions="true" | |
| convertWarningsToExceptions="true" | |
| processIsolation="false" | |
| stopOnFailure="false"> | |
| <testsuites> | |
| <testsuite name="Feature"> | |
| <directory suffix="Test.php">./tests/Feature</directory> | |
| </testsuite> | |
| <testsuite name="Unit"> | |
| <directory suffix="Test.php">./tests/Unit</directory> | |
| </testsuite> | |
| </testsuites> | |
| <filter> | |
| <whitelist processUncoveredFilesFromWhitelist="true"> | |
| <directory suffix=".php">./app</directory> | |
| </whitelist> | |
| </filter> | |
| <php> | |
| <env name="APP_ENV" value="testing"/> | |
| <env name="CACHE_DRIVER" value="array"/> | |
| <env name="SESSION_DRIVER" value="array"/> | |
| <env name="QUEUE_DRIVER" value="sync"/> | |
| </php> | |
| <logging> | |
| <log type="coverage-text" target="php://stdout" showOnlySummary="true"/> | |
| <log type="coverage-html" target="./build/coverage/" lowUpperBound="35" highLowerBound="70" /> | |
| <log type="coverage-clover" target="./build/coverage-clover.xml" /> | |
| <log type="junit" target="./build/coverage-junit.xml" logIncompleteSkipped="false" /> | |
| </logging> | |
| </phpunit> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment