|
1 | 1 | parameters: |
2 | | - - name: commit |
| 2 | + - name: name |
3 | 3 | type: string |
4 | | - - name: quality |
| 4 | + - name: displayName |
5 | 5 | type: string |
6 | 6 | - name: poolName |
7 | 7 | type: string |
8 | 8 | - name: os |
9 | 9 | type: string |
| 10 | + - name: args |
| 11 | + type: string |
| 12 | + default: "" |
10 | 13 |
|
11 | 14 | jobs: |
12 | | - - job: ${{ parameters.os }} |
13 | | - displayName: ${{ parameters.os }} Sanity Tests |
| 15 | + - job: ${{ parameters.name }} |
| 16 | + displayName: ${{ parameters.displayName }} |
14 | 17 | pool: |
15 | 18 | name: ${{ parameters.poolName }} |
16 | 19 | os: ${{ parameters.os }} |
17 | 20 | timeoutInMinutes: 30 |
18 | 21 | variables: |
19 | 22 | SANITY_TEST_LOGS: $(Build.SourcesDirectory)/.build/sanity-test-logs |
| 23 | + LOG_FILE: $(SANITY_TEST_LOGS)/results.xml |
20 | 24 | templateContext: |
21 | 25 | outputs: |
22 | 26 | - output: pipelineArtifact |
23 | 27 | targetPath: $(SANITY_TEST_LOGS) |
24 | | - artifactName: sanity-test-logs-${{ lower(parameters.os) }}-$(System.JobAttempt) |
25 | | - displayName: Publish Sanity Test Logs |
| 28 | + artifactName: sanity-test-logs-${{ parameters.name }}-$(System.JobAttempt) |
| 29 | + displayName: Sanity Tests Logs |
26 | 30 | sbomEnabled: false |
27 | 31 | isProduction: false |
28 | 32 | condition: succeededOrFailed() |
29 | 33 | steps: |
30 | | - - checkout: self |
| 34 | + - template: ./checkout.yml@self |
31 | 35 |
|
32 | 36 | - task: NodeTool@0 |
33 | 37 | inputs: |
34 | 38 | versionSource: fromFile |
35 | 39 | versionFilePath: .nvmrc |
36 | 40 | displayName: Install Node.js |
37 | 41 |
|
38 | | - - ${{ if eq(parameters.os, 'windows') }}: |
39 | | - - script: | |
40 | | - mkdir "$(SANITY_TEST_LOGS)" |
41 | | - displayName: Create Logs Directory |
| 42 | + - bash: | |
| 43 | + npm config set registry "$(NPM_REGISTRY)" |
| 44 | + echo "##vso[task.setvariable variable=NPMRC_PATH]$(npm config get userconfig)" |
| 45 | + condition: and(succeeded(), ne(variables['NPM_REGISTRY'], 'none')) |
| 46 | + displayName: Configure NPM Registry |
42 | 47 |
|
43 | | - - ${{ else }}: |
44 | | - - script: | |
45 | | - mkdir -p "$(SANITY_TEST_LOGS)" |
46 | | - displayName: Create Logs Directory |
| 48 | + - task: npmAuthenticate@0 |
| 49 | + inputs: |
| 50 | + workingFile: $(NPMRC_PATH) |
| 51 | + condition: and(succeeded(), ne(variables['NPM_REGISTRY'], 'none')) |
| 52 | + displayName: Authenticate with NPM Registry |
47 | 53 |
|
48 | | - - script: npm install |
| 54 | + - script: npm ci |
| 55 | + workingDirectory: ./test/sanity |
49 | 56 | displayName: Install Dependencies |
50 | | - workingDirectory: $(Build.SourcesDirectory)/test/sanity |
51 | 57 |
|
52 | | - - script: npm run sanity-test -- --commit ${{ parameters.commit }} --quality ${{ parameters.quality }} --verbose --test-results $(SANITY_TEST_LOGS)/sanity-test.xml |
| 58 | + - script: npm run compile |
| 59 | + workingDirectory: ./test/sanity |
| 60 | + displayName: Compile Sanity Tests |
| 61 | + |
| 62 | + - script: npm run start -- -c $(BUILD_COMMIT) -q $(BUILD_QUALITY) -t $(LOG_FILE) -v ${{ parameters.args }} |
| 63 | + workingDirectory: ./test/sanity |
53 | 64 | displayName: Run Sanity Tests |
54 | 65 |
|
55 | 66 | - task: PublishTestResults@2 |
56 | 67 | inputs: |
57 | 68 | testResultsFormat: JUnit |
58 | | - testResultsFiles: $(SANITY_TEST_LOGS)/sanity-test.xml |
59 | | - testRunTitle: ${{ parameters.os }} Sanity Tests |
| 69 | + testResultsFiles: $(LOG_FILE) |
| 70 | + testRunTitle: ${{ parameters.displayName }} |
60 | 71 | condition: succeededOrFailed() |
61 | 72 | displayName: Publish Test Results |
0 commit comments