summaryrefslogtreecommitdiffstats
path: root/ansible_collections/community/general/.azure-pipelines/templates/test.yml
blob: 700cf629d7571e4f7fbde06db4c41bd55f6d3d6d (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
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later

# This template uses the provided list of jobs to create test one or more test jobs.
# It can be used directly if needed, or through the matrix template.

parameters:
  # A required list of dictionaries, one per test job.
  # Each item in the list must contain a "job" and "name" key.
  - name: jobs
    type: object

jobs:
  - ${{ each job in parameters.jobs }}:
    - job: test_${{ replace(replace(replace(job.test, '/', '_'), '.', '_'), '-', '_') }}
      displayName: ${{ job.name }}
      container: default
      workspace:
        clean: all
      steps:
        - checkout: self
          fetchDepth: $(fetchDepth)
          path: $(checkoutPath)
        - bash: .azure-pipelines/scripts/run-tests.sh "$(entryPoint)" "${{ job.test }}" "$(coverageBranches)"
          displayName: Run Tests
        - bash: .azure-pipelines/scripts/process-results.sh
          condition: succeededOrFailed()
          displayName: Process Results
        - bash: .azure-pipelines/scripts/aggregate-coverage.sh "$(Agent.TempDirectory)"
          condition: eq(variables.haveCoverageData, 'true')
          displayName: Aggregate Coverage Data
        - task: PublishTestResults@2
          condition: eq(variables.haveTestResults, 'true')
          inputs:
            testResultsFiles: "$(outputPath)/junit/*.xml"
          displayName: Publish Test Results
        - task: PublishPipelineArtifact@1
          condition: eq(variables.haveBotResults, 'true')
          displayName: Publish Bot Results
          inputs:
            targetPath: "$(outputPath)/bot/"
            artifactName: "Bot $(System.JobAttempt) $(System.StageDisplayName) $(System.JobDisplayName)"
        - task: PublishPipelineArtifact@1
          condition: eq(variables.haveCoverageData, 'true')
          displayName: Publish Coverage Data
          inputs:
            targetPath: "$(Agent.TempDirectory)/coverage/"
            artifactName: "Coverage $(System.JobAttempt) $(System.StageDisplayName) $(System.JobDisplayName)"