use poetry for packaging #834
Workflow file for this run
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: 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 Python Dependencies using Poetry | |
- name: Install dependencies | |
run: | | |
poetry install --with dev | |
# Step 6: Run Tests and Generate Coverage Report | |
- name: Run tests and coverage | |
run: | | |
poetry run pytest ./tests/ --cov=./src/pyhgf/ --cov-report=xml | |
# Step 7: 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 |