workflows: Update to unified rules #2484
Workflow file for this run
This file contains hidden or 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 is a basic workflow to help you get started with Actions | |
| name: CI | |
| # Controls when the workflow will run | |
| on: | |
| # Triggers the workflow on push or pull request events but only for the | |
| # main branch | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| jobs: | |
| check: | |
| runs-on: ubuntu-22.04 | |
| strategy: | |
| matrix: | |
| python-version: ['3.10', '3.11'] | |
| steps: | |
| - name: Check out source code | |
| uses: actions/checkout@v2 | |
| - name: Set up Python | |
| uses: actions/setup-python@master | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install Python packages | |
| working-directory: docker/api | |
| run: | | |
| python --version | |
| python -m pip install --upgrade pip | |
| pip install -r requirements-dev.txt | |
| - name: Export environment variables | |
| run: | | |
| echo "SECRET_KEY=b6451545d2e4635148d768f07877aade3ad8e7e160d52962badd7587a4b9a150" > .env | |
| echo "SMTP_HOST=smtp.gmail.com" >> .env | |
| echo "SMTP_PORT=465" >> .env | |
| echo "[email protected]" >> .env | |
| echo "EMAIL_PASSWORD=random" >> .env | |
| - name: Install necessary packages | |
| run: | | |
| export DEBIAN_FRONTEND=noninteractive | |
| sudo apt-get update | |
| sudo apt install apt-transport-https ca-certificates curl software-properties-common -y | |
| curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
| sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | |
| sudo apt-get update | |
| sudo apt install docker-ce docker-ce-cli containerd.io -y | |
| - name: Build docker images | |
| run: docker compose -f test-docker-compose.yaml build --no-cache | |
| - name: Run pycodestyle | |
| run: | | |
| pycodestyle --max-line-length=100 api/*.py | |
| - name: Run API containers | |
| run: | | |
| docker compose -f test-docker-compose.yaml up -d test | |
| - name: Run pylint | |
| run: | | |
| docker compose -f test-docker-compose.yaml exec -T test pylint --extension-pkg-whitelist=pydantic api/ | |
| docker compose -f test-docker-compose.yaml exec -T test pylint tests/unit_tests | |
| docker compose -f test-docker-compose.yaml exec -T test pylint tests/e2e_tests | |
| - name: Stop docker containers | |
| if: always() | |
| run: | | |
| docker compose -f test-docker-compose.yaml down | |
| lint: | |
| runs-on: ubuntu-latest | |
| container: | |
| image: ubuntu:24.04 | |
| name: Lint | |
| steps: | |
| - name: Install base tooling | |
| run: | | |
| apt-get update | |
| apt-get install -y --no-install-recommends git python3 python3-pip | |
| - name: Check out source code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 32 # This is necessary to get the commits | |
| - name: Install linting dependencies | |
| run: | | |
| python3 -m pip install --no-cache-dir --upgrade pip | |
| python3 -m pip install --no-cache-dir black isort flake8 | |
| - name: Run black | |
| run: black --check --diff api tests | |
| - name: Run isort | |
| run: isort --check --diff api tests | |
| - name: Run flake8 | |
| run: flake8 --max-line-length=110 --max-complexity=10 api tests |