Add new recipe (17) by summer student: colourmap subplots #247
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 test a source distribution created from the repo state. | |
name: Test source distribution | |
# Triggers the workflow on PR events for the main branch (only) | |
on: | |
pull_request: | |
# 'reopened' enables manual retrigger via close & re-open. Disable for all | |
# edits to manage limited resource (PRs often change before merge-ready). | |
types: [opened, reopened, ready_for_review] | |
branches: | |
- main | |
jobs: | |
source-dist-test: | |
# Set-up the build matrix. | |
# Note: only use one Python version, but it is easier to update in future | |
# by setting it here and refering to it as ${{ matrix.python-version }}. | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
python-version: ["3.8"] | |
runs-on: ${{ matrix.os }} | |
# The sequence of tasks that will be executed as part of this job: | |
steps: | |
# Need to checkout the repo in order to build the source dist from it, | |
# but don't install codebase directly in this case, only test the sdist. | |
- name: Checkout cf-python | |
uses: actions/checkout@v3 | |
with: | |
path: main | |
# Provide a notification message | |
- name: Notify about setup | |
run: echo Now setting up the environment for cf-python... | |
- name: Checkout the current cfdm main to use as the dependency | |
uses: actions/checkout@v3 | |
with: | |
repository: NCAS-CMS/cfdm | |
path: cfdm | |
# Prepare to test the source dist using the given Python version | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
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: | |
auto-update-conda: true | |
miniconda-version: "latest" | |
activate-environment: cf-latest | |
python-version: ${{ matrix.python-version }} | |
channels: ncas, conda-forge | |
# Ensure shell is configured with conda and pip correctly activated. | |
- name: Check conda and pip config | |
shell: bash -l {0} | |
run: | | |
echo "*Conda report:*" | |
conda info | |
conda list | |
conda config --show-sources | |
conda config --show | |
echo "*Pip report:*" | |
pip --version | |
pip list | |
# Install cf-python dependencies, excluding cfunits and cfdm, pre-testing | |
# We do so with conda (and pip) which was setup in a previous step. | |
- name: Install dependencies excluding the NCAS CF Data Tools libraries | |
shell: bash -l {0} | |
run: | | |
conda install -c ncas -c conda-forge cf-plot udunits2=2.2.25 | |
conda install -c conda-forge mpich esmpy | |
conda install scipy matplotlib dask | |
pip install pycodestyle | |
# Install cfunits and cfdm (from development main branch) separately, | |
# since it is most robust to test a no-dependency installation of cf, then | |
# finally install the cf-python development version, but only in order | |
# to generate the test_file.nc file for testing, not as the cf to test. | |
- name: Install cfunits then development versions of cfdm and cf-python | |
shell: bash -l {0} | |
run: | | |
pip install cfunits | |
cd ${{ github.workspace }}/cfdm | |
pip install -e . | |
cd ${{ github.workspace }}/main | |
# This next (very meta) command is needed to install requirements.txt | |
# spec (next) in the conda env rather than globally to the PYTHONPATH: | |
conda install pip | |
pip install -r requirements.txt | |
# Installing cf now but only to be able to run setup_create_field.py | |
# next, in order to generate the test_file.nc required to test on | |
pip install --no-deps -e . | |
# Provide another notification message | |
- name: Notify about starting the sdist test | |
run: echo Setup complete. Now creating and testing the source dist... | |
# Create netCDF files needed for testing. A separate step is required | |
# for this so the files can be registered and recognised first; locally | |
# they are created and used on-the-fly by 'run_tests_and_coverage'. | |
- name: Create netCDF test files, e.g. test_file.nc | |
shell: bash -l {0} | |
run: | | |
cd ${{ github.workspace }}/main/cf/test | |
python create_test_files.py | |
python setup_create_field.py | |
ls -la | |
- name: Create the source distribution and store the version as an env var | |
shell: bash -l {0} | |
run: | | |
cd ${{ github.workspace }}/main | |
python setup.py sdist | |
# Get the cf-python version and put it in an environment variable for | |
# the next step (only available in steps subsequent to one set in). | |
echo "CF_VERSION=$(python setup.py --version 2> /dev/null)" >> $GITHUB_ENV | |
- name: Test the source distribution | |
shell: bash -l {0} | |
run: | | |
cd ${{ github.workspace }}/main | |
./test_release $CF_VERSION | |
# End with a message indicating the sdist test has completed its run | |
- name: Notify about a completed run | |
run: | | |
echo The test of the latest cf-python source distribution has now | |
echo completed and you may inspect the results. |