summaryrefslogtreecommitdiff
path: root/eng/test-job.yml
blob: bc9329fa0192e54ff0996b7515149fef7b5d8949 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
parameters:
  buildConfig: ''
  archType: ''
  osGroup: ''
  osIdentifier: ''
  priority: 0
  crossgen: false
  scenarios: ''
  helixQueuesPublic: ''
  helixQueuesInternal: ''
  timeoutInMinutes: ''
  crossrootfsDir: ''

### Test job

### Each test job depends on a corresponding build job with the same
### buildConfig and archType.

jobs:
- template: xplat-job.yml
  parameters:
    buildConfig: ${{ parameters.buildConfig }}
    archType: ${{ parameters.archType }}
    osGroup: ${{ parameters.osGroup }}
    osIdentifier: ${{ parameters.osIdentifier }}

    # Compute job name from template parameters
    ${{ if eq(parameters.crossgen, 'false') }}:
      name: ${{ format('testbuild_pri{0}_{1}_{2}_{3}', parameters.priority, parameters.osIdentifier, parameters.archType, parameters.buildConfig) }}
      displayName: ${{ format('Test Pri{0} {1} {2} {3}', parameters.priority, parameters.osIdentifier, parameters.archType, parameters.buildConfig) }}
    ${{ if eq(parameters.crossgen, 'true') }}:
      name: ${{ format('testbuild_pri{0}_r2r_{1}_{2}_{3}', parameters.priority, parameters.osIdentifier, parameters.archType, parameters.buildConfig) }}
      displayName: ${{ format('Test Pri{0} R2R {1} {2} {3}', parameters.priority, parameters.osIdentifier, parameters.archType, parameters.buildConfig) }}

    crossrootfsDir: ${{ parameters.crossrootfsDir }}

    ${{ if eq(parameters.crossgen, 'false') }}:
      helixType: ${{ format('test/functional/cli/pri{0}', parameters.priority) }}
    ${{ if eq(parameters.crossgen, 'true') }}:
      helixType: ${{ format('test/functional/r2r/cli/pri{0}', parameters.priority) }}

    variables:
    - group: DotNet-HelixApi-Access
    # Map template parameters to command line arguments
    - ${{ if eq(parameters.priority, '1') }}:
      - ${{ if ne(parameters.osGroup, 'Windows_NT') }}:
        - name: priorityArg
          value: 'priority1'
      - ${{ if eq(parameters.osGroup, 'Windows_NT') }}:
        - name: priorityArg
          value: '-priority=1'
    - ${{ if eq(parameters.priority, '0') }}:
      - name: priorityArg
        value: ''

    - ${{ if eq(parameters.crossgen, 'true') }}:
      - name: crossgenArg
        value: 'crossgen'
    - ${{ if eq(parameters.crossgen, 'false') }}:
      - name: crossgenArg
        value: ''

    # TODO: Enable crossgen in build-test.sh. It currently doesn't
    # accept a crossgen arg, so disable the macos/linux crossgen test
    # build jobs.
    ${{ if and(eq(parameters.crossgen, 'true'), in(parameters.osGroup, 'Linux', 'OSX')) }}:
      condition: false

    # FreeBSD test jobs are disabled since we don't have any FreeBSD helix queues.
    ${{ if eq(parameters.osGroup, 'FreeBSD') }}:
      condition: false

    # Test job depends on the corresponding build job
    dependsOn: ${{ format('build_{0}_{1}_{2}', parameters.osIdentifier, parameters.archType, parameters.buildConfig) }}

    # Run all steps in the container.
    # Note that the containers are resources defined in azure-pipelines.yml
    containerName: ${{ parameters.containerName }}

    timeoutInMinutes: ${{ parameters.timeoutInMinutes }}

    steps:

    # Install test build dependencies
    - ${{ if eq(parameters.osGroup, 'OSX') }}:
      - script: sh eng/install-native-dependencies.sh $(osGroup)
        displayName: Install native dependencies


    # Download product build from pipeline artifact storage
    - ${{ if ne(parameters.osGroup, 'Windows_NT') }}:
      - task: DownloadPipelineArtifact@0
        displayName: Download product build pipeline artifact
        inputs:
          artifactName: ${{ format('{0}_{1}_{2}_build', parameters.osIdentifier, parameters.archType, parameters.buildConfig) }}
          targetPath: $(Build.SourcesDirectory)/bin/Product/$(osGroup).$(archType).$(buildConfigUpper)
    - ${{ if eq(parameters.osGroup, 'Windows_NT') }}:
      - task: DownloadPipelineArtifact@0
        displayName: Download product build pipeline artifact
        inputs:
          artifactName: ${{ format('{0}_{1}_{2}_build', parameters.osIdentifier, parameters.archType, parameters.buildConfig) }}
          targetPath: $(Build.SourcesDirectory)\bin\Product\Windows_NT.$(archType).$(buildConfigUpper)


    # Build tests
    # TODO: enable crossgen in build-test.sh
    - ${{ if ne(parameters.osGroup, 'Windows_NT') }}:
      - script: ./build-test.sh $(buildConfig) $(archType) $(crossArg) $(priorityArg) $(crossgenArg)
        displayName: Build tests
    - ${{ if eq(parameters.osGroup, 'Windows_NT') }}:
      - script: build-test.cmd $(buildConfig) $(archType) $(priorityArg) $(crossgenArg)
        displayName: Build tests


    # Send tests to Helix
    - template: /eng/send-to-helix-step.yml
      parameters:
        displayName: Send tests to Helix
        buildConfig: ${{ parameters.buildConfig }}
        archType: ${{ parameters.archType }}
        osGroup: ${{ parameters.osGroup }}

        helixBuild: $(Build.BuildNumber)
        helixSource: $(_HelixSource)
        helixType: $(_HelixType)

        publishTestResults: true
        # TODO: see if this amount is enough for all individual jobs to finish
        # TODO: consider passing this value as a parameter to a test job
        timeoutInMinutes: 30

        ${{ if eq(variables['System.TeamProject'], 'internal') }}:
          # Access token variable for internal project from the
          # DotNet-HelixApi-Access variable group
          helixAccessToken: $(HelixApiAccessToken)
          helixQueues: ${{ parameters.helixQueuesInternal }}
          ${{ if eq(parameters.helixQueuesInternal, '') }}:
            condition: false

        ${{ if eq(variables['System.TeamProject'], 'public') }}:
          creator: coreclr-pulls
          helixQueues: ${{ parameters.helixQueuesPublic }}
          ${{ if eq(parameters.helixQueuesPublic, '') }}:
            condition: false

        scenarios: ${{ parameters.scenarios }}