Skip to content

1.0.0-rc.1

1.0.0-rc.1 #41

Workflow file for this run

name: CI for Tests and Package Publishing
on:
push:
branches:
- '**'
pull_request:
branches:
- main
release:
types:
- published
workflow_dispatch:
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
export PATH="$HOME/.local/bin:$PATH"
- name: Install dependencies
run: |
poetry install
- name: Run pre-commit hooks
run: |
poetry run pre-commit run --all-files
- name: Run tests with tox
run: |
poetry run tox
- name: Stop on failure
if: failure()
run: exit 1
- name: Upload to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
flags: unittests
fail_ci_if_error: true
verbose: true
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload HTML coverage report
if: always()
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: htmlcov/
publish:
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'release' # Exécuter uniquement lors d'une release
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
export PATH="$HOME/.local/bin:$PATH"
- name: Install dependencies
run: poetry install --no-dev
- name: Build package
run: poetry build
- name: Publish package
run: poetry publish --username __token__ --password ${{ secrets.PYPI_API_TOKEN }}