Skip to content

Merge pull request #224 from praekeltfoundation/dependabot-security-a… #782

Merge pull request #224 from praekeltfoundation/dependabot-security-a…

Merge pull request #224 from praekeltfoundation/dependabot-security-a… #782

Workflow file for this run

name: QA Docker Image
on:
push:
branches:
- develop
pull_request:
branches:
- develop
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
postgres_version: ['14']
services:
postgres:
image: postgis/postgis:${{ matrix.postgres_version }}-3.4-alpine
env:
POSTGRES_DB: healthcheck
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
redis:
image: redis:alpine
ports:
- 6379:6379
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
sudo apt-get update && sudo apt-get install -y gdal-bin
python -m pip install --upgrade pip
pip install -e .
pip install -r requirements-dev.txt
- name: Run tests
run: |
DJANGO_SETTINGS_MODULE=healthcheck.settings.test python manage.py makemigrations --dry-run | grep 'No changes detected' || (echo 'There are changes which require migrations.' && exit 1)
flake8 ./healthcheck
black --check .
python manage.py test
build:
if: github.event_name == 'push'
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: docker/setup-buildx-action@v1
- name: construct image metadata
id: meta
uses: crazy-max/ghaction-docker-meta@v2
with:
images: |
ghcr.io/${{ github.repository }}
praekeltfoundation/healthcheck-django
tags: |
type=sha
- name: login to ghcr
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: login to docker hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}