From a83466e94276822e792669a2eda420433c0d67d9 Mon Sep 17 00:00:00 2001 From: Valeriu Predoi Date: Tue, 25 May 2021 17:12:02 +0100 Subject: [PATCH 1/4] added GA test --- .github/workflows/action-install.yml | 70 ++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/workflows/action-install.yml diff --git a/.github/workflows/action-install.yml b/.github/workflows/action-install.yml new file mode 100644 index 0000000..adaa1e9 --- /dev/null +++ b/.github/workflows/action-install.yml @@ -0,0 +1,70 @@ +# 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 + 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: 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 }} From 6dffa9cb71238ca1c63ede4987e168805a11d431 Mon Sep 17 00:00:00 2001 From: Valeriu Predoi Date: Tue, 25 May 2021 17:15:14 +0100 Subject: [PATCH 2/4] a couple suggestions for testing --- test_files/tests.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test_files/tests.sh b/test_files/tests.sh index f13592c..270a553 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 +# 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 From eb5caf5e3b49fa1d6ec83382ae01c92bb77c1e14 Mon Sep 17 00:00:00 2001 From: Valeriu Predoi Date: Tue, 25 May 2021 17:16:08 +0100 Subject: [PATCH 3/4] complete comment --- test_files/tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test_files/tests.sh b/test_files/tests.sh index 270a553..0d35b81 100755 --- a/test_files/tests.sh +++ b/test_files/tests.sh @@ -14,7 +14,7 @@ cfchecker="cfchecks" failed=0 -# no gz files so this fails +# no gz files so this fails if not run from here # echo "Unzipping input netcdf files..." # gzip -d *.gz From e4dcc259b2384cc3c7c6921f53d7b1d471ab453d Mon Sep 17 00:00:00 2001 From: Valeriu Predoi Date: Tue, 25 May 2021 17:30:24 +0100 Subject: [PATCH 4/4] add comment and install udunits2 --- .github/workflows/action-install.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/action-install.yml b/.github/workflows/action-install.yml index adaa1e9..2074c27 100644 --- a/.github/workflows/action-install.yml +++ b/.github/workflows/action-install.yml @@ -29,6 +29,7 @@ on: #pull_request: # branches: # - master + # run a cron test every night schedule: - cron: '0 0 * * *' @@ -56,6 +57,8 @@ jobs: 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}