Skip to content

Adds test and deploy workflows #5

Adds test and deploy workflows

Adds test and deploy workflows #5

Workflow file for this run

name: Tests
on:
pull_request:
branches:
- development
workflow_dispatch:
jobs:
build:
if: github.ref != 'refs/heads/base' || github.ref != 'refs/heads/development'
runs-on: ubuntu-latest
environment:
name: development
env:
APPLICATION_NAME: gemini
CONTAINER: gemini-web
APPLICATION_PORT: 8006
services:
docker:
image: docker:stable
options: --privileged
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
$HOME/.cache/pip
$HOME/.cache/pre-commit
key: ${{ runner.os }}-pip-${{ hashFiles('**/*.lock') }}
- name: Copy config file
run: cp ${{ env.APPLICATION_NAME }}/config.py.example ${{ env.APPLICATION_NAME }}/config.py
- name: Login to Docker
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
- name: Start Docker containers
run: docker-compose up -d
- name: Wait for services to be ready
run: ./wait-for-it.sh $CONTAINER:$APPLICATION_PORT -- docker-compose exec -T $CONTAINER pip install coverage
- name: Install pre-commit
run: |
pip install "pre-commit===2.13.0"
pre-commit install
- name: Run pre-commit checks
run: pre-commit run --all-files --show-diff-on-failure
- name: Run tests with coverage
run: docker-compose exec -T $CONTAINER coverage run manage.py test
- name: Generate coverage report
run: docker-compose exec -T $CONTAINER coverage report --omit=*/migrations/* -m