diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0179f42..6c336f2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,28 +6,37 @@ jobs: build-linux: runs-on: ubuntu-latest timeout-minutes: 5 - + strategy: + matrix: + env: [current, next] steps: - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: 3.6 - - name: Install dependencies + - name: update conda env + shell: bash run: | - # $CONDA is an environment variable pointing to the root of the miniconda directory - # note that most requirements are dependencies of iris so don't need to explicitly include - $CONDA/bin/conda install -c conda-forge python=3.6 iris=2.2.0 numpy=1.15 cartopy=0.17.0 cftime=1.0.0b1 mo_pack imagehash - - name: Lint with flake8 + source '/usr/share/miniconda/etc/profile.d/conda.sh' + conda install -c conda-forge mamba + mamba env update -q --file envs/default-${{ matrix.env }}.yml --name default-${{ matrix.env }} + - name: conda info run: | - $CONDA/bin/conda install flake8 - # stop the build if there are Python syntax errors or undefined names - # TODO: Add/sub more codes below - $CONDA/bin/flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - $CONDA/bin/flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test with pytest + source '/usr/share/miniconda/etc/profile.d/conda.sh' + conda activate default-${{ matrix.env }} + conda info + conda list + - name: pytest run: | - conda install pytest + source '/usr/share/miniconda/etc/profile.d/conda.sh' + conda activate default-${{ matrix.env }} cd lib - $CONDA/bin/pytest + pytest -p no:warnings -v + - name: flake8 + run: | + source '/usr/share/miniconda/etc/profile.d/conda.sh' + conda activate default-${{ matrix.env }} + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exit-zero --max-complexity=10 --max-line-length=127 + - name: Sphinx + run: | + source '/usr/share/miniconda/etc/profile.d/conda.sh' + conda activate default-${{ matrix.env }} + cd docsrc + make github diff --git a/envs/default-current.yml b/envs/default-current.yml new file mode 100644 index 0000000..fa2704a --- /dev/null +++ b/envs/default-current.yml @@ -0,0 +1,17 @@ +# Use this file to create a conda environment using: +# conda env create --file envs/default-current.yml + +name: default-current +channels: + - conda-forge +dependencies: + - python=3.6 + - iris=2.2 + - numpy=1.15 + - cartopy=0.17.0 + - cftime=1.0.0b1 + - mo_pack + - imagehash + - pytest + - flake8 + - sphinx=3.4.3 diff --git a/envs/default-next.yml b/envs/default-next.yml new file mode 100644 index 0000000..ef5e01b --- /dev/null +++ b/envs/default-next.yml @@ -0,0 +1,17 @@ +# Use this file to create a conda environment using: +# conda env create --file envs/default-next.yml + +name: default-next +channels: + - conda-forge +dependencies: + - python=3.7 + - iris=2.4 + - numpy=1.15 + - cartopy=0.17.0 + - cftime=1.0.0b1 + - mo_pack + - imagehash + - pytest + - flake8 + - sphinx=3.4.3