From d75b1f4ec1cec046f80c76a13c481ae22aaa34fd Mon Sep 17 00:00:00 2001 From: Adam Yoblick Date: Fri, 11 Aug 2023 17:17:43 -0500 Subject: [PATCH] Cleaned up yaml using the redhat yaml linter and azure pipelines schema --- azure-pipelines/linux-coverage.yaml | 32 ++--- azure-pipelines/mac-coverage.yaml | 27 ++-- azure-pipelines/pipelines.yaml | 175 ++++++++++++----------- azure-pipelines/templates/coverage.yml | 58 ++++---- azure-pipelines/templates/run_tests.yml | 47 +++--- azure-pipelines/templates/use_python.yml | 10 +- azure-pipelines/win-coverage.yaml | 22 +-- 7 files changed, 184 insertions(+), 187 deletions(-) diff --git a/azure-pipelines/linux-coverage.yaml b/azure-pipelines/linux-coverage.yaml index df1d362f..747814a4 100644 --- a/azure-pipelines/linux-coverage.yaml +++ b/azure-pipelines/linux-coverage.yaml @@ -14,24 +14,24 @@ pr: include: - main - release/* - drafts: false + drafts: "false" variables: - architecture: "x64" - python.version: "3.8" + architecture: "x64" + python.version: "3.8" jobs: - - job: "Coverage" - timeoutInMinutes: 45 - pool: - name: Azure Pipelines - demands: java - vmImage: "ubuntu-latest" - steps: - - script: | - sudo apt-get update - sudo apt-get --yes install gdb - sudo sysctl kernel.yama.ptrace_scope=0 - displayName: "Install gdb" + - job: "Coverage" + timeoutInMinutes: "45" + pool: + name: Azure Pipelines + demands: java + vmImage: "ubuntu-latest" + steps: + - script: | + sudo apt-get update + sudo apt-get --yes install gdb + sudo sysctl kernel.yama.ptrace_scope=0 + displayName: "Install gdb" - - template: "templates/coverage.yml" + - template: "templates/coverage.yml" diff --git a/azure-pipelines/mac-coverage.yaml b/azure-pipelines/mac-coverage.yaml index d044dd60..3dec634a 100644 --- a/azure-pipelines/mac-coverage.yaml +++ b/azure-pipelines/mac-coverage.yaml @@ -14,22 +14,21 @@ pr: include: - main - release/* - drafts: false + drafts: "false" variables: - architecture: "x64" - python.version: "3.8" + architecture: "x64" + python.version: "3.8" jobs: - - job: "Coverage" - timeoutInMinutes: 45 - pool: - name: Azure Pipelines - demands: java - vmImage: "macOS-latest" - steps: - - script: | - ulimit -Sn 8192 - displayName: "Increase file descriptor limit" + - job: "Coverage" + timeoutInMinutes: "45" + pool: + name: Azure Pipelines + demands: java + vmImage: "macOS-latest" + steps: + - script: "ulimit -Sn 8192" + displayName: "Increase file descriptor limit" - - template: "templates/coverage.yml" + - template: "templates/coverage.yml" diff --git a/azure-pipelines/pipelines.yaml b/azure-pipelines/pipelines.yaml index 34653da1..17587964 100644 --- a/azure-pipelines/pipelines.yaml +++ b/azure-pipelines/pipelines.yaml @@ -15,117 +15,118 @@ pr: include: - main - release/* - drafts: false + drafts: "false" variables: architecture: "x64" jobs: - - job: "Lint" - displayName: "Lint" - pool: { vmImage: "ubuntu-latest" } + - job: "Lint" + displayName: "Lint" + pool: { vmImage: "ubuntu-latest" } - variables: - python.version: "3.8" + variables: + python.version: "3.8" - steps: + steps: - - template: "templates/use_python.yml" + - template: "templates/use_python.yml" - # Install and run ruff - # See https://github.com/astral-sh/ruff and https://beta.ruff.rs/docs/ - - script: python3 -m pip install -U ruff - displayName: "Install ruff" + # Install and run ruff + # See https://github.com/astral-sh/ruff and https://beta.ruff.rs/docs/ + - script: "python3 -m pip install -U ruff" + displayName: "Install ruff" - # To unblock the build even with lint errors, add "--exit-zero" to the command line - - script: python3 -m ruff check --format=junit --output-file=$(Build.ArtifactStagingDirectory)/lint-ruff.xml . - displayName: "Run ruff" + # To unblock the build even with lint errors, add "--exit-zero" to the command line + - script: "python3 -m ruff check --format=junit --output-file=$(Build.ArtifactStagingDirectory)/lint-ruff.xml ." + displayName: "Run ruff" - - task: "PublishTestResults@2" - displayName: "Publish linting results" - inputs: - testRunTitle: "$(Agent.JobName)" - testResultsFiles: "lint-*.xml" - searchFolder: "$(Build.ArtifactStagingDirectory)" - condition: "always()" + - task: "PublishTestResults@2" + displayName: "Publish linting results" + inputs: + testRunTitle: "$(Agent.JobName)" + testResultsFiles: "lint-*.xml" + searchFolder: "$(Build.ArtifactStagingDirectory)" + condition: "always()" - - job: "Test_Linux" - timeoutInMinutes: 30 - displayName: "Tests - Linux" - pool: { vmImage: "ubuntu-latest" } + - job: "Test_Linux" + timeoutInMinutes: "30" + displayName: "Tests - Linux" + pool: { vmImage: "ubuntu-latest" } - strategy: - matrix: - py37: - python.version: "3.7" - py38: - python.version: "3.8" - py39: - python.version: "3.9" - py310: - python.version: "3.10" + strategy: + matrix: + py37: + python.version: "3.7" + py38: + python.version: "3.8" + py39: + python.version: "3.9" + py310: + python.version: "3.10" - steps: - - script: | - sudo apt-get update - sudo apt-get --yes install gdb - sudo sysctl kernel.yama.ptrace_scope=0 - displayName: "Setup gdb" + steps: - - template: "templates/use_python.yml" + - script: | + sudo apt-get update + sudo apt-get --yes install gdb + sudo sysctl kernel.yama.ptrace_scope=0 + displayName: "Setup gdb" - - template: "templates/run_tests.yml" + - template: "templates/use_python.yml" - - job: "Test_MacOS" - timeoutInMinutes: 30 - displayName: "Tests - macOS" - pool: { vmImage: "macOS-11" } + - template: "templates/run_tests.yml" - strategy: - matrix: - py37: - python.version: "3.7" - py38: - python.version: "3.8" - py39: - python.version: "3.9" - py310: - python.version: "3.10" + - job: "Test_MacOS" + timeoutInMinutes: "30" + displayName: "Tests - macOS" + pool: { vmImage: "macOS-11" } - steps: - - script: | - ulimit -Sn 8192 - displayName: "Increase file descriptor limit" + strategy: + matrix: + py37: + python.version: "3.7" + py38: + python.version: "3.8" + py39: + python.version: "3.9" + py310: + python.version: "3.10" - - template: "templates/use_python.yml" + steps: - - script: | - python -m ensurepip --user - displayName: "Bootstrap pip" + - script: "ulimit -Sn 8192" + displayName: "Increase file descriptor limit" - - template: "templates/run_tests.yml" + - template: "templates/use_python.yml" - - job: "Test_Windows" - timeoutInMinutes: 40 - displayName: "Tests - Windows" - pool: { vmImage: "windows-latest" } + - script: "python -m ensurepip --user" + displayName: "Bootstrap pip" - strategy: - matrix: - py37: - python.version: "3.7" - py38: - python.version: "3.8" - py39: - python.version: "3.9" - py310: - python.version: "3.10" - py39_32: - python.version: "3.9" - architecture: "x86" + - template: "templates/run_tests.yml" - steps: - - template: "templates/use_python.yml" + - job: "Test_Windows" + timeoutInMinutes: "40" + displayName: "Tests - Windows" + pool: { vmImage: "windows-latest" } - - template: "templates/run_tests.yml" + strategy: + matrix: + py37: + python.version: "3.7" + py38: + python.version: "3.8" + py39: + python.version: "3.9" + py310: + python.version: "3.10" + py39_32: + python.version: "3.9" + architecture: "x86" + + steps: + + - template: "templates/use_python.yml" + + - template: "templates/run_tests.yml" diff --git a/azure-pipelines/templates/coverage.yml b/azure-pipelines/templates/coverage.yml index 5c638bb8..a615d222 100644 --- a/azure-pipelines/templates/coverage.yml +++ b/azure-pipelines/templates/coverage.yml @@ -1,37 +1,35 @@ steps: - - template: "use_python.yml" + - template: "use_python.yml" - - script: | - python -m pip install -U pip setuptools tox - displayName: "Setup Python packages" + - script: "python -m pip install -U pip setuptools tox" + displayName: "Setup Python packages" - - task: SonarCloudPrepare@1 - displayName: "Prepare analysis on SonarCloud" - inputs: - SonarCloud: "SonarCloud-debugpy" - organization: microsoft - scannerMode: CLI - extraProperties: | - sonar.python.coverage.reportPaths=$(Build.SourcesDirectory)/coverage/coverage.xml - sonar.projectKey=microsoft_debugpy + - task: SonarCloudPrepare@1 + displayName: "Prepare analysis on SonarCloud" + inputs: + SonarCloud: "SonarCloud-debugpy" + organization: microsoft + scannerMode: CLI + extraProperties: | + sonar.python.coverage.reportPaths=$(Build.SourcesDirectory)/coverage/coverage.xml + sonar.projectKey=microsoft_debugpy - - script: | - python -m tox --develop -e py38-cov -- --cov-report=html --cov-report=xml -vv - displayName: "Coverage Run" + - script: "python -m tox --develop -e py38-cov -- --cov-report=html --cov-report=xml -vv" + displayName: "Coverage Run" - - task: SonarCloudAnalyze@1 - displayName: "Run Code Analysis" + - task: SonarCloudAnalyze@1 + displayName: "Run Code Analysis" - - task: SonarCloudPublish@1 - displayName: "Publish Quality Gate Result" - inputs: - pollingTimeoutSec: "300" + - task: SonarCloudPublish@1 + displayName: "Publish Quality Gate Result" + inputs: + pollingTimeoutSec: "300" - - task: PublishCodeCoverageResults@1 - displayName: "Publish Coverage Report" - inputs: - codeCoverageTool: Cobertura - summaryFileLocation: "$(Build.SourcesDirectory)/coverage/coverage.xml" - reportDirectory: "$(Build.SourcesDirectory)/coverage/html" - failIfCoverageEmpty: true - condition: always() + - task: PublishCodeCoverageResults@1 + displayName: "Publish Coverage Report" + inputs: + codeCoverageTool: Cobertura + summaryFileLocation: "$(Build.SourcesDirectory)/coverage/coverage.xml" + reportDirectory: "$(Build.SourcesDirectory)/coverage/html" + failIfCoverageEmpty: true + condition: always() diff --git a/azure-pipelines/templates/run_tests.yml b/azure-pipelines/templates/run_tests.yml index cf94dcf1..de47f92d 100644 --- a/azure-pipelines/templates/run_tests.yml +++ b/azure-pipelines/templates/run_tests.yml @@ -1,28 +1,27 @@ steps: - - script: | - python -m pip install -U pip setuptools tox - displayName: "Setup Python packages" + - script: "python -m pip install -U pip setuptools tox" + displayName: "Setup Python packages" - - pwsh: | - $toxEnv = '$(python.version)' - if (-not $toxEnv.startsWith('pypy')) { - $toxEnv = 'py' + $toxEnv.Replace('.', '') - } - echo 'tox environment: $toxEnv' - python -m tox -e $toxEnv -- -vv --junitxml=$(Build.ArtifactStagingDirectory)/tests.xml --debugpy-log-dir=$(Build.ArtifactStagingDirectory)/logs tests - displayName: "Run tests using tox" + - pwsh: | + $toxEnv = '$(python.version)' + if (-not $toxEnv.startsWith('pypy')) { + $toxEnv = 'py' + $toxEnv.Replace('.', '') + } + echo 'tox environment: $toxEnv' + python -m tox -e $toxEnv -- -vv --junitxml=$(Build.ArtifactStagingDirectory)/tests.xml --debugpy-log-dir=$(Build.ArtifactStagingDirectory)/logs tests + displayName: "Run tests using tox" - - task: "PublishBuildArtifacts@1" - condition: "failed()" - inputs: - artifactName: "Test logs" - pathToPublish: "$(Build.ArtifactStagingDirectory)/logs" - displayName: "Publish test logs" + - task: "PublishBuildArtifacts@1" + condition: "failed()" + inputs: + artifactName: "Test logs" + pathToPublish: "$(Build.ArtifactStagingDirectory)/logs" + displayName: "Publish test logs" - - task: "PublishTestResults@2" - condition: "always()" - inputs: - testRunTitle: "$(Agent.JobName)" - testResultsFiles: "tests.xml" - searchFolder: "$(Build.ArtifactStagingDirectory)" - displayName: "Publish test results" + - task: "PublishTestResults@2" + condition: "always()" + inputs: + testRunTitle: "$(Agent.JobName)" + testResultsFiles: "tests.xml" + searchFolder: "$(Build.ArtifactStagingDirectory)" + displayName: "Publish test results" diff --git a/azure-pipelines/templates/use_python.yml b/azure-pipelines/templates/use_python.yml index ef4c20f8..3e277296 100644 --- a/azure-pipelines/templates/use_python.yml +++ b/azure-pipelines/templates/use_python.yml @@ -1,6 +1,6 @@ steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: "$(python.version)" - architecture: "$(architecture)" - displayName: "Use Python $(python.version) $(architecture)" + - task: UsePythonVersion@0 + inputs: + versionSpec: "$(python.version)" + architecture: "$(architecture)" + displayName: "Use Python $(python.version) $(architecture)" diff --git a/azure-pipelines/win-coverage.yaml b/azure-pipelines/win-coverage.yaml index 55f10e43..b13804a2 100644 --- a/azure-pipelines/win-coverage.yaml +++ b/azure-pipelines/win-coverage.yaml @@ -14,18 +14,18 @@ pr: include: - main - release/* - drafts: false + drafts: "false" variables: - architecture: "x64" - python.version: "3.8" + architecture: "x64" + python.version: "3.8" jobs: - - job: "Coverage" - timeoutInMinutes: 45 - pool: - name: Azure Pipelines - demands: java - vmImage: "windows-latest" - steps: - - template: "templates/coverage.yml" + - job: "Coverage" + timeoutInMinutes: "45" + pool: + name: Azure Pipelines + demands: java + vmImage: "windows-latest" + steps: + - template: "templates/coverage.yml"