Skip to content

[#64] Captcha failed issue #141

[#64] Captcha failed issue

[#64] Captcha failed issue #141

# 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.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
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/[email protected]
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/[email protected]
- 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 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:
GRDF_USERNAME: ${{ secrets.GRDF_USERNAME }}
GRDF_PASSWORD: ${{ secrets.GRDF_PASSWORD }}
PCE_IDENTIFIER: ${{ secrets.PCE_IDENTIFIER }}
run: |
pytest tests --doctest-modules --junitxml=junit/test-results-${{ matrix.python-version }}.xml --cov=pygazpar --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: Version PreReleaseLabel alpha replaced by a letter
uses: frabert/replace-string-action@master
id: alpha_PreReleaseLabel
with:
pattern: 'alpha'
string: '${{ steps.gitversion.outputs.preReleaseLabel }}'
replace-with: 'a'
flags: 'g'
- name: Version PreReleaseLabel beta replaced by b letter
uses: frabert/replace-string-action@master
id: PreReleaseLabel
with:
pattern: 'beta'
string: '${{ steps.alpha_PreReleaseLabel.outputs.replaced }}'
replace-with: 'b'
flags: 'g'
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python updateVersion.py --nextVersion ${{ steps.gitversion.outputs.majorMinorPatch }}${{ steps.PreReleaseLabel.outputs.replaced }}${{ steps.gitversion.outputs.preReleaseNumber }}
python setup.py sdist bdist_wheel --python-tag ${{ steps.python-tag.outputs.replaced }}
# twine upload --skip-existing --repository testpypi dist/*
twine upload --skip-existing dist/*
if: ${{ github.repository == 'ssenart/PyGazpar' }}