|
| 1 | +# Copyright IBM Corp. All Rights Reserved. |
| 2 | +# |
| 3 | +# SPDX-License-Identifier: Apache-2.0 |
| 4 | +# |
| 5 | +# fabric-chaincode-node azure pipeline configuration. |
| 6 | +# |
| 7 | +name: RELEASE-$(Date:yyyyMMdd)$(Rev:.rrr) |
| 8 | + |
| 9 | +trigger: |
| 10 | + branches: |
| 11 | + include: |
| 12 | + - 'master' |
| 13 | + - 'release-1.4' |
| 14 | + tags: |
| 15 | + include: |
| 16 | + - '*' |
| 17 | + |
| 18 | +# These are custom defined variables, the pipeline one is currently used for the build scripts |
| 19 | +# to know to produce tests results in XML format for Azure to consume, for developers |
| 20 | +# this isn't set so command line output is given |
| 21 | +# |
| 22 | +variables: |
| 23 | + - group: Chaincode_Node_Vars |
| 24 | + component: fabric-chaincode-node |
| 25 | + pipeline: ci |
| 26 | + |
| 27 | +# Build on Ubutu |
| 28 | +pool: |
| 29 | + vmImage: 'ubuntu-latest' |
| 30 | + |
| 31 | +# |
| 32 | +# The stages and jobs, potential for rationalization and optimization |
| 33 | +# Keeping it simple and explict whilst we gain experience |
| 34 | +stages: |
| 35 | + - stage: Build_and_Test |
| 36 | + jobs: |
| 37 | + - job: main |
| 38 | + displayName: 'Build, lint, UT' |
| 39 | + steps: |
| 40 | + - task: NodeTool@0 |
| 41 | + inputs: |
| 42 | + versionSpec: '10.x' |
| 43 | + - script: | |
| 44 | + node common/scripts/install-run-rush.js install |
| 45 | + node common/scripts/install-run-rush.js update |
| 46 | + displayName: 'Setup the node environment' |
| 47 | + - script: | |
| 48 | + node common/scripts/install-run-rush.js rebuild |
| 49 | + displayName: 'Full rebuild' |
| 50 | + - task: PublishTestResults@2 |
| 51 | + condition: or(succeeded(), failed()) # publish either way |
| 52 | + inputs: |
| 53 | + testResultsFiles: '**/test-results.xml' |
| 54 | + artifactName: 'Unit Test results' |
| 55 | + testRunTitle: 'Unit Test results' |
| 56 | + - task: PublishCodeCoverageResults@1 |
| 57 | + condition: or(succeeded(), failed()) # publish either way |
| 58 | + inputs: |
| 59 | + codeCoverageTool: 'cobertura' |
| 60 | + summaryFileLocation: '**/cobertura-coverage.xml' |
| 61 | + artifactName: 'Unit Test Coverage' |
| 62 | + - script: | |
| 63 | + node common/scripts/install-run-rush.js publish --include-all --pack --release-folder $(Build.ArtifactStagingDirectory)/tgz --publish |
| 64 | + displayName: 'Package as tgz' |
| 65 | + - job: fvt |
| 66 | + displayName: 'FV Tests' |
| 67 | + dependsOn: main |
| 68 | + steps: |
| 69 | + - task: NodeTool@0 |
| 70 | + inputs: |
| 71 | + versionSpec: '10.x' |
| 72 | + - script: | |
| 73 | + node common/scripts/install-run-rush.js install |
| 74 | + node common/scripts/install-run-rush.js update |
| 75 | + node common/scripts/install-run-rush.js rebuild # replace this with pull from the artifacts staging |
| 76 | + displayName: 'Setup the node environment' |
| 77 | + - script: | |
| 78 | + node common/scripts/install-run-rush.js start-fabric |
| 79 | + node common/scripts/install-run-rush.js start-verdaccio |
| 80 | + docker images | grep hyperledger && docker ps -a |
| 81 | + node common/scripts/install-run-rush.js test:fv |
| 82 | + node common/scripts/install-run-rush.js test:e2e |
| 83 | + displayName: 'FV Tests' |
| 84 | + - task: PublishTestResults@2 |
| 85 | + condition: or(succeeded(), failed()) # publish either way |
| 86 | + inputs: |
| 87 | + testResultsFiles: '**/test-results.xml' |
| 88 | + artifactName: 'FV Test results' |
| 89 | + testRunTitle: 'FV Test results' |
| 90 | + - job: apidocs |
| 91 | + steps: |
| 92 | + - task: NodeTool@0 |
| 93 | + inputs: |
| 94 | + versionSpec: '8.x' |
| 95 | + - script: | |
| 96 | + npm install |
| 97 | + npm install -g gulp-cli |
| 98 | + displayName: 'Setup the node environment' |
| 99 | + - script: | |
| 100 | + gulp docs |
| 101 | + displayName: 'Produce API docs' |
| 102 | + - publish: $(System.DefaultWorkingDirectory)/docs/gen/ |
| 103 | + artifact: 'jsdocs' |
| 104 | + - stage: Publish_tag |
| 105 | + condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags')) |
| 106 | + jobs: |
| 107 | + - job: update_version |
| 108 | + steps: |
| 109 | + - script: | |
| 110 | + env | sort |
| 111 | + echo "Update the version number" |
| 112 | + echo "Make sure release notes are present" |
| 113 | + echo "Make sure change history is present" |
| 114 | + - job: npm_publish |
| 115 | + steps: |
| 116 | + - script: | |
| 117 | + echo "Setup .npmrc" |
| 118 | + echo "Use pipeline secret to login" |
| 119 | + echo "publish" |
| 120 | + - job: jsdoc_publish |
| 121 | + steps: |
| 122 | + - script: | |
| 123 | + echo "checkout docs branch" |
| 124 | + echo "checking" |
0 commit comments