Skip to content

workflows: Update to unified rules #2490

workflows: Update to unified rules

workflows: Update to unified rules #2490

Workflow file for this run

# 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:
tests:
runs-on: ubuntu-22.04
name: tests
strategy:
matrix:
python-version: ['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 API containers
run: |
docker compose -f test-docker-compose.yaml up -d test
- 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-venv python3-pip
- name: Create Python virtual environment
run: |
python3 -m venv /opt/venv
/opt/venv/bin/pip install --no-cache-dir --upgrade 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: |
/opt/venv/bin/pip install --no-cache-dir ruff
- name: Run ruff format check (line-length policy)
run: /opt/venv/bin/ruff format --check --diff --line-length 110 api tests
- name: Run ruff lint check (E/W/F/I + complexity policy)
run: |
/opt/venv/bin/ruff check --line-length 110 --select E,W,F,I,C901 --ignore E203 api tests