summaryrefslogtreecommitdiff
path: root/eng/test-job.yml
blob: 9baec1e0d1ccf9e842798942f0c7497c22ca48aa (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) }}

    ${{ 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) }}

    crossrootfsDir: ${{ parameters.crossrootfsDir }}

    variables:
    # Map template parameters to command line arguments
    - ${{ if eq(parameters.priority, '1') }}:
      - ${{ if or(eq(parameters.osGroup, 'Linux'), eq(parameters.osGroup, 'OSX')) }}:
        - 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: ''
    - ${{ if ne(parameters.scenarios, '') }}:
      - name: scenariosArg
        value: ${{ format('/p:Scenarios=\"{0}\"', parameters.scenarios) }}
    - ${{ if eq(parameters.scenarios, '') }}:
      - name: scenariosArg
        value: ''
    - ${{ if eq(variables['System.TeamProject'], 'public') }}:
      - name: helixTargetQueuesArg
        value: ${{ format('/p:HelixTargetQueues=\"{0}\"', parameters.helixQueuesPublic) }}
    - ${{ if ne(variables['System.TeamProject'], 'public') }}:
      - name: helixTargetQueuesArg
        value: ${{ format('/p:HelixTargetQueues=\"{0}\"', parameters.helixQueuesInternal) }}
    - name: commonMSBuildArgs
      value: ${{ format('/maxcpucount /p:__BuildOS={0} /p:__BuildArch={1} /p:__BuildType={2}', parameters.osGroup, parameters.archType, parameters.buildConfig) }}

    # 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'), or(eq(parameters.osGroup, 'Linux'), eq(parameters.osGroup, 'OSX'))) }}:
      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 or(eq(parameters.osGroup, 'Linux'), eq(parameters.osGroup, 'OSX')) }}:
      - 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
    - ${{ if or(eq(parameters.osGroup, 'Linux'), eq(parameters.osGroup, 'OSX')) }}:
      - script: ./Tools/dotnetcli/dotnet msbuild tests/helixpublishwitharcade.proj $(commonMSBuildArgs) $(scenariosArg) $(helixTargetQueuesArg)
        displayName: Send test jobs to Helix
        env:
          ${{ if eq(variables['System.TeamProject'], 'internal') }}:
            # Access token variable for internal project
            HelixAccessToken: $(DotNet-HelixApi-Access)
          ${{ if eq(variables['System.TeamProject'], 'public') }}:
            # Access token variable for public project
            HelixAccessToken: $(BotAccount-dotnet-github-anon-kaonashi-bot-helix-token)
          SYSTEM_ACCESSTOKEN: $(System.AccessToken)
    - ${{ if eq(parameters.osGroup, 'Windows_NT') }}:
      - script: .\Tools\dotnetcli\dotnet msbuild tests\helixpublishwitharcade.proj $(commonMSBuildArgs) $(scenariosArg) $(helixTargetQueuesArg)
        displayName: Send test jobs to Helix
        env:
          ${{ if eq(variables['System.TeamProject'], 'internal') }}:
            # Access token variable for internal project
            HelixAccessToken: $(DotNet-HelixApi-Access)
          ${{ if eq(variables['System.TeamProject'], 'public') }}:
            # Access token variable for public project
            HelixAccessToken: $(BotAccount-dotnet-github-anon-kaonashi-bot-helix-token)
          SYSTEM_ACCESSTOKEN: $(System.AccessToken)