mirror of
https://github.com/ansible-collections/community.docker.git
synced 2026-04-04 18:48:56 +00:00
Create sanity matrix.
This commit is contained in:
parent
7eaad3b866
commit
f648318088
@ -38,6 +38,11 @@ variables:
|
|||||||
value: .azure-pipelines/scripts/run-nox.sh
|
value: .azure-pipelines/scripts/run-nox.sh
|
||||||
- name: fetchDepth
|
- name: fetchDepth
|
||||||
value: 0
|
value: 0
|
||||||
|
- name: minAnsibleCore
|
||||||
|
value: "2.17"
|
||||||
|
- name: noxSource
|
||||||
|
# value: https://github.com/ansible-community/antsibull-nox/archive/main.tar.gz
|
||||||
|
value: https://github.com/felixfontein/antsibull-nox/archive/azp.tar.gz
|
||||||
|
|
||||||
resources:
|
resources:
|
||||||
containers:
|
containers:
|
||||||
@ -50,33 +55,65 @@ stages:
|
|||||||
|
|
||||||
- stage: nox
|
- stage: nox
|
||||||
displayName: Run extra sanity tests
|
displayName: Run extra sanity tests
|
||||||
|
dependsOn: []
|
||||||
jobs:
|
jobs:
|
||||||
- template: templates/run-nox.yml
|
- job: extra_sanity
|
||||||
parameters:
|
displayName: Extra sanity tests
|
||||||
jobs:
|
container: default
|
||||||
- job: extra_sanity
|
workspace:
|
||||||
name: Extra sanity tests
|
clean: all
|
||||||
|
steps:
|
||||||
|
- template: templates/run-nox.yml
|
||||||
|
parameters:
|
||||||
sessions: ""
|
sessions: ""
|
||||||
|
|
||||||
# - stage: create-matrixes
|
- stage: create_matrixes
|
||||||
# displayName: Create matrixes
|
displayName: Create matrixes
|
||||||
# jobs:
|
dependsOn: []
|
||||||
# - job: A
|
jobs:
|
||||||
# steps:
|
- template: templates/create-nox-matrix.yml
|
||||||
# - task: Bash@3
|
|
||||||
# inputs:
|
|
||||||
# filePath: 'script-a.sh'
|
|
||||||
# name: setvar
|
|
||||||
# - bash: |
|
|
||||||
# echo "##vso[task.setVariable variable=legs;isOutput=true]{'a':{'myvar':'A'}, 'b':{'myvar':'B'}}"
|
|
||||||
# name: mtrx
|
|
||||||
|
|
||||||
# - stage: sanity
|
- stage: sanity
|
||||||
# displayName: Sanity tests
|
displayName: Sanity tests
|
||||||
# dependsOn: create-matrixes
|
dependsOn: create_matrixes
|
||||||
# - job: runner
|
jobs:
|
||||||
# dependsOn: generator
|
- job: sanity
|
||||||
# strategy:
|
strategy:
|
||||||
# matrix: $[ stageDependencies.create-matrixes.A.outputs['mtrx.legs'] ]
|
matrix: >-
|
||||||
# steps:
|
$[ coalesce(stageDependencies.create_matrixes.create_matrixes.outputs['matrix.sanity'], '{"none": {"display_name": "(none)", "skip": true}}') ]
|
||||||
# - script: echo $(myvar) # echos A or B depending on which leg is running
|
displayName: "$[ variables.display_name ]"
|
||||||
|
container: default
|
||||||
|
workspace:
|
||||||
|
clean: all
|
||||||
|
steps:
|
||||||
|
- template: templates/run-nox.yml
|
||||||
|
parameters:
|
||||||
|
sessions: $(name)
|
||||||
|
|
||||||
|
- stage: foo
|
||||||
|
displayName: Foo tests
|
||||||
|
dependsOn: create_matrixes
|
||||||
|
jobs:
|
||||||
|
- job: foo
|
||||||
|
strategy:
|
||||||
|
matrix: >-
|
||||||
|
$[ coalesce(stageDependencies.create_matrixes.create_matrixes.outputs['matrix.foo'], '{"none": {"display_name": "(none)", "skip": true}}') ]
|
||||||
|
displayName: "$[ variables.display_name ]"
|
||||||
|
container: default
|
||||||
|
workspace:
|
||||||
|
clean: all
|
||||||
|
steps:
|
||||||
|
- template: templates/run-nox.yml
|
||||||
|
parameters:
|
||||||
|
sessions: $(name)
|
||||||
|
|
||||||
|
- stage: Summary
|
||||||
|
condition: succeededOrFailed()
|
||||||
|
dependsOn:
|
||||||
|
- nox
|
||||||
|
- sanity
|
||||||
|
# - units
|
||||||
|
# - integration
|
||||||
|
- foo
|
||||||
|
jobs:
|
||||||
|
- template: templates/coverage.yml
|
||||||
|
|||||||
@ -5,9 +5,10 @@
|
|||||||
|
|
||||||
set -o pipefail -e
|
set -o pipefail -e
|
||||||
|
|
||||||
SESSIONS=""
|
declare -a SESSIONS
|
||||||
if [ "$1" != "" ]; then
|
if [ "$1" != "" ]; then
|
||||||
SESSIONS="--sessions $1"
|
IFS=' ' read -ra SESSIONS <<< "$1"
|
||||||
|
SESSIONS=('--sessions' "${SESSIONS[@]}")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export FORCE_COLOR=1
|
export FORCE_COLOR=1
|
||||||
@ -15,4 +16,4 @@ export ANTSIBULL_NOX_IGNORE_INSTALLED_COLLECTIONS=true
|
|||||||
|
|
||||||
# ANTSIBULL_CHANGE_DETECTION: "${{ inputs.change-detection }}"
|
# ANTSIBULL_CHANGE_DETECTION: "${{ inputs.change-detection }}"
|
||||||
# ANTSIBULL_BASE_BRANCH: "${{ inputs.change-detection-base-branch }}"
|
# ANTSIBULL_BASE_BRANCH: "${{ inputs.change-detection-base-branch }}"
|
||||||
nox --verbose --reuse-existing-virtualenvs --no-install ${SESSIONS} 2>&1 | "$(dirname "$0")/time-command.py"
|
nox --verbose --reuse-existing-virtualenvs --no-install "${SESSIONS[@]}" 2>&1 | "$(dirname "$0")/time-command.py"
|
||||||
|
|||||||
@ -5,13 +5,14 @@
|
|||||||
|
|
||||||
set -o pipefail -e
|
set -o pipefail -e
|
||||||
|
|
||||||
SESSIONS=""
|
declare -a SESSIONS
|
||||||
if [ "$1" != "" ]; then
|
if [ "$1" != "" ]; then
|
||||||
SESSIONS="--sessions $1"
|
IFS=' ' read -ra SESSIONS <<< "$1"
|
||||||
|
SESSIONS=('--sessions' "${SESSIONS[@]}")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export FORCE_COLOR=1
|
export FORCE_COLOR=1
|
||||||
export ANTSIBULL_NOX_IGNORE_INSTALLED_COLLECTIONS=true
|
export ANTSIBULL_NOX_IGNORE_INSTALLED_COLLECTIONS=true
|
||||||
|
|
||||||
echo "Set up nox environments"
|
echo "Set up nox environments"
|
||||||
nox --verbose --install-only ${SESSIONS} 2>&1 | "$(dirname "$0")/time-command.py"
|
nox --verbose --install-only "${SESSIONS[@]}" 2>&1 | "$(dirname "$0")/time-command.py"
|
||||||
|
|||||||
24
.azure-pipelines/templates/create-nox-matrix.yml
Normal file
24
.azure-pipelines/templates/create-nox-matrix.yml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
---
|
||||||
|
# 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 runs antsibull-nox' matrix generator
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
- job: create_matrixes
|
||||||
|
displayName: Create matrixes
|
||||||
|
container: default
|
||||||
|
workspace:
|
||||||
|
clean: all
|
||||||
|
steps:
|
||||||
|
- checkout: self
|
||||||
|
fetchDepth: $(fetchDepth)
|
||||||
|
- bash: pip install $(noxSource)
|
||||||
|
displayName: Install nox and antsibull-nox
|
||||||
|
- bash: |
|
||||||
|
export FORCE_COLOR=1
|
||||||
|
export AZP_STDOUT=true
|
||||||
|
nox --session matrix-generator -- --min-ansible-core $(minAnsibleCore) 2>&1
|
||||||
|
displayName: Run nox
|
||||||
|
name: matrix
|
||||||
@ -3,50 +3,41 @@
|
|||||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
# 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
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
# This template uses the provided list of jobs to create test one or more nox jobs.
|
# This template creates steps for job that runs a nox session
|
||||||
|
|
||||||
parameters:
|
parameters:
|
||||||
# A required list of dictionaries, one per nox job.
|
- name: sessions
|
||||||
# Each item in the list must contain a "job", "name", and "sessions" key.
|
type: string
|
||||||
- name: jobs
|
|
||||||
type: object
|
|
||||||
|
|
||||||
jobs:
|
steps:
|
||||||
- ${{ each job in parameters.jobs }}:
|
- checkout: self
|
||||||
- job: ${{ job.job }}
|
fetchDepth: $(fetchDepth)
|
||||||
displayName: ${{ job.name }}
|
- bash: pip install $(noxSource)
|
||||||
container: default
|
displayName: Install nox and antsibull-nox
|
||||||
workspace:
|
- bash: .azure-pipelines/scripts/setup-nox.sh "${{ parameters.sessions }}"
|
||||||
clean: all
|
displayName: Setup nox environments
|
||||||
steps:
|
- bash: .azure-pipelines/scripts/run-nox.sh "${{ parameters.sessions }}"
|
||||||
- checkout: self
|
displayName: Run nox
|
||||||
fetchDepth: $(fetchDepth)
|
- bash: .azure-pipelines/scripts/process-results.sh
|
||||||
- bash: pip install https://github.com/ansible-community/antsibull-nox/archive/main.tar.gz
|
condition: succeededOrFailed()
|
||||||
displayName: Install nox and antsibull-nox
|
displayName: Process Results
|
||||||
- bash: .azure-pipelines/scripts/setup-nox.sh "${{ job.sessions }}"
|
- bash: .azure-pipelines/scripts/aggregate-coverage.sh "$(Agent.TempDirectory)"
|
||||||
displayName: Setup nox environments
|
condition: eq(variables.haveCoverageData, 'true')
|
||||||
- bash: .azure-pipelines/scripts/run-nox.sh "${{ job.sessions }}"
|
displayName: Aggregate Coverage Data
|
||||||
displayName: Run nox
|
- task: PublishTestResults@2
|
||||||
- bash: .azure-pipelines/scripts/process-results.sh
|
condition: eq(variables.haveTestResults, 'true')
|
||||||
condition: succeededOrFailed()
|
inputs:
|
||||||
displayName: Process Results
|
testResultsFiles: "$(outputPath)/junit/*.xml"
|
||||||
# - bash: .azure-pipelines/scripts/aggregate-coverage.sh "$(Agent.TempDirectory)"
|
displayName: Publish Test Results
|
||||||
# condition: eq(variables.haveCoverageData, 'true')
|
- task: PublishPipelineArtifact@1
|
||||||
# displayName: Aggregate Coverage Data
|
condition: eq(variables.haveBotResults, 'true')
|
||||||
# - task: PublishTestResults@2
|
displayName: Publish Bot Results
|
||||||
# condition: eq(variables.haveTestResults, 'true')
|
inputs:
|
||||||
# inputs:
|
targetPath: "$(outputPath)/bot/"
|
||||||
# testResultsFiles: "$(outputPath)/junit/*.xml"
|
artifactName: "Bot $(System.JobAttempt) $(System.StageDisplayName) $(System.JobDisplayName)"
|
||||||
# displayName: Publish Test Results
|
- task: PublishPipelineArtifact@1
|
||||||
# - task: PublishPipelineArtifact@1
|
condition: eq(variables.haveCoverageData, 'true')
|
||||||
# condition: eq(variables.haveBotResults, 'true')
|
displayName: Publish Coverage Data
|
||||||
# displayName: Publish Bot Results
|
inputs:
|
||||||
# inputs:
|
targetPath: "$(Agent.TempDirectory)/coverage/"
|
||||||
# targetPath: "$(outputPath)/bot/"
|
artifactName: "Coverage $(System.JobAttempt) $(System.StageDisplayName) $(System.JobDisplayName)"
|
||||||
# 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)"
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user