Skip to content

Commit

Permalink
Tests in GH actions
Browse files Browse the repository at this point in the history
  • Loading branch information
gbayarri committed Sep 13, 2023
1 parent 5e88f0f commit 1aca248
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 17 deletions.
5 changes: 2 additions & 3 deletions .github/env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ channels:
- bioconda
- defaults
dependencies:
- python >=3.7,<3.10
- biobb_common ==4.0.0
- biobb_common ==4.1.0
- mdanalysis >=2.0.0
- biobb_structure_checking ==3.13.0
- biobb_structure_checking ==3.13.4
- cmip ==2.7.0
31 changes: 19 additions & 12 deletions .github/workflows/linting_and_testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
strategy:
matrix:
os: [self-hosted]
python-version: ["3.7", "3.8", "3.9"]
python-version: ["3.8", "3.9", "3.10"]
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository code
Expand All @@ -35,11 +35,18 @@ jobs:
run: |
ls ${{ github.workspace }}
- name: Remove all micromamba installations
run: |
rm -rf /home/user/.bash_profile /home/user/.conda /home/user/micromamba /home/user/micromamba-bin 2>/dev/null
touch /home/user/.bash_profile
- name: provision-with-micromamba
uses: mamba-org/provision-with-micromamba@main
uses: mamba-org/setup-micromamba@v1
with:
generate-run-shell: true
post-cleanup: all
environment-file: .github/env.yaml
extra-specs: |
create-args: >-
python=${{ matrix.python-version }}
pytest
pytest-cov
Expand All @@ -48,15 +55,15 @@ jobs:
pip
- name: Install genbadge from pip
shell: bash -l {0} # necessary for conda env to be active
shell: micromamba-shell {0} # necessary for conda env to be active
run: pip install genbadge[all]

- name: List installed package versions
shell: bash -l {0} # necessary for conda env to be active
shell: micromamba-shell {0} # necessary for conda env to be active
run: micromamba list

- name: Lint with flake8
shell: bash -l {0} # necessary for conda env to be active
shell: micromamba-shell {0} # necessary for conda env to be active
run: |
# F Codes: https://flake8.pycqa.org/en/latest/user/error-codes.html
# E Code: https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes
Expand All @@ -71,7 +78,7 @@ jobs:
flake8 . --exclude=docs --ignore=C901,E226 --count --exit-zero --max-complexity=10 --max-line-length=999 --statistics --format=html --htmldir=./reports/flake8/ --tee --output-file=./reports/flake8/flake8stats.txt
- name: Generate Flake8 badge
shell: bash -l {0} # necessary for conda env to be active
shell: micromamba-shell {0} # necessary for conda env to be active
run: |
genbadge flake8 --name "Flake8" --input-file ./reports/flake8/flake8stats.txt --output-file ./reports/flake8/flake8badge.svg
Expand All @@ -82,7 +89,7 @@ jobs:
path: './biobb_common'

- name: Run tests
shell: bash -l {0} # necessary for conda env to be active
shell: micromamba-shell {0} # necessary for conda env to be active
run: |
# Ignoring docker and singularity tests
export PYTHONPATH=.:./biobb_common:$PYTHONPATH
Expand All @@ -94,12 +101,12 @@ jobs:
pytest biobb_cmip/test/unitests/ --cov=biobb_cmip/ --cov-report=xml --ignore-glob=*container.py --ignore-glob=*docker.py --ignore-glob=*singularity.py --junit-xml=./reports/junit/junit.xml --html=./reports/junit/report.html
- name: Generate Tests badge
shell: bash -l {0} # necessary for conda env to be active
shell: micromamba-shell {0} # necessary for conda env to be active
run: |
genbadge tests --name "Tests" --input-file ./reports/junit/junit.xml --output-file ./reports/junit/testsbadge.svg
- name: Generate Coverage badge
shell: bash -l {0} # necessary for conda env to be active
shell: micromamba-shell {0} # necessary for conda env to be active
run: |
# Create directory for flake8 reports
mkdir -p ./reports/coverage
Expand All @@ -114,7 +121,7 @@ jobs:
with:
folder: ./reports

- name: Restore .bash_profile
run: cp ~/.bash_profile_orig ~/.bash_profile
# - name: Restore .bash_profile
# run: cp ~/.bash_profile_orig ~/.bash_profile


2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ sphinx:

# Optionally set the version of Python and requirements required to build your docs
python:
version: "3.7"
version: "3.8"
install:
- requirements: biobb_cmip/docs/source/requirements.txt
- method: pip
Expand Down
2 changes: 1 addition & 1 deletion biobb_cmip/docs/source/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
docutils==0.17.1
# docutils==0.17.1

0 comments on commit 1aca248

Please sign in to comment.