blessing-skin-server/azure-pipelines.yml
2019-02-18 09:37:44 +08:00

96 lines
2.4 KiB
YAML

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)'
- task: DownloadPipelineArtifact@0
continueOnError: true
inputs:
artifactName: php-vendor-$(phpVersion)
targetPath: vendor
- 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;'
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'
- task: PublishPipelineArtifact@0
continueOnError: true
inputs:
artifactName: php-vendor-$(phpVersion)
targetPath: vendor
- 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
displayName: Generate package
- task: PublishPipelineArtifact@0
inputs:
artifactName: 'blessing-skin-server.zip'
targetPath: dist