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

Improve testing #93

Open
wants to merge 4 commits into
base: master
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .github/workflows/action-install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Install esmvalcore from PyPi on different OS's
# and different Python version; test locally with
# act: https://github.com/nektos/act
# Example how to setup conda workflows:
# https://github.com/marketplace/actions/setup-miniconda
# Notes:
# - you can group commands with | delimiter (or &&) but those will be run
# in one single call; declaring the shell variable makes the action run each
# command separately (better for debugging);
# - can try multiple shells eg pwsh or cmd /C CALL {0} (but overkill for now!);
# TODO: read the cron tasking documentation:
# https://www.netiq.com/documentation/cloud-manager-2-5/ncm-reference/data/bexyssf.html

name: PyPi Install

# runs on a push on master and at the end of every day
on:
# triggering on push without branch name will run tests everytime
# there is a push on any branch
# turn it on only if needed
push:
branches:
- master
# test before merge on a dev branch
# - ga_tests

# run the test only if the PR is to master
# turn it on if required
#pull_request:
# branches:
# - master
# run a cron test every night
schedule:
- cron: '0 0 * * *'

jobs:
linux:
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
# fail-fast set to False allows all other tests
# in the worflow to run regardless of any fail
fail-fast: false
name: Linux Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: cfchecker
python-version: ${{ matrix.python-version }}
miniconda-version: "latest"
channels: conda-forge
- shell: bash -l {0}
run: mkdir -p pypi_install_linux_artifacts_python_${{ matrix.python-version }}
- shell: bash -l {0}
run: conda --version 2>&1 | tee pypi_install_linux_artifacts_python_${{ matrix.python-version }}/conda_version.txt
- shell: bash -l {0}
run: python -V 2>&1 | tee pypi_install_linux_artifacts_python_${{ matrix.python-version }}/python_version.txt
- shell: bash -l {0}
run: conda install udunits2
- shell: bash -l {0}
run: pip install cfchecker 2>&1 | tee pypi_install_linux_artifacts_python_${{ matrix.python-version }}/install.txt
- shell: bash -l {0}
run: cfchecks --help
- shell: bash -l {0}
run: cfchecks --version 2>&1 | tee pypi_install_linux_artifacts_python_${{ matrix.python-version }}/version.txt
- name: Upload artifacts
if: ${{ always() }} # upload artifacts even if fail
uses: actions/upload-artifact@v2
with:
name: PyPi_Install_Linux_python_${{ matrix.python-version }}
path: pypi_install_linux_artifacts_python_${{ matrix.python-version }}
12 changes: 8 additions & 4 deletions test_files/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# Note that you may need to change the $cfchecker variable in this file to
# point to the full path location of your "cfchecks" script

outdir=tests_output.$$
# as with cache dir below, best to put it in /tmp since we dont want ani git orphan files
outdir=/tmp/cfchecker/tests_output
mkdir $outdir

std_name_table=http://cfconventions.org/Data/cf-standard-names/current/src/cf-standard-name-table.xml
Expand All @@ -13,10 +14,13 @@ cfchecker="cfchecks"

failed=0

echo "Unzipping input netcdf files..."
gzip -d *.gz
# no gz files so this fails if not run from here
# echo "Unzipping input netcdf files..."
# gzip -d *.gz

cache_opts="-x --cache_dir /home/ros/temp/cfcache-files-py3"
# this is a better location since we don't want to add any git orpah files
mkdir /tmp/cfchecker
cache_opts="-x --cache_dir /tmp/cfchecker"

for file in `ls *.nc`
do
Expand Down