Pin poetry #147
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Image Tests | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
python_version: "3.9.x" | |
IMAGE: praekeltfoundation/rapidpro | |
REGISTRY_USER: rapidproautomation | |
REPO: rapidpro/rapidpro | |
GREP_TIMEOUT: 360 | |
strategy: | |
matrix: | |
VERSION: [v7.4.0] | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ env.python_version }} | |
- name: Install PostgreSQL and PostGIS | |
uses: nyaruka/[email protected] | |
with: | |
postgresql version: 13 | |
postgis version: 3.1 | |
postgresql db: temba | |
postgresql user: temba | |
postgresql password: temba | |
postgresql arguments: "--jit=off" | |
- uses: docker/setup-buildx-action@v1 | |
- name: Build Rapidpro Image | |
uses: docker/build-push-action@v2 | |
with: | |
push: false | |
load: true | |
context: . | |
tags: ${{ env.IMAGE }} | |
build-args: | | |
RAPIDPRO_VERSION=${{matrix.VERSION}} | |
RAPIDPRO_REPO=${{env.REPO}} | |
- name: Test Rapidpro Image | |
run: | | |
docker run --name rapidpro --env-file docker.envfile --link postgis --publish 8000:8000 --detach "${{ env.IMAGE }}" | |
timeout ${{ env.GREP_TIMEOUT }} grep -m 1 'static files copied' <(docker logs --follow rapidpro 2>&1) | |
timeout ${{ env.GREP_TIMEOUT }} grep -m 1 'Running migrations' <(docker logs --follow rapidpro 2>&1) | |
timeout ${{ env.GREP_TIMEOUT }} grep -m 1 'spawned uWSGI http 1' <(docker logs --follow rapidpro 2>&1) | |
docker exec rapidpro /venv/bin/python /rapidpro/manage.py check | |
- name: Some debug outputs | |
if: always() | |
run: | | |
docker ps | |
docker images | |
- name: Rapidpro Container Logs | |
if: always() | |
run: | | |
docker logs rapidpro | |
- name: construct image metadata | |
uses: docker/metadata-action@v3 | |
id: meta | |
with: | |
images: | | |
praekeltfoundation/rapidpro | |
ghcr.io/praekeltfoundation/rapidpro-docker | |
tags: | | |
type=pep440,pattern=v{{major}},value=${{matrix.VERSION}} | |
type=pep440,pattern=v{{major}}.{{minor}},value=${{matrix.VERSION}} | |
type=pep440,pattern=v{{version}},value=${{matrix.VERSION}} | |
- 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: | |
push: ${{github.event_name != 'pull_request'}} | |
tags: ${{steps.meta.outputs.tags}} | |
context: . | |
build-args: | | |
RAPIDPRO_VERSION=${{matrix.VERSION}} | |
RAPIDPRO_REPO=${{env.REPO}} |