Backport PR #15450 on branch v5.0.x (Ensure mask calculation is correct also for multi-op ufunc with scalars) #14183
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- v5.0.x | |
pull_request: | |
branches: | |
- v5.0.x | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
ARCH_ON_CI: "normal" | |
IS_CRON: "false" | |
jobs: | |
initial_checks: | |
name: Mandatory checks before CI | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check base branch | |
uses: actions/github-script@v6 | |
if: github.event_name == 'pull_request' | |
with: | |
script: | | |
const skip_label = 'skip-basebranch-check'; | |
const { default_branch: allowed_basebranch } = context.payload.repository; | |
const pr = context.payload.pull_request; | |
if (pr.user.login === 'meeseeksmachine') { | |
core.info(`Base branch check is skipped since this is auto-backport by ${pr.user.login}`); | |
return; | |
} | |
if (pr.labels.find(lbl => lbl.name === skip_label)) { | |
core.info(`Base branch check is skipped due to the presence of ${skip_label} label`); | |
return; | |
} | |
if (pr.base.ref !== allowed_basebranch) { | |
core.setFailed(`PR opened against ${pr.base.ref}, not ${allowed_basebranch}`); | |
} else { | |
core.info(`PR opened correctly against ${allowed_basebranch}`); | |
} | |
tests: | |
name: ${{ matrix.name }} | |
runs-on: ${{ matrix.os }} | |
needs: initial_checks | |
strategy: | |
fail-fast: true | |
matrix: | |
include: | |
# NOTE: this coverage test is needed for tests and code that | |
# run only with minimal dependencies. | |
- name: Python 3.9 with minimal dependencies and full coverage | |
os: ubuntu-latest | |
python: 3.9 | |
toxenv: py39-test-cov | |
- name: Python 3.10 with minimal dependencies | |
os: ubuntu-latest | |
python: '3.10' | |
toxenv: py310-test | |
# NOTE: In the build below we also check that tests do not open and | |
# leave open any files. This has a performance impact on running the | |
# tests, hence why it is not enabled by default. | |
- name: Python 3.8 with all optional dependencies | |
os: ubuntu-latest | |
python: 3.8 | |
toxenv: py38-test-alldeps | |
toxargs: -v --develop | |
toxposargs: --open-files | |
- name: Python 3.8 with oldest supported version of all dependencies | |
os: ubuntu-20.04 | |
python: 3.8 | |
toxenv: py38-test-oldestdeps | |
- name: Python 3.8 with numpy 1.18 and full coverage | |
os: ubuntu-latest | |
python: 3.8 | |
toxenv: py38-test-alldeps-numpy118-cov-clocale | |
toxposargs: --remote-data=astropy | |
- name: Python 3.8 with all optional dependencies (Windows) | |
os: windows-latest | |
python: 3.8 | |
toxenv: py38-test-alldeps | |
toxposargs: --durations=50 | |
- name: Python 3.8 with all optional dependencies (MacOS X) | |
os: macos-latest | |
python: 3.8 | |
toxenv: py38-test-alldeps | |
toxposargs: --durations=50 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install language-pack-fr and tzdata | |
if: startsWith(matrix.os, 'ubuntu') | |
run: | | |
sudo apt-get update | |
sudo apt-get install language-pack-fr tzdata | |
- name: Install tox | |
run: python -m pip install "tox<4" | |
- name: Run tests | |
run: tox ${{ matrix.toxargs }} -e ${{ matrix.toxenv }} -- ${{ matrix.toxposargs }} | |
# TODO: Do we need --gcov-glob "*cextern*" ? | |
- name: Upload coverage to codecov | |
if: ${{ contains(matrix.toxenv,'-cov') }} | |
uses: codecov/codecov-action@v3 | |
with: | |
file: ./coverage.xml | |
verbose: true | |
allowed_failures: | |
name: ${{ matrix.name }} | |
runs-on: ${{ matrix.os }} | |
needs: initial_checks | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: (Allowed Failure) Python 3.11 with remote data and dev version of key dependencies | |
os: ubuntu-latest | |
python: '3.11' | |
toxenv: py311-test-devdeps | |
toxposargs: --remote-data=any | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install language-pack-de and tzdata | |
if: startsWith(matrix.os, 'ubuntu') | |
run: | | |
sudo apt-get update | |
sudo apt-get install language-pack-de tzdata | |
- name: Install Python dependencies | |
run: python -m pip install "tox<4" | |
- name: Run tests | |
run: tox ${{ matrix.toxargs }} -e ${{ matrix.toxenv }} -- ${{ matrix.toxposargs }} | |
parallel_and_32bit: | |
name: 32-bit and parallel | |
runs-on: ubuntu-latest | |
needs: initial_checks | |
container: | |
image: quay.io/pypa/manylinux2014_i686:2022-04-03-da6ecb3 | |
steps: | |
# TODO: Use newer checkout actions when https://github.com/actions/checkout/issues/334 fixed | |
- name: Checkout code | |
uses: actions/checkout@v1 | |
with: | |
fetch-depth: 0 | |
- name: Write configuration items to standard location to make sure they are ignored in parallel mode | |
run: | | |
mkdir -p $HOME/.astropy/config/ | |
printf "unicode_output = True\nmax_width = 500" > $HOME/.astropy/config/astropy.cfg | |
# In addition to testing 32-bit, we also use the 3.8 builds to | |
# test the ability to run the test suite in parallel. | |
# Numpy is pinned to avoid building it from source for numpy 1.21.5 | |
- name: Install dependencies for Python 3.8 | |
run: /opt/python/cp38-cp38/bin/pip install "tox<4" | |
- name: Run tests for Python 3.8 | |
run: /opt/python/cp38-cp38/bin/python -m tox -e py38-numpy120-test -- -n=4 --durations=50 | |
# We use the 3.8 build to check that running tests twice in a row in the | |
# same Python session works without issues. This catches cases where | |
# running the tests changes the module state permanently. Note that we | |
# shouldn't also test the parallel build here since that enforces a degree | |
# of isolation of tests which will interfere with what we are trying to do | |
# here. | |
# Numpy is pinned to avoid building it from source for numpy 1.21.5 | |
- name: Run tests for Python 3.8 | |
run: /opt/python/cp38-cp38/bin/python -m tox -e py38-numpy120-test-double |