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 7, 2023
1 parent e00c05f commit 6bcc269
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
7 changes: 3 additions & 4 deletions .github/env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ name: test_environment
channels:
- conda-forge
- bioconda
- defaults
- anaconda
dependencies:
- python >=3.7,<3.10
- biobb_common ==4.0.0
- pandas ==1.3.0
- biobb_common ==4.1.0
- pandas >=1.3.0
- scikit-learn ==0.24.2
- curves ==3.0.0

33 changes: 19 additions & 14 deletions .github/workflows/linting_and_testing.yml
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,30 +35,35 @@ 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
pytest-html
flake8
pillow
imagehash
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 @@ -73,7 +78,7 @@ jobs:
flake8 . --exclude=docs --ignore=C901,E226 --count --exit-zero --max-complexity=10 --max-line-length=9999 --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 @@ -84,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 @@ -103,12 +108,12 @@ jobs:
pytest biobb_dna/test/unitests/ --cov=biobb_dna/ --cov-report=xml --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 @@ -123,7 +128,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


0 comments on commit 6bcc269

Please sign in to comment.