Skip to content

Commit

Permalink
Merge pull request #182 from MetOffice/feature_actions_env_i175
Browse files Browse the repository at this point in the history
Feature actions env i175
  • Loading branch information
zmaalick authored Mar 12, 2021
2 parents 3f84129 + 6dbc9a7 commit 7f48d13
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 19 deletions.
47 changes: 28 additions & 19 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
17 changes: 17 additions & 0 deletions envs/default-current.yml
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions envs/default-next.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 7f48d13

Please sign in to comment.