diff --git a/.azure-pipelines/azure-pipelines.yml b/.azure-pipelines/azure-pipelines.yml index 1919fe7d..a783f243 100644 --- a/.azure-pipelines/azure-pipelines.yml +++ b/.azure-pipelines/azure-pipelines.yml @@ -32,12 +32,10 @@ schedules: - stable-4 variables: - - name: checkoutPath - value: ansible_collections/community/docker - name: coverageBranches value: main - name: entryPoint - value: tests/utils/shippable/shippable.sh + value: .azure-pipelines/scripts/run-nox.sh - name: fetchDepth value: 0 @@ -50,231 +48,35 @@ pool: Standard stages: -### Sanity & units - - stage: Ansible_devel - displayName: Sanity & Units devel - dependsOn: [] + - stage: nox + displayName: Run extra sanity tests jobs: - - template: templates/matrix.yml + - template: templates/run-nox.yml parameters: - targets: - - name: Sanity - test: 'devel/sanity/1' - - name: Units - test: 'devel/units/1' - - stage: Ansible_2_20 - displayName: Sanity & Units 2.20 - dependsOn: [] - jobs: - - template: templates/matrix.yml - parameters: - targets: - - name: Sanity - test: '2.20/sanity/1' - - name: Units - test: '2.20/units/1' - - stage: Ansible_2_19 - displayName: Sanity & Units 2.19 - dependsOn: [] - jobs: - - template: templates/matrix.yml - parameters: - targets: - - name: Sanity - test: '2.19/sanity/1' - - name: Units - test: '2.19/units/1' - - stage: Ansible_2_18 - displayName: Sanity & Units 2.18 - dependsOn: [] - jobs: - - template: templates/matrix.yml - parameters: - targets: - - name: Sanity - test: '2.18/sanity/1' - - name: Units - test: '2.18/units/1' + jobs: + - job: extra_sanity + name: Extra sanity tests + sessions: "" -### Docker - - stage: Docker_devel - displayName: Docker devel - dependsOn: [] - jobs: - - template: templates/matrix.yml - parameters: - testFormat: devel/linux/{0} - targets: - - name: Fedora 42 - test: fedora42 - - name: Ubuntu 22.04 - test: ubuntu2204 - - name: Ubuntu 24.04 - test: ubuntu2404 - - name: Alpine 3.22 - test: alpine322 - groups: - - 4 - - 5 - - stage: Docker_2_20 - displayName: Docker 2.20 - dependsOn: [] - jobs: - - template: templates/matrix.yml - parameters: - testFormat: 2.20/linux/{0} - targets: - - name: Fedora 42 - test: fedora42 - - name: Alpine 3.22 - test: alpine322 - groups: - - 4 - - 5 - - stage: Docker_2_19 - displayName: Docker 2.19 - dependsOn: [] - jobs: - - template: templates/matrix.yml - parameters: - testFormat: 2.19/linux/{0} - targets: - - name: Fedora 41 - test: fedora41 - - name: Alpine 3.21 - test: alpine321 - groups: - - 4 - - 5 - - stage: Docker_2_18 - displayName: Docker 2.18 - dependsOn: [] - jobs: - - template: templates/matrix.yml - parameters: - testFormat: 2.18/linux/{0} - targets: - - name: Fedora 40 - test: fedora40 - - name: Ubuntu 22.04 - test: ubuntu2204 - - name: Alpine 3.20 - test: alpine320 - groups: - - 4 - - 5 +# - stage: create-matrixes +# displayName: Create matrixes +# jobs: +# - job: A +# steps: +# - 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 -### Community Docker - - stage: Docker_community_devel - displayName: Docker (community images) devel - dependsOn: [] - jobs: - - template: templates/matrix.yml - parameters: - testFormat: devel/linux-community/{0} - targets: - - name: Debian 11 Bullseye - test: debian-bullseye/3.9 - - name: Debian 12 Bookworm - test: debian-bookworm/3.11 - - name: Debian 13 Trixie - test: debian-13-trixie/3.13 - - name: ArchLinux - test: archlinux/3.13 - groups: - - 4 - - 5 - -### Remote - - stage: Remote_devel - displayName: Remote devel - dependsOn: [] - jobs: - - template: templates/matrix.yml - parameters: - testFormat: devel/{0} - targets: - - name: RHEL 10.0 - test: rhel/10.0 - - name: RHEL 9.6 with Docker SDK, urllib3, requests from sources - test: rhel/9.6-dev-latest - # For some reason, Ubuntu 24.04 is *extremely* slower than RHEL 9.6 - # - name: Ubuntu 24.04 - # test: ubuntu/24.04 - groups: - - 1 - - 2 - - 3 - - 4 - - 5 - - stage: Remote_2_20 - displayName: Remote 2.20 - dependsOn: [] - jobs: - - template: templates/matrix.yml - parameters: - testFormat: 2.20/{0} - targets: - - name: RHEL 9.6 - test: rhel/9.6 - groups: - - 1 - - 2 - - 3 - - 4 - - 5 - - stage: Remote_2_19 - displayName: Remote 2.19 - dependsOn: [] - jobs: - - template: templates/matrix.yml - parameters: - testFormat: 2.19/{0} - targets: - - name: RHEL 9.5 - test: rhel/9.5 - - name: Ubuntu 22.04 - test: ubuntu/22.04 - groups: - - 1 - - 2 - - 3 - - 4 - - 5 - - stage: Remote_2_18 - displayName: Remote 2.18 - dependsOn: [] - jobs: - - template: templates/matrix.yml - parameters: - testFormat: 2.18/{0} - targets: - - name: RHEL 9.4 - test: rhel/9.4 - groups: - - 1 - - 2 - - 3 - - 4 - - 5 - - ## Finally - - - stage: Summary - condition: succeededOrFailed() - dependsOn: - - Ansible_devel - - Ansible_2_20 - - Ansible_2_19 - - Ansible_2_18 - - Remote_devel - - Remote_2_20 - - Remote_2_19 - - Remote_2_18 - - Docker_devel - - Docker_2_20 - - Docker_2_19 - - Docker_2_18 - - Docker_community_devel - jobs: - - template: templates/coverage.yml +# - stage: sanity +# displayName: Sanity tests +# dependsOn: create-matrixes +# - job: runner +# dependsOn: generator +# strategy: +# matrix: $[ stageDependencies.create-matrixes.A.outputs['mtrx.legs'] ] +# steps: +# - script: echo $(myvar) # echos A or B depending on which leg is running diff --git a/.azure-pipelines/scripts/process-results.sh b/.azure-pipelines/scripts/process-results.sh index 1a5d79ff..b9b78ef1 100755 --- a/.azure-pipelines/scripts/process-results.sh +++ b/.azure-pipelines/scripts/process-results.sh @@ -7,11 +7,7 @@ set -o pipefail -eu -if [[ "$PWD" =~ /ansible_collections/ ]]; then - output_path="tests/output" -else - output_path="test/results" -fi +output_path="tests/output" echo "##vso[task.setVariable variable=outputPath]${output_path}" diff --git a/.azure-pipelines/scripts/run-nox.sh b/.azure-pipelines/scripts/run-nox.sh new file mode 100755 index 00000000..9d16b67b --- /dev/null +++ b/.azure-pipelines/scripts/run-nox.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +# 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 + +set -o pipefail -e + +SESSIONS="" +if [ "$1" != "" ]; then + SESSIONS="--sessions $1" +fi + +export FORCE_COLOR=1 +export ANTSIBULL_NOX_IGNORE_INSTALLED_COLLECTIONS=true + +# ANTSIBULL_CHANGE_DETECTION: "${{ inputs.change-detection }}" +# ANTSIBULL_BASE_BRANCH: "${{ inputs.change-detection-base-branch }}" +nox --verbose --reuse-existing-virtualenvs --no-install ${SESSIONS} 2>&1 | "$(dirname "$0")/time-command.py" diff --git a/.azure-pipelines/scripts/setup-nox.sh b/.azure-pipelines/scripts/setup-nox.sh new file mode 100755 index 00000000..03fe2f75 --- /dev/null +++ b/.azure-pipelines/scripts/setup-nox.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +# 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 + +set -o pipefail -e + +SESSIONS="" +if [ "$1" != "" ]; then + SESSIONS="--sessions $1" +fi + +export FORCE_COLOR=1 +export ANTSIBULL_NOX_IGNORE_INSTALLED_COLLECTIONS=true + +echo "Set up nox environments" +nox --verbose --install-only ${SESSIONS} 2>&1 | "$(dirname "$0")/time-command.py" diff --git a/.azure-pipelines/templates/coverage.yml b/.azure-pipelines/templates/coverage.yml index 1bf17e05..41142029 100644 --- a/.azure-pipelines/templates/coverage.yml +++ b/.azure-pipelines/templates/coverage.yml @@ -17,7 +17,6 @@ jobs: steps: - checkout: self fetchDepth: $(fetchDepth) - path: $(checkoutPath) - task: DownloadPipelineArtifact@2 displayName: Download Coverage Data inputs: diff --git a/.azure-pipelines/templates/run-nox.yml b/.azure-pipelines/templates/run-nox.yml new file mode 100644 index 00000000..02072dd8 --- /dev/null +++ b/.azure-pipelines/templates/run-nox.yml @@ -0,0 +1,52 @@ +--- +# 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 nox jobs. + +parameters: + # A required list of dictionaries, one per nox job. + # Each item in the list must contain a "job", "name", and "sessions" key. + - name: jobs + type: object + +jobs: + - ${{ each job in parameters.jobs }}: + - job: ${{ job.job }} + displayName: ${{ job.name }} + container: default + workspace: + clean: all + steps: + - checkout: self + fetchDepth: $(fetchDepth) + - bash: pip install https://github.com/ansible-community/antsibull-nox/archive/main.tar.gz + displayName: Install nox and antsibull-nox + - bash: .azure-pipelines/scripts/setup-nox.sh "${{ job.sessions }}" + displayName: Setup nox environments + - bash: .azure-pipelines/scripts/run-nox.sh "${{ job.sessions }}" + displayName: Run nox + - 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)" diff --git a/.github/workflows/nox.yml b/.github/workflows/nox.yml deleted file mode 100644 index 386181ef..00000000 --- a/.github/workflows/nox.yml +++ /dev/null @@ -1,35 +0,0 @@ ---- -# 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 - -name: nox -'on': - push: - branches: - - main - - stable-* - pull_request: - # Run CI once per day (at 09:00 UTC) - schedule: - - cron: '0 9 * * *' - workflow_dispatch: - -jobs: - nox: - uses: ansible-community/antsibull-nox/.github/workflows/reusable-nox-run.yml@main - with: - session-name: Run extra sanity tests - change-detection-in-prs: true - - ansible-test: - uses: ansible-community/antsibull-nox/.github/workflows/reusable-nox-matrix.yml@main - with: - change-detection-in-prs: true - upload-codecov: true - upload-codecov-pr: false - upload-codecov-push: false - upload-codecov-schedule: true - max-ansible-core: "2.17" - secrets: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}