RT-Migration #135
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: Python application | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install linting tools | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8 black isort | |
- 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. | |
flake8 . --count --exit-zero --max-complexity=10 --statistics | |
- name: Format code with Black | |
run: | | |
black . --exclude="" --check --verbose | |
- name: Sort imports with isort | |
run: | | |
isort . --profile=black --check-only --verbose | |
- name: Run tests for Python 3.8 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.8 | |
- name: Install dependencies and run tests (3.8) | |
env: | |
API_KEY: ${{ secrets.API_KEY }} | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install poetry | |
poetry install --no-root | |
poetry run python -m unittest discover tests | |
- name: Run tests for Python 3.9 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies and run tests (3.9) | |
env: | |
API_KEY: ${{ secrets.API_KEY }} | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install poetry | |
poetry install --no-root | |
poetry run python -m unittest discover tests | |
- name: Run tests for Python 3.10 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies and run tests (3.10) | |
env: | |
API_KEY: ${{ secrets.API_KEY }} | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install poetry | |
poetry install --no-root | |
poetry run python -m unittest discover tests | |
- name: Run tests for Python 3.11 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies and run tests (3.11) | |
env: | |
API_KEY: ${{ secrets.API_KEY }} | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install poetry | |
poetry install --no-root | |
poetry run python -m unittest discover tests | |
- name: Run tests for Python 3.12 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.12" | |
- name: Install dependencies and run tests (3.12) | |
env: | |
API_KEY: ${{ secrets.API_KEY }} | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install poetry | |
poetry install --no-root | |
poetry run python -m unittest discover tests |