Circle CI (#7)

* circleci

* use custom docker images

* remove azure pipelines

* update badge [skip ci]
This commit is contained in:
Pig Fang 2019-02-28 13:06:31 +08:00 committed by GitHub
parent e8bdf93e92
commit 2aa3e6732e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 94 additions and 85 deletions

92
.circleci/config.yml Normal file
View File

@ -0,0 +1,92 @@
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 --coverage
- run: yarn codecov
install:
working_directory: ~/repo
docker:
- image: blessingskin/ci:7.1
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "composer.lock" }}
- v1-dependencies-
- 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: blessingskin/ci:7.1
steps:
- attach_workspace:
at: ~/repo
- 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: blessingskin/ci:7.2
steps:
- attach_workspace:
at: ~/repo
- run: touch storage/testing.sqlite
- run: ./vendor/bin/phpunit
test_php73:
working_directory: ~/repo
docker:
- image: blessingskin/ci:7.3
steps:
- attach_workspace:
at: ~/repo
- 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
- test_php73:
requires:
- install

View File

@ -4,7 +4,7 @@
<p align="center"><img src="https://img.blessing.studio/images/2017/01/01/bs-logo.png"></p>
<p align="center">
<a href="https://dev.azure.com/blessing-skin/Blessing%20Skin%20Server/_build?definitionId=3"><img src="https://flat.badgen.net/azure-pipelines/blessing-skin/Blessing%20Skin%20Server/blessing-skin-server/v4" alt="Azure Pipelines Status"></a>
<a href="https://circleci.com/gh/bs-community/blessing-skin-server/tree/v4"><img src="https://flat.badgen.net/circleci/github/bs-community/blessing-skin-server/v4" alt="Azure Pipelines Status"></a>
<a href="https://codecov.io/gh/bs-community/blessing-skin-server/branch/v4"><img src="https://flat.badgen.net/codecov/c/github/bs-community/blessing-skin-server/v4" alt="Codecov" /></a>
<a href="https://github.com/bs-community/blessing-skin-server/releases"><img src="https://flat.badgen.net/github/releases/bs-community/blessing-skin-server" alt="Latest Stable Version"></a>
<img src="https://flat.badgen.net/badge/PHP/7.1.8+/orange" alt="PHP 7.1.8+">

View File

@ -4,7 +4,7 @@
<p align="center"><img src="https://img.blessing.studio/images/2017/01/01/bs-logo.png"></p>
<p align="center">
<a href="https://dev.azure.com/blessing-skin/Blessing%20Skin%20Server/_build?definitionId=3"><img src="https://flat.badgen.net/azure-pipelines/blessing-skin/Blessing%20Skin%20Server/blessing-skin-server/v4" alt="Azure Pipelines Status"></a>
<a href="https://circleci.com/gh/bs-community/blessing-skin-server/tree/v4"><img src="https://flat.badgen.net/circleci/github/bs-community/blessing-skin-server/v4" alt="Azure Pipelines Status"></a>
<a href="https://codecov.io/gh/bs-community/blessing-skin-server/branch/v4"><img src="https://flat.badgen.net/codecov/c/github/bs-community/blessing-skin-server/v4" alt="Codecov" /></a>
<a href="https://github.com/bs-community/blessing-skin-server/releases"><img src="https://flat.badgen.net/github/releases/bs-community/blessing-skin-server" alt="Latest Stable Version"></a>
<img src="https://flat.badgen.net/badge/PHP/7.1.8+/orange" alt="PHP 7.1.8+">

View File

@ -1,83 +0,0 @@
jobs:
- job: php
displayName: PHP
pool:
vmImage: 'Ubuntu-16.04'
strategy:
matrix:
'7.1':
phpVersion: 7.1
'7.2':
phpVersion: 7.2
variables:
APP_ENV: testing
DB_CONNECTION: mysql
DB_DATABASE: test
DB_USERNAME: root
DB_PASSWORD: root
steps:
- script: |
sudo update-alternatives --set php /usr/bin/php$(phpVersion)
sudo update-alternatives --set phar /usr/bin/phar$(phpVersion)
sudo update-alternatives --set phpdbg /usr/bin/phpdbg$(phpVersion)
sudo update-alternatives --set php-cgi /usr/bin/php-cgi$(phpVersion)
sudo update-alternatives --set phar.phar /usr/bin/phar.phar$(phpVersion)
php -version
displayName: 'Use PHP version $(phpVersion)'
- script: composer install --no-interaction --prefer-dist
displayName: Install dependencies
- script: |
cp .env.testing .env
php artisan key:random
php artisan salt:random
mysql -uroot -proot -e 'CREATE DATABASE IF NOT EXISTS test;'
displayName: 'Prepare testing environment'
- script: ./vendor/bin/phpunit --log-junit junit.xml
displayName: Test
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testRunner: JUnit
testResultsFiles: './junit.xml'
- job: javascript
displayName: JavaScript
pool:
vmImage: 'Ubuntu-16.04'
steps:
- script: yarn
displayName: Install dependencies
- script: |
yarn lint
yarn test --ci --reporters=default --reporters=jest-junit --coverage
displayName: 'Run Test'
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testRunner: JUnit
testResultsFiles: './junit.xml'
- job: build
displayName: Build & Compile
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
dependsOn:
- php
- javascript
pool:
vmImage: 'Ubuntu-16.04'
steps:
- script: yarn
displayName: Install dependencies
- script: mkdir dist
- script: yarn release dist/blessing-skin-server.zip --ci
displayName: Generate package
- task: PublishPipelineArtifact@0
inputs:
artifactName: 'blessing-skin-server.zip'
targetPath: dist