Skip to content

Run Python Tests/Linting #1784

Run Python Tests/Linting

Run Python Tests/Linting #1784

Workflow file for this run

name: Run Python Tests/Linting
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: "0 8 * * *"
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install poetry
run: |
pipx install poetry
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
- name: Install dependencies
run: |
poetry check
poetry lock --no-update
poetry install --verbose
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
poetry run poe lint
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
poetry run flake8 . --exclude "jupyter" --count --exit-zero --max-complexity=10 --statistics
- name: Test SDK with pytest
run: |
poetry run poe test
env:
LW_ACCOUNT: ${{ secrets.LW_ACCOUNT }}
LW_SUBACCOUNT: ${{ secrets.LW_SUBACCOUNT }}
LW_API_KEY: ${{ secrets.LW_API_KEY }}
LW_API_SECRET: ${{ secrets.LW_API_SECRET }}
LW_BASE_DOMAIN: ${{ secrets.LW_BASE_DOMAIN }}
- name: Report Status
if: github.ref_name == 'main'
uses: ravsamhq/notify-slack-action@v2
with:
status: ${{ job.status }}
notify_when: "failure"
notification_title: "{workflow} has {status_message}"
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
footer: "Linked Repo <{repo_url}|{repo}> | <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Workflow>"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}