Skip to content

Replace sha1 with blake2s hashing #555

Replace sha1 with blake2s hashing

Replace sha1 with blake2s hashing #555

Workflow file for this run

name: Backend Check
on:
push:
branches:
- '*'
- 'main'
paths:
- 'backend/**.py'
- 'backend/requirements*.*'
- 'backend/pyproject.toml'
- 'Dockerfile*'
- 'docker-compose*.yml'
- '.github/workflows/backend_check.yml'
pull_request:
branches:
- 'main'
paths:
- 'backend/**.py'
- 'backend/requirements*.*'
- 'backend/pyproject.toml'
- 'Dockerfile*'
- 'docker-compose*.yml'
- '.github/workflows/backend_check.yml'
jobs:
formatting_with_black:
name: Run Black formatting check
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
cache: 'pip'
- name: Install Black with latest pip
run: |
cat ./backend/requirements-dev.txt | grep black== | cut -d' ' -f1 | xargs pip install
- name: Check formatting with Black
run: |
black --check ./backend
linting_with_ruff:
name: Run Ruff linting check
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
cache: 'pip'
- name: Install Black & Ruff with latest pip
run: |
cat ./backend/requirements-dev.txt | grep ruff== | cut -d' ' -f1 | xargs pip install
- name: Lint files using Ruff
run: |
ruff check ./backend
checking_migrations:
name: Check for migrations
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
cache: 'pip'
- name: Install dependencies
run: |
pip install -r ./backend/requirements-dev.txt
- name: Check for migrations
run: |
set -a
. ./.env.example
python ./backend/manage.py makemigrations --check --dry-run
set +a
tests:
name: Run backend tests
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16.1
env:
POSTGRES_DB: redirect
POSTGRES_USER: user
POSTGRES_PASSWORD: password
ports:
- 5432:5432
steps:
- name: Check out Git repository
uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
cache: 'pip'
- name: Install dependencies
env:
ENV_FILE_NAME: .env.test
run: |
cp ./.env.example ./.env.test
python -m pip install --upgrade pip
pip install -r ./backend/requirements-dev.txt
sudo apt-get install gettext
./backend/manage.py compilemessages
- name: Run tests
env:
ENV_FILE_NAME: .env.test
DATABASE_NAME: redirect
DATABASE_USER: user
DATABASE_PASSWORD: password
DATABASE_HOST: postgres
DATABASE_PORT: 5432
run: |
cd ./backend
python3 manage.py wait_for_db
pytest -Wd --cov --cov-report=xml --cov-report=term-missing --cov-fail-under=60 -n auto
codeql_analysis:
name: Analyze code using CodeQL
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
language: [ 'python' ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3