Merge pull request #35 from ARKlab/renovate/actions-setup-python-4.x #160
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 workflow will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: Artesian SDK Python | |
on: | |
push: | |
branches: [master] | |
tags: | |
- 'v[0-9]+\.[0-9]+\.[0-9]+' | |
pull_request: | |
branches: [master] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
os: ["ubuntu-latest", "windows-latest", "macos-latest"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -e ".[dev]" | |
- name: Run flake8 | |
run: | | |
flake8 . | |
# Execute jordemort/action-pyright only into Ubuntu and macOS. | |
# windows started to fail for reviewdog not found. issue opened | |
# https://github.com/jordemort/action-pyright/issues/51 | |
- name: Run Pyright | |
if: matrix.os != 'windows-latest' | |
uses: jordemort/action-pyright@v1 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
reporter: github-check | |
lib: | |
level: warning | |
filter_mode: file | |
- name: Test Pytest | |
run: | | |
pytest --junitxml=junit/test-results-${{ matrix.python-version }}.xml | |
- name: Upload pytest test results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: pytest-results-${{ matrix.python-version }} | |
path: junit/test-results-${{ matrix.python-version }}.xml | |
# Use always() to always run this step to publish test results when there are test failures | |
if: ${{ always() }} | |
publish: | |
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')) | |
runs-on: ubuntu-latest | |
needs: build | |
env: | |
python-version: "3.11" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python ${{ env.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install build | |
- name: Build package | |
run: | | |
python -m build | |
- name: Publish package | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |