diff --git a/.github/workflows/action-install.yml b/.github/workflows/action-install.yml new file mode 100644 index 0000000..2074c27 --- /dev/null +++ b/.github/workflows/action-install.yml @@ -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 }} diff --git a/test_files/tests.sh b/test_files/tests.sh index f13592c..0d35b81 100755 --- a/test_files/tests.sh +++ b/test_files/tests.sh @@ -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 @@ -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