microsoft/typespec
Publicmirrored from https://github.com/microsoft/typespecAvailable
eng/pipelines/pull-request-common.yml
80lines · modecode
| 1 | parameters: |
| 2 | - name: nodeVersion |
| 3 | type: string |
| 4 | - name: poolName |
| 5 | type: string |
| 6 | |
| 7 | steps: |
| 8 | - task: NodeTool@0 |
| 9 | inputs: |
| 10 | versionSpec: ${{ parameters.nodeVersion }} |
| 11 | displayName: Install Node.js |
| 12 | |
| 13 | - task: UseDotNet@2 |
| 14 | inputs: |
| 15 | version: 6.0.x |
| 16 | |
| 17 | - script: | |
| 18 | echo "Node:" |
| 19 | node -v |
| 20 | echo "Npm:" |
| 21 | npm -v |
| 22 | echo "Dotnet:" |
| 23 | dotnet --version |
| 24 | displayName: "Log tool versions used" |
| 25 | |
| 26 | - script: node common/scripts/install-run-rush.js install |
| 27 | displayName: Install JavaScript Dependencies |
| 28 | |
| 29 | - script: dotnet restore |
| 30 | displayName: Restore .NET Dependencies |
| 31 | workingDirectory: packages/cadl-vs |
| 32 | |
| 33 | - script: node common/scripts/install-run-rush.js rebuild --verbose |
| 34 | displayName: Build |
| 35 | |
| 36 | - script: node common/scripts/install-run-rush.js test-official |
| 37 | displayName: Test |
| 38 | |
| 39 | - task: PublishTestResults@2 |
| 40 | inputs: |
| 41 | testResultsFormat: "JUnit" |
| 42 | testResultsFiles: "packages/*/test-results.xml" |
| 43 | mergeTestResults: true |
| 44 | failTaskOnFailedTests: true |
| 45 | testRunTitle: "Test os: ${{ parameters.poolName }}, node: ${{ parameters.nodeVersion }}" |
| 46 | displayName: Publish test results |
| 47 | condition: or(failed(), ne(variables['Build.Reason'], 'PullRequest')) |
| 48 | |
| 49 | - publish: ./packages/playground/test-results |
| 50 | artifact: "uitestresults-${{ parameters.poolName }}-node-${{ parameters.nodeVersion }}" |
| 51 | displayName: Publish UI tests artifacts |
| 52 | condition: failed() |
| 53 | |
| 54 | - template: ./upload-coverage.yml |
| 55 | |
| 56 | - script: node common/scripts/install-run-rush.js check-format |
| 57 | displayName: Check Formatting |
| 58 | |
| 59 | - script: node common/scripts/install-run-rush.js lint --verbose |
| 60 | displayName: Lint |
| 61 | |
| 62 | - script: cd packages/samples && npm run regen-samples |
| 63 | displayName: Regenerate Samples |
| 64 | |
| 65 | - script: node common/scripts/install-run-rush.js regen-docs |
| 66 | displayName: Regenerate Reference Docs |
| 67 | |
| 68 | - script: node eng/scripts/check-for-changed-files.js |
| 69 | displayName: Check Git Status For Changed Files |
| 70 | |
| 71 | - script: node common/scripts/install-run-rush.js cspell |
| 72 | displayName: Spell check |
| 73 | condition: ne(variables['Agent.OS'], 'Windows_NT') |
| 74 | |
| 75 | - script: node common/scripts/install-run-rush.js e2e |
| 76 | displayName: E2E Tests |
| 77 | # Skipping the e2e test on the prepare publish branch as there is a bug in the npm version installed on node 16 |
| 78 | # causing npx to try to download the unpublished version of the cli. |
| 79 | condition: eq('${{ parameters.nodeVersion }}', '18.x') |
| 80 | # condition: and(not(startsWith(variables['System.PullRequest.SourceBranch'], 'publish/')), not(eq('${{ parameters.nodeVersion }}', '16.x'))) |
| 81 | |