Skip to content

Bump actions/cache from 4.0.2 to 4.1.2 #1899

Bump actions/cache from 4.0.2 to 4.1.2

Bump actions/cache from 4.0.2 to 4.1.2 #1899

name: Validate Python code
on:
push:
paths:
- ".github/**"
- "conf_site/**"
- "requirements/**"
- "symposion/**"
env:
ANSIBLE_ASK_VAULT_PASS: False
CC_TEST_REPORTER_ID: cf5093a40c8088ad26a5aca3e968037f90076dcbc825e5d10187dc3c81166e1a
DJANGO_SETTINGS_MODULE: "conf_site.settings.testing"
ENVIRONMENT: testing
POSTGRES_PASSWORD: ${{ github.run_id }}-${{ github.run_attempt }}
PYTHONWARNINGS: all
jobs:
python-lint:
name: Lint Python code
runs-on: ubuntu-latest
container: python:3.9-bullseye
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: Virtualenv caching
uses: actions/[email protected]
with:
path: ~/venv/current
key: ${{ runner.os }}-python3.9-venv-v1-${{ hashFiles('**/requirements/development.txt') }}-${{ hashFiles('**/requirements/production.txt') }}
restore-keys: |
${{ runner.os }}-python3.9-venv-v1-${{ hashFiles('**/requirements/development.txt') }}-${{ hashFiles('**/requirements/production.txt') }}
${{ runner.os }}-python3.9-venv-v1-${{ hashFiles('**/requirements/development.txt') }}-
${{ runner.os }}-python3.9-venv-v1-
- name: Install Python dependencies
uses: mobolic/[email protected]
with:
virtualenv-location: "~/venv/current"
- name: Run flake8 linting
run: ~/venv/current/bin/flake8 --exclude=ansible,docs,migrations .
python-test:
name: Test Python code
needs: python-lint
runs-on: ubuntu-latest
container: python:3.9-bullseye
services:
postgres:
image: postgres:13-bullseye
env:
POSTGRES_PASSWORD: ${{ github.run_id }}-${{ github.run_attempt }}
POSTGRES_USER: postgres
POSTGRES_DB: testing_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:6.0-bullseye
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: Virtualenv caching
uses: actions/[email protected]
with:
path: ~/venv/current
key: ${{ runner.os }}-python3.9-venv-v1-${{ hashFiles('**/requirements/development.txt') }}-${{ hashFiles('**/requirements/production.txt') }}
restore-keys: |
${{ runner.os }}-python3.9-venv-v1-${{ hashFiles('**/requirements/development.txt') }}-${{ hashFiles('**/requirements/production.txt') }}
${{ runner.os }}-python3.9-venv-v1-${{ hashFiles('**/requirements/development.txt') }}-
${{ runner.os }}-python3.9-venv-v1-
- name: Install Python dependencies
uses: mobolic/[email protected]
with:
virtualenv-location: "~/venv/current"
- name: Check for missing database migrations
run: ~/venv/current/bin/python3 ./manage.py makemigrations --check
- name: Migrate the database
run: ~/venv/current/bin/python3 ./manage.py migrate --noinput
- name: Validate and load fixtures
run: ~/venv/current/bin/ansible-playbook -i ansible/hosts -l testing --connection=local --tags fixtures ansible/testing.yml
- name: Collect static files
run: |
~/venv/current/bin/python3 ./manage.py collectstatic --noinput
- name: Run automated tests
run: |
~/venv/current/bin/coverage run --source='.' manage.py test --noinput
~/venv/current/bin/coverage xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}