Skip to content

DEV-2172 | proof of concept of CSRF expiry #9252

DEV-2172 | proof of concept of CSRF expiry

DEV-2172 | proof of concept of CSRF expiry #9252

Workflow file for this run

name: Build and Test Python
on:
pull_request:
push:
branches: [main, develop]
jobs:
# Only run if Django code has changed
check-changes:
runs-on: ubuntu-latest
# Required permissions
permissions:
pull-requests: read
# Set job outputs to values from filter step
outputs:
django: ${{ steps.filter.outputs.django }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
django:
- 'apps/**'
- 'public/**'
- 'revengine/**'
- 'conftest.py'
- 'manage.py'
- 'poetry.lock'
- 'pyproject.toml'
- 'pytest.ini'
build_test_python:
needs: check-changes
if: ${{ needs['check-changes'].outputs.django == 'true' }}
runs-on: ubuntu-latest
services:
postgres:
# From:
# https://docs.github.com/en/actions/guides/creating-postgresql-service-containers
image: postgres
env:
POSTGRES_PASSWORD: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10.15"
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
#----------------------------------------------
# install your root project, if required
#----------------------------------------------
- name: Install library
run: poetry install --no-interaction
- name: Run tests
run: |
source .venv/bin/activate
touch .env
make run-tests
env:
DJANGO_SETTINGS_MODULE: revengine.settings.dev
DATABASE_URL: postgres://postgres:[email protected]:5432/postgres
GS_CREDENTIALS_RAISE_ERROR_IF_UNSET: "false"