Skip to content

Set the correct firefox location for Linux. #21

Set the correct firefox location for Linux.

Set the correct firefox location for Linux. #21

# 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 TestPyPi index
on: [push]
jobs:
deploy:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
# GitVersion setup : see examples at https://github.com/GitTools/actions/blob/main/docs/examples/github/gitversion/setup/usage-examples.md
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.9.7
with:
versionSpec: '5.x'
includePrerelease: false
# GitVersion execution : see examples at https://github.com/GitTools/actions/blob/main/docs/examples/github/gitversion/execute/usage-examples.md
- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/execute@v0.9.7
- name: Display GitVersion outputs
run: |
echo "Major: ${{ steps.gitversion.outputs.major }}"
echo "Minor: ${{ steps.gitversion.outputs.minor }}"
echo "Patch: ${{ steps.gitversion.outputs.patch }}"
echo "PreReleaseTag: ${{ steps.gitversion.outputs.preReleaseTag }}"
echo "PreReleaseTagWithDash: ${{ steps.gitversion.outputs.preReleaseTagWithDash }}"
echo "PreReleaseLabel: ${{ steps.gitversion.outputs.preReleaseLabel }}"
echo "PreReleaseNumber: ${{ steps.gitversion.outputs.preReleaseNumber }}"
echo "WeightedPreReleaseNumber: ${{ steps.gitversion.outputs.weightedPreReleaseNumber }}"
echo "BuildMetaData: ${{ steps.gitversion.outputs.buildMetaData }}"
echo "BuildMetaDataPadded: ${{ steps.gitversion.outputs.buildMetaDataPadded }}"
echo "FullBuildMetaData: ${{ steps.gitversion.outputs.fullBuildMetaData }}"
echo "MajorMinorPatch: ${{ steps.gitversion.outputs.majorMinorPatch }}"
echo "SemVer: ${{ steps.gitversion.outputs.semVer }}"
echo "LegacySemVer: ${{ steps.gitversion.outputs.legacySemVer }}"
echo "LegacySemVerPadded: ${{ steps.gitversion.outputs.legacySemVerPadded }}"
echo "AssemblySemVer: ${{ steps.gitversion.outputs.assemblySemVer }}"
echo "AssemblySemFileVer: ${{ steps.gitversion.outputs.assemblySemFileVer }}"
echo "FullSemVer: ${{ steps.gitversion.outputs.fullSemVer }}"
echo "InformationalVersion: ${{ steps.gitversion.outputs.informationalVersion }}"
echo "BranchName: ${{ steps.gitversion.outputs.branchName }}"
echo "EscapedBranchName: ${{ steps.gitversion.outputs.escapedBranchName }}"
echo "Sha: ${{ steps.gitversion.outputs.sha }}"
echo "ShortSha: ${{ steps.gitversion.outputs.shortSha }}"
echo "NuGetVersionV2: ${{ steps.gitversion.outputs.nuGetVersionV2 }}"
echo "NuGetVersion: ${{ steps.gitversion.outputs.nuGetVersion }}"
echo "NuGetPreReleaseTagV2: ${{ steps.gitversion.outputs.nuGetPreReleaseTagV2 }}"
echo "NuGetPreReleaseTag: ${{ steps.gitversion.outputs.nuGetPreReleaseTag }}"
echo "VersionSourceSha: ${{ steps.gitversion.outputs.versionSourceSha }}"
echo "CommitsSinceVersionSource: ${{ steps.gitversion.outputs.commitsSinceVersionSource }}"
echo "CommitsSinceVersionSourcePadded: ${{ steps.gitversion.outputs.commitsSinceVersionSourcePadded }}"
echo "UncommittedChanges: ${{ steps.gitversion.outputs.uncommittedChanges }}"
echo "CommitDate: ${{ steps.gitversion.outputs.commitDate }}"
- 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.TEST_PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }}
run: |
python updateVersion.py --nextVersion ${{ steps.gitversion.outputs.majorMinorPatch }}.dev${{ steps.gitversion.outputs.buildMetaData }}
python setup.py sdist bdist_wheel --python-tag ${{ steps.python-tag.outputs.replaced }}
twine upload --skip-existing --repository testpypi dist/*
if: ${{ matrix.python-version == 3.10 && github.repository == 'ssenart/PyVeoliaIDF' }}