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
# This workflows will upload a Python Package using Twine when a release is created | |
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | |
# Python workflow : https://docs.github.com/en/actions/guides/building-and-testing-python | |
name: Upload Python Package to PyPi index | |
on: | |
release: | |
types: [created] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: | |
- "3.9" | |
- "3.10" | |
- "3.11" | |
- "3.12" | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Firefox | |
run: | | |
sudo apt -y update | |
sudo apt -y install firefox | |
sudo apt -y --only-upgrade install firefox | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install wheel flake8 pytest pytest-cov setuptools wheel twine | |
- name: Install requirements | |
run: | | |
pip install -r requirements.txt | |
- name: Run lint tests | |
run: | | |
flake8 . --count --ignore=E501 --show-source --statistics | |
# stop the build if there are Python syntax errors or undefined names | |
#flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
#flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Test with pytest | |
env: | |
VEOLIAIDF_USERNAME: ${{ secrets.VEOLIAIDF_USERNAME }} | |
VEOLIAIDF_PASSWORD: ${{ secrets.VEOLIAIDF_PASSWORD }} | |
run: | | |
pytest tests --doctest-modules --junitxml=junit/test-results-${{ matrix.python-version }}.xml --cov=pyveoliaidf --cov-report=xml --cov-report=html --log-cli-level=DEBUG --log-cli-format="%(asctime)s %(levelname)s [%(name)s] %(message)s" | |
- name: Upload pytest test results | |
uses: actions/upload-artifact@v2 | |
with: | |
name: pytest-results-${{ matrix.python-version }} | |
path: | | |
junit/test-results-${{ matrix.python-version }}.xml | |
tmp/ | |
if: ${{ always() }} | |
- name: Wheel Python Tag creation | |
uses: frabert/replace-string-action@master | |
id: python-tag | |
with: | |
pattern: '(\w+)\.(\w+)' | |
string: '${{ matrix.python-version }}' | |
replace-with: 'py$1$2' | |
flags: 'g' | |
- name: Build and publish | |
env: | |
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
run: | | |
python updateVersion.py --nextVersion ${{ github.event.release.tag_name }} | |
python setup.py sdist bdist_wheel --python-tag ${{ steps.python-tag.outputs.replaced }} | |
twine upload --skip-existing dist/* | |
if: github.repository == 'ssenart/PyVeoliaIDF' |