Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Enhance error handling in Azure Pipelines #26335

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
45 changes: 20 additions & 25 deletions azure-pipelines.yml
@@ -1,17 +1,14 @@
trigger:
# start a new build for every push
batch: False
branches:
include:
- main
- maintenance/*


pr:
branches:
include:
- '*' # must quote since "*" is a YAML reserved character; we want a string

- '*' # All branches for PRs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unindent?


stages:

Expand All @@ -36,7 +33,6 @@ stages:
condition: and(succeeded(), eq(dependencies.Check.outputs['Skip.result.start_main'], 'true'))
dependsOn: Check
jobs:

- job: Lint
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))
pool:
Expand All @@ -50,8 +46,7 @@ stages:
- script: >-
python -m pip install -r requirements/linter_requirements.txt
displayName: 'Install tools'
# pip 21.1 emits a pile of garbage messages to annoy users :)
# failOnStderr: true
continueOnError: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand. How can the lint job succeed if the tools are not installed?

- script: |
python tools/linter.py --branch origin/$(System.PullRequest.TargetBranch)
displayName: 'Run Lint Checks'
Expand All @@ -65,11 +60,11 @@ stages:
git submodule update --init
displayName: 'Fetch submodules'
- script: |
# yum does not have a ninja package, so use the PyPI one
docker run -v $(pwd):/numpy -e CFLAGS="-msse2 -std=c99 -UNDEBUG" \
-e F77=gfortran-5 -e F90=gfortran-5 quay.io/pypa/manylinux2014_i686 \
/bin/bash -xc "source /numpy/tools/ci/run_32_bit_linux_docker.sh"
displayName: 'Run 32-bit manylinux2014 Docker Build / Tests'
continueOnError: true # Consider whether to allow continuation on error
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems wrong. If the tests fail, the job should fail


- job: Windows
timeoutInMinutes: 120
Expand All @@ -78,23 +73,23 @@ stages:
strategy:
maxParallel: 3
matrix:
Python310-64bit-fast:
PYTHON_VERSION: '3.10'
PYTHON_ARCH: 'x64'
TEST_MODE: fast
BITS: 64
Python311-64bit-full:
PYTHON_VERSION: '3.11'
PYTHON_ARCH: 'x64'
TEST_MODE: full
BITS: 64
_USE_BLAS_ILP64: '1'
PyPy310-64bit-fast:
PYTHON_VERSION: 'pypy3.10'
PYTHON_ARCH: 'x64'
TEST_MODE: fast
BITS: 64
_USE_BLAS_ILP64: '1'
Python310-64bit-fast:
PYTHON_VERSION: '3.10'
PYTHON_ARCH: 'x64'
TEST_MODE: fast
BITS: 64
Python311-64bit-full:
PYTHON_VERSION: '3.11'
PYTHON_ARCH: 'x64'
TEST_MODE: full
BITS: 64
_USE_BLAS_ILP64: '1'
PyPy310-64bit-fast:
PYTHON_VERSION: 'pypy3.10'
PYTHON_ARCH: 'x64'
TEST_MODE: fast
BITS: 64
_USE_BLAS_ILP64: '1'

steps:
- template: azure-steps-windows.yml
144 changes: 89 additions & 55 deletions azure-steps-windows.yml
@@ -1,55 +1,89 @@
steps:
- script: git submodule update --init
displayName: 'Fetch submodules'
- task: UsePythonVersion@0
inputs:
versionSpec: $(PYTHON_VERSION)
addToPath: true
architecture: $(PYTHON_ARCH)

- script: python -m pip install --upgrade pip wheel
displayName: 'Install tools'

- script: python -m pip install -r requirements/test_requirements.txt
displayName: 'Install dependencies; some are optional to avoid test skips'

- powershell: |
choco install -y --stoponfirstfailure --checksum 6004DF17818F5A6DBF19CB335CC92702 pkgconfiglite
displayName: 'Install utilities'

- powershell: |
# Note: ensure the `pip install .` command remains the last one here,
# to avoid "green on failure" issues
If ( Test-Path env:DISABLE_BLAS ) {
python -m pip install . -v -Csetup-args="--vsenv" -Csetup-args="-Dblas=none" -Csetup-args="-Dlapack=none" -Csetup-args="-Dallow-noblas=true"
}
elseif ( Test-Path env:_USE_BLAS_ILP64 ) {
pip install -r requirements/ci_requirements.txt
spin config-openblas --with-scipy-openblas=64
$env:PKG_CONFIG_PATH="$pwd/.openblas"
python -m pip install . -v -Csetup-args="--vsenv"
} else {
pip install -r requirements/ci_requirements.txt
spin config-openblas --with-scipy-openblas=32
$env:PKG_CONFIG_PATH="$pwd/.openblas"
python -m pip install . -v -Csetup-args="--vsenv"
}
displayName: 'Build NumPy'

- powershell: |
cd tools # avoid root dir to not pick up source tree
# Get a gfortran onto the path for f2py tests
$env:PATH = "c:\\rtools43\\x86_64-w64-mingw32.static.posix\\bin;$env:PATH"
If ( $env:TEST_MODE -eq "full" ) {
pytest --pyargs numpy -rsx --junitxml=junit/test-results.xml
} else {
pytest --pyargs numpy -m "not slow" -rsx --junitxml=junit/test-results.xml
}
displayName: 'Run NumPy Test Suite'

- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFiles: '**/test-*.xml'
failTaskOnFailedTests: true
testRunTitle: 'Publish test results for Python $(PYTHON_VERSION) $(BITS)-bit $(TEST_MODE) Windows'
trigger:
branches:
include:
- main
- features/*
- bugfix/*

stages:
- stage: Initialize
jobs:
- job: Setup
pool:
vmImage: 'windows-2019'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: $(PYTHON_VERSION)
addToPath: true
architecture: $(PYTHON_ARCH)

- script: git submodule update --init
displayName: 'Fetch submodules'

- task: Cache@2
inputs:
key: 'pip | "$(Agent.OS)" | requirements/test_requirements.txt'
restoreKeys: 'pip | "$(Agent.OS)"'
path: $(PIP_CACHE_DIR)
displayName: 'Cache pip packages'

- script: |
python -m pip install --upgrade pip wheel
python -m pip install -r requirements/test_requirements.txt
displayName: 'Install tools and dependencies'

- powershell: |
choco install -y --stoponfirstfailure pkgconfiglite
displayName: 'Install utilities'

- powershell: |
If (Test-Path env:DISABLE_BLAS) {
python -m pip install . -v -Csetup-args="--vsenv" -Csetup-args="-Dblas=none" -Csetup-args="-Dlapack=none" -Csetup-args="-Dallow-noblas=true"
}
elseif (Test-Path env:_USE_BLAS_ILP64) {
pip install -r requirements/ci_requirements.txt
spin config-openblas --with-scipy-openblas=64
$env:PKG_CONFIG_PATH="$pwd/.openblas"
python -m pip install . -v -Csetup-args="--vsenv"
} else {
pip install -r requirements/ci_requirements.txt
spin config-openblas --with-scipy-openblas=32
$env:PKG_CONFIG_PATH="$pwd/.openblas"
python -m pip install . -v -Csetup-args="--vsenv"
}
displayName: 'Build NumPy'

- stage: Test
dependsOn: Initialize
jobs:
- job: Testing
pool:
vmImage: 'windows-2019'
steps:
- powershell: |
cd tools
$env:PATH = "c:\\rtools43\\x86_64-w64-mingw32.static.posix\\bin;$env:PATH"
If ($env:TEST_MODE -eq "full") {
Try {
pytest --pyargs numpy -rsx --junitxml=junit/test-results.xml
} Catch {
Write-Host "Error during testing: $_"
Exit 1
}
} else {
Try {
pytest --pyargs numpy -m "not slow" -rsx --junitxml=junit/test-results.xml
} Catch {
Write-Host "Error during testing: $_"
Exit 1
}
}
displayName: 'Run NumPy Test Suite'

- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFiles: '**/test-*.xml'
failTaskOnFailedTests: true
testRunTitle: 'Publish test results for Python $(PYTHON_VERSION) $(BITS)-bit $(TEST_MODE) Windows'