Skip to content

fix pre-commit paths and Rust CI #908

fix pre-commit paths and Rust CI

fix pre-commit paths and Rust CI #908

Workflow file for this run

name: Test
on:
push:
branches:
- master
pull_request:
# This will run the action for pull requests from any branch
branches:
- '*'
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.12'] # Add more Python versions if needed, like '3.8', '3.9', '3.10', etc.
steps:
# Step 1: Checkout the repository
- name: Checkout Repository
uses: actions/checkout@v4
# Step 2: Set up Python environment
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
# Step 3: Install Poetry
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "$HOME/.local/bin" >> $GITHUB_PATH
poetry self add "poetry-dynamic-versioning[plugin]"
# Step 4: Install System Dependencies
- name: Install Graphviz
run: sudo apt-get install -y graphviz
# Step 5: Install Rust
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
# Step 6: Install Python Dependencies using Poetry
- name: Install dependencies
run: |
poetry install --with dev
# Step 7: Install the Rust package
- name: Build and Install the Package
run: poetry run maturin develop
# Step 8: Run Tests and Generate Coverage Report
- name: Run tests and coverage
run: |
poetry run pytest ./tests/ --cov=./src/pyhgf/ --cov-report=xml
# Step 9: Upload Coverage Report to Codecov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }} # Make sure to set this token in repository secrets