Fix doctest
failures for Python 3.10+ on AttributeError
messages
#189
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
# A GitHub Action to run the cfunits test suite after events on main. | |
name: Run test suite | |
# Triggers the workflow on push or PR events for the main branch (only) | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
# default (from docs) is just on [opened, synchronize, reopened] | |
types: [opened, reopened, ready_for_review, edited] | |
branches: | |
- main | |
# Note a workflow can have 1+ jobs that can run sequentially or in parallel. | |
jobs: | |
run-test-suite-job_basic: | |
#name: run test suite on ubuntu, macos with different python versions | |
name: unix-like, conda | |
# Set-up the build matrix. We run on different distros and Python versions. | |
strategy: | |
matrix: | |
os: [ubuntu-18.04, ubuntu-latest, macos-10.15, macos-latest] | |
python-version: [3.7, 3.8, 3.9] | |
deprecated: [false] | |
beta: [false] | |
include: | |
# python 3.6 reached EOL | |
# https://devguide.python.org/#status-of-python-branches | |
- os: ubuntu-18.04 | |
python-version: 3.6 | |
deprecated: true | |
beta: false | |
- os: ubuntu-latest | |
python-version: 3.6 | |
deprecated: true | |
beta: false | |
- os: macos-10.15 | |
python-version: 3.6 | |
deprecated: true | |
beta: false | |
- os: macos-latest | |
python-version: 3.6 | |
deprecated: true | |
beta: false | |
# ignore error on deprecated or beta versions | |
continue-on-error: ${{ matrix.deprecated || matrix.beta }} | |
# Run on new and old(er) versions of the distros we support (Linux, Mac OS) | |
runs-on: ${{ matrix.os }} | |
# The sequence of tasks that will be executed as part of this job: | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
# Provide a notification message | |
- name: Notify about setup | |
run: echo Now setting up the environment for the cfunits test suite... | |
# Prepare to run the test-suite on different versions of Python 3: | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# Setup conda, which is the simplest way to access all dependencies, | |
# especially as some are C-based so otherwise difficult to setup. | |
- name: Setup Miniconda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
miniconda-version: 'latest' | |
activate-environment: cfunits-latest | |
python-version: ${{ matrix.python-version }} | |
channels: conda-forge | |
# Ensure shell is configured with conda activated: | |
- name: Check conda config | |
shell: bash -l {0} | |
run: | | |
conda info | |
conda list | |
conda config --show-sources | |
conda config --show | |
# Install cfunits dependencies pre-testing | |
# We do so with conda which was setup in a previous step. | |
- name: Install dependencies | |
shell: bash -l {0} | |
run: | | |
conda install -c conda-forge udunits2=2.2.20 | |
pip install pycodestyle | |
# (The other, Python-based, deps are installed during the below command) | |
# Important! Must install our development version of cfunits to test: | |
pip install -e . | |
# Install libraries required for testing only (not for the core library) | |
# We do so with conda which was setup in a previous step. | |
- name: Install coverage | |
shell: bash -l {0} | |
run: | | |
conda install coverage dask | |
# Provide another notification message | |
- name: Notify about starting testing | |
run: echo Setup complete. Now starting to run the cfunits test suite... | |
# Finally run the test suite and generate a coverage report! | |
- name: Run test suite and generate a coverage report | |
shell: bash -l {0} | |
run: | | |
cd cfunits/test | |
./run_tests_and_coverage --nohtml | |
# For one job only, generate a coverage report: | |
- name: Upload coverage report to Codecov | |
# Get coverage from only one job (choose with Ubuntu Python 3.7 as | |
# representative). Note that we could use a separate workflow | |
# to setup Codecov reports, but given the amount of steps required to | |
# install including dependencies via conda, that a separate workflow | |
# would have to run anyway, it is simplest to add it in this flow. | |
# Also, it means code coverage is only generated if the test suite is | |
# passing at least for that job, avoiding useless coverage reports. | |
uses: codecov/[email protected] | |
if: | | |
matrix.os == 'ubuntu-latest' && matrix.python-version == 3.7 | |
with: | |
file: ./cfunits/test/cfunits_coverage_reports/coverage.xml | |
fail_ci_if_error: true | |
flags: unittests | |
name: codecov-umbrella | |
# End with a message indicating the suite has completed its run | |
- name: Notify about a completed run | |
run: | | |
echo The cfunits test suite run has completed. | |
run-test-suite-job_ubuntu_packages: | |
name: run test suite on ubuntu with mostly ubuntu packages | |
# Instead of running against the conda packages, we use here the packages | |
# from the used Linux distribution. | |
# Set-up the build matrix. We run on different distros and Python versions. | |
strategy: | |
matrix: | |
# https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu1804-README.md | |
# https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md | |
os: [ubuntu-20.04] | |
deprecated: [false] | |
beta: [false] | |
include: | |
# python 3.6 reached EOL and this version is default on ubuntu-18.04, | |
# therefore ubuntu-18.04 is deprecated | |
- os: ubuntu-18.04 | |
deprecated: true | |
beta: false | |
# ignore error on deprecated or beta versions | |
continue-on-error: ${{ matrix.deprecated || matrix.beta }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v2 | |
# check environment | |
- name: check environment | |
run: | | |
dpkg --print-architecture | |
lsb_release -a | |
lscpu | |
- name: check python version | |
run: python3 -V | |
# install dependencies | |
- name: install dependencies (ubuntu 18.04 packages) | |
if: matrix.os == 'ubuntu-18.04' | |
run: sudo apt install python3-setuptools python3-wheel libudunits2-0 python3-pycodestyle python3-coverage python3-numpy | |
- name: install cython (on ubuntu 18.04) | |
# This is a fix, since cftime needs a newer version of cython: | |
if: matrix.os == 'ubuntu-18.04' | |
run: pip3 install 'cython>0.26.1' | |
- name: install dependencies (ubuntu 20.04 packages) | |
if: matrix.os == 'ubuntu-20.04' | |
run: sudo apt install python3-setuptools python3-wheel libudunits2-0 python3-pycodestyle python3-coverage python3-numpy | |
# Install cfunits | |
# Important! Must install our development version of cfunits to test: | |
# pip install -e . | |
- name: install cfunits (ubuntu 18.04) | |
if: matrix.os == 'ubuntu-18.04' | |
run: pip3 install -e . | |
- name: install cfunits (ubuntu 20.04) | |
if: matrix.os == 'ubuntu-20.04' | |
# https://github.com/pypa/pip/issues/7953 | |
run: pip3 install --user --no-use-pep517 -e . | |
- name: python3 -c "import cfunits; print(cfunits.__file__)" | |
run: | | |
mkdir foo | |
cd foo | |
python3 -c "import cfunits; print(cfunits.__file__)" | |
# Finally run the test suite and generate a coverage report! | |
- name: Run test suite and generate a coverage report | |
run: | | |
cd cfunits/test | |
./run_tests_and_coverage --nohtml | |
run-test-suite-job_i386_debian: | |
name: run test suite on debian latest (32 bit) | |
# https://github.com/daniel-mohr/i386_debian_latest | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: create test script for docker | |
run: | | |
echo "#!/bin/sh -l" > run_test_suite | |
echo "set -e -v" >> run_test_suite | |
echo "echo 'install dependencies (debian packages)'" >> run_test_suite | |
echo "DEBIAN_FRONTEND=noninteractive apt install -q -y lsb-release python3-setuptools python3-wheel python3-pip libudunits2-0 python3-pycodestyle python3-coverage python3-numpy" >> run_test_suite | |
echo "echo 'check environment'" >> run_test_suite | |
echo "uname -a" >> run_test_suite | |
echo "dpkg --print-architecture" >> run_test_suite | |
echo "lsb_release -a" >> run_test_suite | |
echo "lscpu" >> run_test_suite | |
echo "python3 -V" >> run_test_suite | |
echo "pip3 install --user --no-use-pep517 -e ." >> run_test_suite | |
echo "mkdir foo" >> run_test_suite | |
echo "(cd foo && python3 -c 'import cfunits; print(cfunits.__file__)')" >> run_test_suite | |
echo "echo 'Run test suite and generate a coverage report'" >> run_test_suite | |
echo "cd cfunits/test" >> run_test_suite | |
echo "./run_tests_and_coverage --nohtml" >> run_test_suite | |
chmod +x run_test_suite | |
- name: cat test script | |
run: cat run_test_suite | |
- name: run test suite in docker image | |
uses: daniel-mohr/i386_debian_latest@v0 | |
with: | |
cmdfile: ./run_test_suite | |
run-test-suite-job_windows: | |
name: run test suite on windows using Miniconda for package management | |
# Set-up the build matrix. | |
strategy: | |
# due to error in cfunits we disable fail-fast to check CI configuration | |
fail-fast: false | |
matrix: | |
# https://github.com/actions/virtual-environments#available-environments | |
os: [windows-2019] | |
deprecated: [false] | |
beta: [false] | |
include: | |
- os: windows-2016 | |
# https://github.com/actions/virtual-environments/issues/4312 | |
deprecated: true | |
beta: false | |
- os: windows-2022 | |
deprecated: false | |
beta: true | |
continue-on-error: ${{ matrix.deprecated || matrix.beta }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
# check environment | |
- name: check python version | |
run: python -V | |
# use conda to install dependencies | |
- name: conda init powershell | |
run: | | |
&($env:CONDA + "\Scripts\conda") init powershell | |
- name: install dependencies (via conda and pip from conda) | |
run: | | |
#conda install --yes --only-deps -c conda-forge cfunits | |
conda install -c conda-forge cftime numpy udunits2 | |
conda install --yes -c conda-forge coverage | |
pip install pycodestyle | |
- name: set conda environment for cfunits | |
run: conda env config vars set UDUNITS2_XML_PATH=$env:CONDA"\Library\share\udunits\udunits2.xml" | |
# Ensure shell is configured with conda activated: | |
- name: Check conda config | |
run: | | |
conda info | |
conda list | |
conda config --show-sources | |
conda config --show | |
# Install cfunits | |
# Important! Must install our development version of cfunits to test: | |
# pip install -e . | |
- name: install cfunits | |
run: pip install -e . | |
- name: python -c "import cfunits; print(cfunits.__file__)" | |
run: | | |
mkdir foo | |
cd foo | |
python -c "import cfunits; print(cfunits.__file__)" | |
# Finally run the test suite and generate a coverage report! | |
- name: Run test suite | |
# coverage is not available in bash | |
# therefore run in powershell (it's windows!) | |
run: | | |
cd cfunits/test | |
coverage erase | |
coverage run --source=.. --omit="*/test/*" run_tests.py | |
- name: generate a coverage report | |
# coverage is not available in bash | |
# therefore run in powershell (it's windows!) | |
run: | | |
cd cfunits/test | |
coverage report |