Skip to content

Commit

Permalink
Azure conditional pipeline builds
Browse files Browse the repository at this point in the history
* conditional test for augur-core

* add petong/monorepo-conditional branch as a trigger to test

* change BuildId to Build.SourceVersion

* add verbose and failure checking

* use a git command to get current sha

* roll back to Build.SourceVersion

* change place of conditional check

* move tests back

* add conditionals to test ui and augur-node
  • Loading branch information
petong authored and justinbarry committed Nov 7, 2018
1 parent ae02087 commit 2857190
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion azure-pipelines.yml
Expand Up @@ -12,6 +12,7 @@ trigger:
- master
- azure-pipelines
- monorepo-integration
- petong/monorepo-conditonal

jobs:
- job: Build_Core_Docker
Expand All @@ -24,6 +25,13 @@ jobs:
- task: NodeTool@0
inputs:
versionSpec: '9.x'
- bash: |
set -euxo pipefail
echo "git SHA - $(Build.SourceVersion)"
for f in $(git diff-tree --no-commit-id --name-only -r $(Build.SourceVersion));
do
echo $f | grep augur-core && echo "##vso[task.setVariable variable=AUGUR_CORE]true";
done
- script: |
set -euxo pipefail
which node
Expand All @@ -33,6 +41,7 @@ jobs:
yarn workspace augur-core docker:build;
docker tag $CORE_IMAGE_LATEST $CORE_IMAGE_BUILD;
docker push $CORE_IMAGE_BUILD
condition: eq(variables.AUGUR_CORE, 'true')
- job: Test_Augur_Core
dependsOn: Build_Core_Docker
Expand Down Expand Up @@ -73,6 +82,13 @@ jobs:
- task: NodeTool@0
inputs:
versionSpec: '10.x'
- bash: |
set -euxo pipefail
echo "git SHA - $(Build.SourceVersion)"
for f in $(git diff-tree --no-commit-id --name-only -r $(Build.SourceVersion));
do
echo $f | grep -q augur-core && echo "##vso[task.setVariable variable=AUGUR_CORE]true";
done
- script: |
set -euxo pipefail
which node
Expand All @@ -93,6 +109,7 @@ jobs:
else
yarn workspace augur-core docker:run:test:unit -- $TESTS;
fi
condition: eq(variables.AUGUR_CORE, 'true')
- job: Test_Augur_UI_and_Node
displayName: 'Test augur UI and augur-node'
Expand All @@ -107,21 +124,32 @@ jobs:
node_10_x:
node_version: 10.x
steps:
- bash: |
set -euxo pipefail
echo "git SHA - $(Build.SourceVersion)"
for f in $(git diff-tree --no-commit-id --name-only -r $(Build.SourceVersion));
do
echo $f | grep augur-ui && echo "##vso[task.setVariable variable=AUGUR]true";
echo $f | grep augur-node && echo "##vso[task.setVariable variable=AUGUR]true";
echo $f | grep augur.js && echo "##vso[task.setVariable variable=AUGUR]true";
done
- script: |
set -euxo pipefail
which node
node --version
yarn workspace augur-node add sqlite3 --force --build-from-source
yarn install --ignore-scripts --frozen-lockfile
condition: eq(variables.AUGUR, 'true')
displayName: 'Install Dependencies'
- script: |
yarn test --forceExit
displayName: 'Run Tests'
condition: eq(variables.AUGUR, 'true')
- task: PublishTestResults@2
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: 'junit.xml'
condition: always()
condition: eq(variables.AUGUR, 'true')

- job: Test_Augur_js
pool:
Expand All @@ -135,13 +163,21 @@ jobs:
node_10_x:
node_version: 10.x
steps:
- bash: |
set -euxo pipefail
echo "git SHA - $(Build.SourceVersion)"
for f in $(git diff-tree --no-commit-id --name-only -r $(Build.SourceVersion));
do
echo $f | grep augur.js && echo "##vso[task.setVariable variable=AUGUR]true";
done
- script: |
set -euxo pipefail
which node
node --version
yarn install --ignore-scripts --frozen-lockfile
npx lerna run test --stream --scope augur.js
displayName: 'test augur.js'
condition: eq(variables.AUGUR, 'true')
- job: Docker_monorepo
pool:
Expand Down

0 comments on commit 2857190

Please sign in to comment.