Skip to content

Changes to input arguments #89

Changes to input arguments

Changes to input arguments #89

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Create Python package and publish it
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
release:
types: [created]
workflow_dispatch:
inputs:
version_name:
description: 'Version used on testPypi'
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.12
uses: actions/setup-python@v2
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install black flake8 setuptools wheel mypy==1.10.1 types-PyYAML
python -m pip install -r requirements.txt
- name: Check formatting with black
run: black --target-version py312 --line-length 127 --required-version 24 --check wirepas_provisioning_server/
- name: Lint with flake8
run: |
# 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: Install wheel locally
# run: pip install .
- name: Check typing with mypy
run: mypy wirepas_provisioning_server/
- name: Set Version for master push
if: ${{ github.event_name == 'push' }}
run: echo "VERSION=v0.0.dev0" >> $GITHUB_ENV
- name: Set Version for release
if: ${{ github.event_name == 'release' }}
run: echo "VERSION=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
- name: Set Version for PR
if: ${{ github.event_name == 'pull_request' }}
run: echo "VERSION=0.0.dev${{ github.event.pull_request.number }}" >> $GITHUB_ENV
- name: Set Version for manual triggering
if: ${{ github.event_name == 'workflow_dispatch' }}
run: echo "VERSION=${{ github.event.inputs.version_name }}" >> $GITHUB_ENV
- name: Set the version
run: |
sed -i '/__version__ = /c\__version__ = "${{ env.VERSION }}"' wirepas_provisioning_server/__about__.py
- name: Build the wheel
run: python setup.py sdist bdist_wheel
- name: Save produced wheel name and path
run: echo "WHEEL_FILE=$(ls dist/*-py3-none-any.whl)" >> $GITHUB_ENV
- name: Store artifacts
uses: actions/upload-artifact@v2
with:
path: ${{ env.WHEEL_FILE }}
- name: Upload Wheel for releases
if: ${{ github.event_name == 'release' }}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ env.WHEEL_FILE }}
asset_content_type: application/zip
asset_name: wirepas_provisioning-${{ env.VERSION }}-py3-none-any.whl
- name: Publish package to TestPyPI for manual build
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_TEST_PWD }}
repository_url: https://test.pypi.org/legacy/
- name: Publish package to PyPI for release
if: ${{ github.event_name == 'release' }}
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_PWD }}