Skip to content

Merge pull request #372 from WISVCH/dependabot/pip/djangorestframewor… #271

Merge pull request #372 from WISVCH/dependabot/pip/djangorestframewor…

Merge pull request #372 from WISVCH/dependabot/pip/djangorestframewor… #271

Workflow file for this run

name: Test and Deploy
on:
workflow_dispatch:
push:
jobs:
deploy:
runs-on: ubuntu-latest
env:
DEBUG: True
SECRET_KEY: changeme
DATABASE_URL: postgres://[email protected]/dienst2?atomic_requests=True
CACHE_URL: dummycache://
SEARCH_URL: simple://
GOOGLE_IAP_AUDIENCE: /projects/966138216790/apps/wisvch
services:
postgres:
image: postgres:15.2
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: dienst2
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install prerequisites
run: |
sudo apt-get install libpq-dev
sudo apt-get install libssl-dev
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install poetry
poetry config virtualenvs.create false
poetry install
- name: Run migrations
run: python manage.py migrate
- name: Run tests
run: python manage.py test
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/wisvch/dienst2
tags: type=sha, prefix={{date 'YYYYMMDD'}}-
- name: Setup Docker BuildX
uses: docker/setup-buildx-action@v2
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: ${{ github.ref == 'refs/heads/master' }}