blessing-skin-server/azure-pipelines.yml
2019-02-18 11:53:27 +08:00

86 lines
2.2 KiB
YAML

jobs:
- job: php
displayName: PHP
pool:
vmImage: 'Ubuntu-16.04'
strategy:
parallel: 3
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: 'composer install'
- script: |
cp .env.testing .env
php artisan key:random
php artisan salt:random
mysql -uroot -proot -e 'CREATE DATABASE IF NOT EXISTS test;'
mkdir junitReports
displayName: 'Prepare testing environment'
- script: node scripts/distribute-test.js
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