Skip to content

Updates

Updates #47

Workflow file for this run

on:
push:
branches:
- master
pull_request:
name: CI
jobs:
test:
runs-on: ubuntu-latest
name: Test
env:
DJANGO_DEBUG: 'True'
PORT: '8000'
SITE_DOMAIN: 'http://localhost:8000'
DATABASE_URL: 'postgres://pg:passw0rd@localhost/interna'
services:
postgres:
image: postgres:13.2-alpine
env:
POSTGRES_USER: pg
POSTGRES_PASSWORD: passw0rd
POSTGRES_DB: interna
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run migrations
run: cd interna && ./manage.py migrate
- name: Collect static files
run: cd interna && ./manage.py collectstatic --noinput
- name: Run pytest
run: cd interna && pytest
docker_image:
name: Build Docker image
runs-on: ubuntu-latest
needs: [test]
steps:
- uses: actions/checkout@v2
- name: Build Docker image
run: |
docker build \
--no-cache \
-t coredump/interna:master \
-t coredump/interna:latest \
.
- name: Push Docker image (only on master)
if: github.ref == 'refs/heads/master'
run: |
docker login -u "${{ secrets.DOCKER_USERNAME }}" -p "${{ secrets.DOCKER_PASSWORD }}" && \
docker push -a coredump/interna