Node 20 updates #242
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
name: Testing and distribution | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
lint-python: | |
name: Lint Python code | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- id: install | |
name: Install Python, pipenv and Pipfile packages | |
uses: palewire/install-python-pipenv-pipfile@v2 | |
with: | |
python-version: 3.9 | |
- id: lint | |
name: Lint Python code | |
run: make lint | |
test-python: | |
strategy: | |
matrix: | |
python: ["3.9",] | |
name: Test Python code | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- id: install | |
name: Install Python, pipenv and Pipfile packages | |
uses: palewire/install-python-pipenv-pipfile@v2 | |
with: | |
python-version: ${{ matrix.python }} | |
- id: run | |
name: Run tests | |
run: pipenv run pytest --cov | |
env: | |
BLN_API_TOKEN: ${{ secrets.BLN_API_TOKEN }} | |
test-build: | |
name: Build Python package | |
runs-on: ubuntu-latest | |
needs: [test-python] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- id: install | |
name: Install Python, pipenv and Pipfile packages | |
uses: palewire/install-python-pipenv-pipfile@v2 | |
with: | |
python-version: 3.9 | |
- id: build | |
name: Build release | |
run: | | |
pipenv run python setup.py sdist | |
pipenv run python setup.py bdist_wheel | |
ls -l dist | |
- id: check | |
name: Check release | |
run: pipenv run twine check dist/* | |
- id: save | |
name: Save artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-${{ github.run_number }} | |
path: ./dist | |
if-no-files-found: error | |
test-release: | |
name: Test PyPI release | |
runs-on: ubuntu-latest | |
needs: [test-build] | |
if: startsWith(github.ref, 'refs/tags') == 0 | |
steps: | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- id: fetch | |
name: Fetch artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: build-${{ github.run_number }} | |
path: ./dist | |
- id: publish | |
name: Publish release | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
if: env.TEST_PYPI_API_TOKEN != null | |
with: | |
user: __token__ | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
repository_url: https://test.pypi.org/legacy/ | |
verbose: true | |
verify_metadata: false | |
tag-release: | |
name: Tagged PyPI release | |
runs-on: ubuntu-latest | |
needs: [test-build] | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
steps: | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- id: fetch | |
name: Fetch artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: build-${{ github.run_number }} | |
path: ./dist | |
- id: publish | |
name: Publish release | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
verbose: true | |
verify_metadata: false |