Pipelines: combine some scripts

master
Futago-za Ryuu 5 years ago
parent 06f782d397
commit f13d0268d6

@ -16,22 +16,31 @@ jobs:
- template: node-test.yml@apt - template: node-test.yml@apt
parameters: parameters:
npm_test: False
before: before:
- script: | - script: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter chmod +x ./cc-test-reporter
./cc-test-reporter before-build displayName: 'Download Code Climate Test Reporter'
displayName: 'Download and Initialize Code Climate Test Reporter'
after: after:
- script: ./cc-test-reporter after-build --exit-code 0 - script: |
displayName: 'Publish succeeded code coverage results (codeclimate.com)' ./cc-test-reporter before-build
condition: succeeded() yarn test 2> /dev/null
- script: ./cc-test-reporter after-build --exit-code 1 if [ $? -eq 0 ]
displayName: 'Publish failed code coverage results (codeclimate.com)' then
condition: failed() echo '"yarn test" passed, publishing to code climate.'
- script: yarn coverage ./cc-test-reporter after-build --exit-code 0
displayName: 'Publish code coverage results (coveralls.io)' echo 'Publishing code coverage results to coveralls.io'
yarn coverage
exit 0
else
echo '"yarn test" failed, publishing to code climate.'
./cc-test-reporter after-build --exit-code 1
exit 1
fi
displayName: 'mocha > codeclimate & coveralls'
env: env:
CC_TEST_REPORTER_ID: $(CC_TEST_REPORTER_ID)
COVERALLS_SERVICE_NAME: $(COVERALLS_SERVICE_NAME) COVERALLS_SERVICE_NAME: $(COVERALLS_SERVICE_NAME)
COVERALLS_REPO_TOKEN: $(COVERALLS_REPO_TOKEN) COVERALLS_REPO_TOKEN: $(COVERALLS_REPO_TOKEN)
GIT_BRANCH: $(Build.SourceBranch) GIT_BRANCH: $(Build.SourceBranch)

Loading…
Cancel
Save