Skip to content

chore: sync sdk code with DeepLearning repo #59

chore: sync sdk code with DeepLearning repo

chore: sync sdk code with DeepLearning repo #59

Workflow file for this run

name: Code Quality
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "master" branch
push:
branches: ["master"]
pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
concurrency:
# Cancel previous actions from the same PR or branch except 'master' branch.
# See https://docs.github.com/en/actions/using-jobs/using-concurrency and https://docs.github.com/en/actions/learn-github-actions/contexts for more info.
group: concurrency-group::${{ github.workflow }}::${{ github.event.pull_request.number > 0 && format('pr-{0}', github.event.pull_request.number) || github.ref_name }}${{ github.ref_name == 'master' && format('::{0}', github.run_id) || ''}}
cancel-in-progress: ${{ github.ref_name != 'master' }}
jobs:
ruff:
needs: []
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Get all changed and modified files.
- uses: dorny/paths-filter@v2
id: filter
with:
list-files: shell
filters: |
python:
- added|modified: 'assemblyai/**/*.py'
# Get count of filtered files.
- run: |
if [ '${{ steps.filter.outputs.python_files }}' != '' ]; then
echo count=$(ls ${{ steps.filter.outputs.python_files }} | wc -l) >> "$GITHUB_OUTPUT"
else
echo count=0 >> "$GITHUB_OUTPUT"
fi
id: counter
if: ${{ steps.filter.outputs.python == 'true' }}
shell: bash
name: Run count files
# Run ruff on filtered files if there are any.
- uses: chartboost/ruff-action@v1
name: Run 'ruff format --check --config ./ruff.toml'
if: ${{ steps.counter.outputs.count > 0 }}
with:
version: 0.3.5
args: 'format --check --config ./ruff.toml'
src: ${{ steps.filter.outputs.python_files }}
- uses: chartboost/ruff-action@v1
name: Run 'ruff'
if: ${{ steps.counter.outputs.count > 0 }}
with:
version: 0.3.5
args: '--config ./ruff.toml'
src: ${{ steps.filter.outputs.python_files }}
mypy:
needs: []
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Get all changed and modified files.
- uses: dorny/paths-filter@v2
id: filter
with:
list-files: shell
filters: |
python:
- added|modified: 'assemblyai/**/*.py'
# Get count of filtered files.
- run: |
if [ '${{ steps.filter.outputs.python_files }}' != '' ]; then
echo count=$(ls ${{ steps.filter.outputs.python_files }} | wc -l) >> "$GITHUB_OUTPUT"
else
echo count=0 >> "$GITHUB_OUTPUT"
fi
id: counter
if: ${{ steps.filter.outputs.python == 'true' }}
shell: bash
name: Run count files
# Run mypy on filtered files if there are any.
- uses: actions/setup-python@v4
if: ${{ steps.counter.outputs.count > 0 }}
with:
python-version: '3.9'
- run: pip install mypy==1.5.1
if: ${{ steps.counter.outputs.count > 0 }}
- run: mypy ${{ steps.filter.outputs.python_files }} --follow-imports=silent --ignore-missing-imports
if: ${{ steps.counter.outputs.count > 0 }}