Use CircleCI

This commit is contained in:
Pig Fang 2018-11-25 12:51:38 +08:00
parent 657ea8cffa
commit f810232331
2 changed files with 114 additions and 42 deletions

114
.circleci/config.yml Normal file
View File

@ -0,0 +1,114 @@
version: 2
jobs:
frontend:
working_directory: ~/repo
docker:
- image: circleci/node:10
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "yarn.lock" }}
- v1-dependencies-
- run: yarn
- save_cache:
paths:
- node_modules
- ~/.yarn
key: v1-dependencies-{{ checksum "yarn.lock" }}
- run: yarn lint
- run: yarn test --verbose --coverage
- run: yarn codecov
install:
working_directory: ~/repo
docker:
- image: circleci/php:7.1-cli
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "composer.lock" }}
- v1-dependencies-
- run:
name: Install PHP extension
command: |
# https://discuss.circleci.com/t/issue-with-installing-php-extension-gd/26550/6
sudo apt-get install -y libpng-dev
sudo -E docker-php-ext-install -j$(nproc) gd
- run: composer install -n --prefer-dist
- save_cache:
paths:
- vendor
key: v1-dependencies-{{ checksum "composer.lock" }}
- run: cp .env.testing .env
- run: php artisan key:random
- run: php artisan salt:random
- persist_to_workspace:
root: ~/repo
paths:
- .
test_php71:
working_directory: ~/repo
docker:
- image: circleci/php:7.1-cli
- image: circleci/mariadb:10.2
environment:
APP_ENV: testing
DB_USERNAME: root
DB_DATABASE: circle_test
steps:
- attach_workspace:
at: ~/repo
- run:
name: Install PHP extension
command: |
# https://discuss.circleci.com/t/issue-with-installing-php-extension-gd/26550/6
sudo apt-get install -y libpng-dev libsqlite3-dev libzip-dev
sudo docker-php-ext-install zip
sudo docker-php-ext-configure intl
sudo docker-php-ext-install intl
sudo -E docker-php-ext-install -j$(nproc) pdo_sqlite
sudo -E docker-php-ext-install -j$(nproc) gd
- run: touch storage/testing.sqlite
- run: ./vendor/bin/phpunit --coverage-clover=coverage.xml
- run: bash <(curl -s https://codecov.io/bash) -cF php
test_php72:
working_directory: ~/repo
docker:
- image: circleci/php:7.2-cli
environment:
APP_ENV: testing
DB_CONNECTION: sqlite
DB_DATABASE: storage/testing.sqlite
steps:
- attach_workspace:
at: ~/repo
- run:
name: Install PHP extension
command: |
# https://discuss.circleci.com/t/issue-with-installing-php-extension-gd/26550/6
sudo apt-get install -y libpng-dev libsqlite3-dev libzip-dev
sudo docker-php-ext-install zip
sudo docker-php-ext-configure intl
sudo docker-php-ext-install intl
sudo -E docker-php-ext-install -j$(nproc) pdo_sqlite
sudo -E docker-php-ext-install -j$(nproc) gd
- run: touch storage/testing.sqlite
- run: ./vendor/bin/phpunit
workflows:
version: 2
install_and_test:
jobs:
- frontend
- install
- test_php71:
requires:
- install
- test_php72:
requires:
- install

View File

@ -1,42 +0,0 @@
language: php
git:
submodules: false
cache:
directories:
- vendor
- node_modules
env:
global: APP_ENV=testing
services: mysql
install: composer install
before_script:
- mysql -e 'CREATE DATABASE IF NOT EXISTS test;'
- php artisan key:random
- php artisan salt:random
script: ./vendor/bin/phpunit
matrix:
include:
- php: 7.1
script:
- ./vendor/bin/phpunit --coverage-clover=coverage.xml
after_success:
- bash <(curl -s https://codecov.io/bash) -cF php
- php: 7.2
- node_js: 8
language: node_js
install: yarn
before_script:
- echo "Testing JavaScript Code" > /dev/null
script:
- yarn run lint
- yarn test --verbose --coverage
after_success:
- yarn run codecov