Skip to content

Commit

Permalink
GitHub Actions (#1806)
Browse files Browse the repository at this point in the history
* Use pytest-xdist, avoid setup.py test and update CircleCI config

* Try to use codacy coverage orb

* Remove test alias

* Require minimal version of pytest-cov

* Require minimum version of pytest-flake8

* added extra requirement for conda build memory

* added actions workflows

* added conda build workflow

* comment out julis symlink for now

* use 2020 pip solver

* gaahhh

* force ncurses to be from conda forge

* wrong OS for ncurses fixed

* removed py 38 from OSX conda install

* try to install R and Julia first

* force ncurses from conda forge

* removed channel activation and forcing ncurses

* force and keep ancurses from conda forge

* force ncurses via uninstall

* gave up installing full package and revert to only python and ncl

* remove tweaking ncurses

* made the r-lint as install test to be skipped

* removed py 3.8 for osx testing

* removed py 3.8 for osx testing

* removed py 3.8 for osx testing

* removed requirement - weird - I thought I removed this ages ago

* removed some comments

Co-authored-by: Bouwe Andela <b.andela@esciencecenter.nl>
  • Loading branch information
valeriupredoi and bouweandela committed Sep 17, 2020
1 parent 2bcc682 commit 1125c36
Show file tree
Hide file tree
Showing 5 changed files with 314 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/action-conda-build.yml
@@ -0,0 +1,48 @@
name: Conda-build

# runs on a push on master and at the end of every day
on:
push:
branches:
- master
- github-actions2 # testing branch
schedule:
- cron: '0 0 * * *'

jobs:
linux:
runs-on: "ubuntu-latest" # use only Linux for conda build
strategy:
matrix:
python-version: [3.8] # use only the latest for conda build
fail-fast: false
name: Linux Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v2
- uses: goanpeca/setup-miniconda@v1
with:
python-version: ${{ matrix.python-version }}
miniconda-version: "latest"
channels: conda-forge
- shell: bash -l {0}
run: mkdir -p condabuild_artifacts_python_${{ matrix.python-version }}
- shell: bash -l {0}
run: conda --version 2>&1 | tee condabuild_artifacts_python_${{ matrix.python-version }}/conda_version.txt
- shell: bash -l {0}
run: python -V 2>&1 | tee condabuild_artifacts_python_${{ matrix.python-version }}/python_version.txt
- shell: bash -l {0}
run: wget https://julialang-s3.julialang.org/bin/linux/x64/1.0/julia-1.0.3-linux-x86_64.tar.gz
- shell: bash -l {0}
run: tar xfz julia-*-linux-x86_64.tar.gz
#- shell: bash -l {0}
# run: ln -s $(pwd)/julia-*/bin/julia /usr/bin/julia
- shell: bash -l {0}
run: conda install -y conda-build conda-verify 2>&1 | tee condabuild_artifacts_python_${{ matrix.python-version }}/install_conda_buildtools.txt
- shell: bash -l {0}
run: conda build package -c conda-forge -c esmvalgroup 2>&1 | tee condabuild_artifacts_python_${{ matrix.python-version }}/conda_build.txt
- name: Upload artifacts
if: ${{ always() }} # upload artifacts even if fail
uses: actions/upload-artifact@v2
with:
name: Condabuild_python_${{ matrix.python-version }}
path: condabuild_artifacts_python_${{ matrix.python-version }}
94 changes: 94 additions & 0 deletions .github/workflows/action-install-from-conda.yml
@@ -0,0 +1,94 @@
name: Conda Base Install

# runs on a push on master and at the end of every day
on:
push:
branches:
- master
- github-actions2 # testing branch
schedule:
- cron: '0 0 * * *'

jobs:
linux:
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
# 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: goanpeca/setup-miniconda@v1
with:
python-version: ${{ matrix.python-version }}
miniconda-version: "latest"
channels: esmvalgroup,conda-forge
- shell: bash -l {0}
run: mkdir -p conda_install_linux_artifacts_python_${{ matrix.python-version }}
- shell: bash -l {0}
run: conda --version 2>&1 | tee conda_install_linux_artifacts_python_${{ matrix.python-version }}/conda_version.txt
- shell: bash -l {0}
run: which conda 2>&1 | tee conda_install_linux_artifacts_python_${{ matrix.python-version }}/conda_path.txt
- shell: bash -l {0}
run: python -V 2>&1 | tee conda_install_linux_artifacts_python_${{ matrix.python-version }}/python_version.txt
- shell: bash -l {0}
run: conda install esmvaltool 2>&1 | tee conda_install_linux_artifacts_python_${{ matrix.python-version }}/install.txt
- shell: bash -l {0}
run: esmvaltool --help
- shell: bash -l {0}
run: esmvaltool version 2>&1 | tee conda_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: Conda_Install_Linux_python_${{ matrix.python-version }}
path: conda_install_linux_artifacts_python_${{ matrix.python-version }}

osx:
runs-on: "macos-latest"
strategy:
matrix:
python-version: [3.6, 3.7] # 3.8.5 not working as of 07-Sep-2020; serious issues at env solving
fail-fast: false
name: OSX Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v2
- uses: goanpeca/setup-miniconda@v1
with:
python-version: ${{ matrix.python-version }}
miniconda-version: "latest"
channels: esmvalgroup,conda-forge
- shell: bash -l {0}
run: mkdir -p conda_install_osx_artifacts_python_${{ matrix.python-version }}
- shell: bash -l {0}
run: conda --version 2>&1 | tee conda_install_osx_artifacts_python_${{ matrix.python-version }}/conda_version.txt
- shell: bash -l {0}
run: which conda 2>&1 | tee conda_install_osx_artifacts_python_${{ matrix.python-version }}/conda_path.txt
- shell: bash -l {0}
run: python -V 2>&1 | tee conda_install_osx_artifacts_python_${{ matrix.python-version }}/python_version.txt
# ncurses needs to be from conda-forge and not main channel
# for now it's turned off since we're not testing R/Julia installs
# - shell: bash -l {0}
# run: conda uninstall -y ncurses
# - shell: bash -l {0}
# run: conda list ncurses
# - shell: bash -l {0}
# run: conda install -y conda-forge::ncurses
# - shell: bash -l {0}
# run: conda list ncurses
- shell: bash -l {0}
#run: conda install esmvaltool --no-update-deps 2>&1 | tee conda_install_osx_artifacts_python_${{ matrix.python-version }}/install.txt
run: conda install esmvaltool-python esmvaltool-ncl 2>&1 | tee conda_install_osx_artifacts_python_${{ matrix.python-version }}/install.txt
- shell: bash -l {0}
run: esmvaltool --help
- shell: bash -l {0}
run: esmvaltool version 2>&1 | tee conda_install_osx_artifacts_python_${{ matrix.python-version }}/version.txt
- name: Upload artifacts
if: ${{ always() }} # upload artifacts even if fail
uses: actions/upload-artifact@v2
with:
name: Conda_Install_OSX_python_${{ matrix.python-version }}
path: conda_install_osx_artifacts_python_${{ matrix.python-version }}
81 changes: 81 additions & 0 deletions .github/workflows/action-install-from-source.yml
@@ -0,0 +1,81 @@
name: Source Install

# runs on a push on master and at the end of every day
on:
push:
branches:
- master
- github-actions2 # testing branch
schedule:
- cron: '0 0 * * *'

jobs:
linux:
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
fail-fast: false
name: Linux Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v2
- uses: goanpeca/setup-miniconda@v1
with:
activate-environment: esmvaltool
environment-file: environment.yml
python-version: ${{ matrix.python-version }}
miniconda-version: "latest"
channels: conda-forge
- shell: bash -l {0}
run: mkdir -p source_install_linux_artifacts_python_${{ matrix.python-version }}
- shell: bash -l {0}
run: conda --version 2>&1 | tee source_install_linux_artifacts_python_${{ matrix.python-version }}/conda_version.txt
- shell: bash -l {0}
run: python -V 2>&1 | tee source_install_linux_artifacts_python_${{ matrix.python-version }}/python_version.txt
- shell: bash -l {0}
run: pip install -e .[develop] 2>&1 | tee source_install_linux_artifacts_python_${{ matrix.python-version }}/install.txt
- shell: bash -l {0}
run: esmvaltool --help
- shell: bash -l {0}
run: esmvaltool version 2>&1 | tee source_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: Source_Install_Linux_python_${{ matrix.python-version }}
path: source_install_linux_artifacts_python_${{ matrix.python-version }}

osx:
runs-on: "macos-latest"
strategy:
matrix:
python-version: [3.6, 3.7] # 3.8.5 poses serious issues at env solving stage
fail-fast: false
name: OSX Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v2
- uses: goanpeca/setup-miniconda@v1
with:
activate-environment: esmvaltool
environment-file: environment.yml
python-version: ${{ matrix.python-version }}
miniconda-version: "latest"
channels: conda-forge
- shell: bash -l {0}
run: mkdir -p source_install_osx_artifacts_python_${{ matrix.python-version }}
- shell: bash -l {0}
run: conda --version 2>&1 | tee source_install_osx_artifacts_python_${{ matrix.python-version }}/conda_version.txt
- shell: bash -l {0}
run: python -V 2>&1 | tee source_install_osx_artifacts_python_${{ matrix.python-version }}/python_version.txt
- shell: bash -l {0}
run: pip install -e .[develop] 2>&1 | tee source_install_osx_artifacts_python_${{ matrix.python-version }}/install.txt
- shell: bash -l {0}
run: esmvaltool --help
- shell: bash -l {0}
run: esmvaltool version 2>&1 | tee source_install_osx_artifacts_python_${{ matrix.python-version }}/version.txt
- name: Upload artifacts
if: ${{ always() }} # upload artifacts even if fail
uses: actions/upload-artifact@v2
with:
name: Source_Install_OSX_python_${{ matrix.python-version }}
path: source_install_osx_artifacts_python_${{ matrix.python-version }}
89 changes: 89 additions & 0 deletions .github/workflows/action-test.yml
@@ -0,0 +1,89 @@
name: Test

# runs on a push on master and at the end of every day
on:
push:
branches:
- master
- github-actions2 # testing branch
schedule:
- cron: '0 0 * * *'

jobs:
linux:
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
fail-fast: false
name: Linux Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v2
- uses: goanpeca/setup-miniconda@v1
with:
activate-environment: esmvaltool
environment-file: environment.yml
python-version: ${{ matrix.python-version }}
miniconda-version: "latest"
channels: conda-forge
- shell: bash -l {0}
run: mkdir -p test_linux_artifacts_python_${{ matrix.python-version }}
- shell: bash -l {0}
run: conda --version 2>&1 | tee test_linux_artifacts_python_${{ matrix.python-version }}/conda_version.txt
- shell: bash -l {0}
run: python -V 2>&1 | tee test_linux_artifacts_python_${{ matrix.python-version }}/python_version.txt
- shell: bash -l {0}
run: pip install -e .[develop] 2>&1 | tee test_linux_artifacts_python_${{ matrix.python-version }}/install.txt
- shell: bash -l {0}
run: esmvaltool install R
- shell: bash -l {0}
run: esmvaltool install Julia
- shell: bash -l {0}
run: pytest -n 2 -m "not installation" 2>&1 | tee test_linux_artifacts_python_${{ matrix.python-version }}/test_report.txt
- name: Upload artifacts
if: ${{ always() }} # upload artifacts even if fail
uses: actions/upload-artifact@v2
with:
name: Test_Linux_python_${{ matrix.python-version }}
path: test_linux_artifacts_python_${{ matrix.python-version }}

osx:
runs-on: "macos-latest"
strategy:
matrix:
python-version: [3.6, 3.7] # 3.8.5 poses serious issues with environment solving
fail-fast: false
name: OSX Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v2
- uses: goanpeca/setup-miniconda@v1
with:
activate-environment: esmvaltool
environment-file: environment.yml
python-version: ${{ matrix.python-version }}
miniconda-version: "latest"
channels: conda-forge
- shell: bash -l {0}
run: mkdir -p test_osx_artifacts_python_${{ matrix.python-version }}
- shell: bash -l {0}
run: conda --version 2>&1 | tee test_osx_artifacts_python_${{ matrix.python-version }}/conda_version.txt
- shell: bash -l {0}
run: python -V 2>&1 | tee test_osx_artifacts_python_${{ matrix.python-version }}/python_version.txt
- shell: bash -l {0}
run: pip install -e .[develop] --use-feature=2020-resolver 2>&1 | tee test_osx_artifacts_python_${{ matrix.python-version }}/install.txt
# ncurses needs to be from conda-forge and not main channel
# for now it's turned off since we're not testing R/Julia installs
# - shell: bash -l {0}
# run: conda install -y conda-forge::ncurses 2>&1 | tee test_osx_artifacts_python_${{ matrix.python-version }}/ncurses.txt
# - shell: bash -l {0}
# run: esmvaltool install R
# - shell: bash -l {0}
# run: esmvaltool install Julia
- shell: bash -l {0}
run: pytest -n 2 -m "not installation" 2>&1 | tee test_osx_artifacts_python_${{ matrix.python-version }}/test_report.txt
- name: Upload artifacts
if: ${{ always() }} # upload artifacts even if fail
uses: actions/upload-artifact@v2
with:
name: Test_OSX_python_${{ matrix.python-version }}
path: test_osx_artifacts_python_${{ matrix.python-version }}
2 changes: 2 additions & 0 deletions tests/unit/test_lint.py
@@ -1,5 +1,6 @@
"""Lint tests."""
import os
import pytest
import subprocess
import textwrap
from pathlib import Path
Expand Down Expand Up @@ -41,6 +42,7 @@ def test_nclcodestyle():
assert success, "Your NCL code does not follow our formatting standards."


@pytest.mark.installation
def test_r_lint(monkeypatch):
"""Test R lint."""
monkeypatch.setenv("LINTR_COMMENT_BOT", "FALSE")
Expand Down

0 comments on commit 1125c36

Please sign in to comment.