Skip to content

Skeleton of new front-end #119

Skeleton of new front-end

Skeleton of new front-end #119

Workflow file for this run

name: backend
defaults:
run:
working-directory: backend
on:
push:
branches: [main]
paths:
- "backend/**"
pull_request:
branches: [main]
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
test:
runs-on: ubuntu-latest
services:
database:
image: postgis/postgis
env:
POSTGRES_DB: keadatabase
POSTGRES_USER: postgres
POSTGRES_PASSWORD: keadatabase
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
strategy:
fail-fast: false
matrix:
python-version: [3.9]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install packages
run: |
sudo apt-get update && sudo apt-get install binutils libproj-dev gdal-bin libmagic-dev python3-dev
- name: Install dependencies
run: |
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Check code formatting
run: |
yapf src/**/*.py --diff
- name: Run tests
run: |
python3 src/manage.py test src
env:
DATABASE_URL: postgres://postgres:keadatabase@localhost:5432/keadatabase
build:
needs: test
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- uses: actions/checkout@v3
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-backend
tags: |
type=sha,prefix=
- name: Build and push
uses: docker/build-push-action@v4
with:
context: ./backend
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max