Skip to content

add env to workflow #17

add env to workflow

add env to workflow #17

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
COVERAGE_PYTHON_VERSION: "3.8" # make coverage badge only for this version
jobs:
test:
name: Test RustBam on Ubuntu with Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential python3-dev python3-pip cargo
- name: Setup Virtual Environment
run: |
python -m venv venv
source venv/bin/activate
pip install maturin pytest coverage
- name: Build and Install RustBam
run: |
source venv/bin/activate
maturin develop
- name: Verify RustBam CLI
run: |
source venv/bin/activate
rustbam --help
- name: Run Tests with Coverage
run: |
source venv/bin/activate
coverage run -m pytest -v
coverage report -m
- name: Coverage Badge
uses: tj-actions/coverage-badge-py@v2
if: matrix.python-version == env.COVERAGE_PYTHON_VERSION
- name: Verify Changed files
uses: tj-actions/verify-changed-files@v17
id: verify-changed-files
if: matrix.python-version == env.COVERAGE_PYTHON_VERSION
with:
files: coverage.svg
- name: Commit files
if: steps.verify-changed-files.outputs.files_changed == 'true' && matrix.python-version == env.COVERAGE_PYTHON_VERSION
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add coverage.svg
git commit -m "update coverage.svg"
- name: Push changes
if: steps.verify-changed-files.outputs.files_changed == 'true' && matrix.python-version == env.COVERAGE_PYTHON_VERSION
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.github_token }}
branch: ${{ github.ref }}