[CI/CD](env.yaml): Update biobb_common version. #39
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: tests | |
on: | |
# workflow_dispatch | |
push: | |
branches: [ master ] | |
paths-ignore: | |
- '.gitignore' | |
- '.readthedocs.yaml' | |
- 'LICENSE' | |
- 'setup.py' | |
- 'README.md' | |
- 'CITATION.cff' | |
- 'references.jsonld' | |
- '**/docs/**' | |
- '**/json_schemas/**' | |
jobs: | |
# Name of the Job | |
lint_and_test: | |
strategy: | |
matrix: | |
os: [self-hosted] | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- run: echo "Repository -> ${{ github.repository }}" | |
- run: echo "Branch -> ${{ github.ref }}" | |
- run: echo "Trigger event -> ${{ github.event_name }}" | |
- run: echo "Runner OS -> ${{ runner.os }}" | |
- name: List files in the repository | |
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: setup-micromamba | |
uses: mamba-org/setup-micromamba@v2.0.0 | |
with: | |
generate-run-shell: true | |
micromamba-version: '2.0.2-2' | |
post-cleanup: 'all' | |
init-shell: bash | |
environment-file: .github/env.yaml | |
create-args: >- | |
python=${{ matrix.python-version }} | |
pytest | |
pytest-cov | |
pytest-html | |
flake8 | |
pip | |
- name: Install genbadge from pip | |
shell: bash -l {0} | |
run: pip install genbadge[all] | |
- name: List installed package versions | |
shell: bash -l {0} | |
run: micromamba list | |
- name: Lint with flake8 | |
shell: bash -l {0} | |
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 | |
# Workflow fails: Stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# Create directory for flake8 reports | |
mkdir -p ./reports/flake8 | |
# Exit-zero treats all errors as warnings, workflow will not fail: | |
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} | |
run: | | |
genbadge flake8 --name "Flake8" --input-file ./reports/flake8/flake8stats.txt --output-file ./reports/flake8/flake8badge.svg | |
- name: Checkout biobb_common | |
uses: actions/checkout@v4 | |
with: | |
repository: bioexcel/biobb_common | |
path: './biobb_common' | |
- name: Run tests | |
shell: bash -l {0} | |
run: | | |
# Ignoring docker and singularity tests | |
export PYTHONPATH=.:./biobb_common:$PYTHONPATH | |
# Create directory for tests reports | |
mkdir -p ./reports/junit | |
# Producction one | |
pytest biobb_structure_utils/test/unitests/ --cov=biobb_structure_utils/ --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} | |
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} | |
run: | | |
# Create directory for flake8 reports | |
mkdir -p ./reports/coverage | |
coverage xml -o ./reports/coverage/coverage.xml | |
coverage html -d ./reports/coverage/ | |
genbadge coverage --name "Coverage" --input-file ./reports/coverage/coverage.xml --output-file ./reports/coverage/coveragebadge.svg | |
- name: Publish coverage report to GitHub Pages | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: ./reports | |
# - name: Restore .bash_profile | |
# run: cp ~/.bash_profile_orig ~/.bash_profile | |