Skip to content

Add geoserver config for OECD/SWAC Africapolis 2015 and 2020 datasets #774

Add geoserver config for OECD/SWAC Africapolis 2015 and 2020 datasets

Add geoserver config for OECD/SWAC Africapolis 2015 and 2020 datasets #774

name: OWS CFG Lint, Test and Build
on:
push:
branches: [ master ]
paths:
- 'services/**'
- .github/workflows/ows-config-test-build.yaml
pull_request:
paths:
- 'services/**'
- .github/workflows/ows-config-test-build.yaml
release:
types: [created, edited, published]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python environment
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: flake8 Lint
uses: py-actions/flake8@v1
with:
ignore: E501
path: services/ows_refactored
test:
runs-on: ubuntu-latest
needs: lint
steps:
- name: Checkout code
uses: actions/checkout@v1
with:
fetch-depth: 0
- name: Prepare the DB
run: |
echo "Starting up the DB"
docker compose -f docker-compose.ows.yaml up --detach postgres
echo "Initialising the DB"
docker compose -f docker-compose.ows.yaml run -T ows datacube system init
echo "Initialising OWS"
docker compose -f docker-compose.ows.yaml run -T ows datacube-ows-update --schema --role postgres
echo "Starting OWS"
docker compose -f docker-compose.ows.yaml up --detach ows
- name: Log error from previous steps
if: failure()
run: |
docker compose -f docker-compose.ows.yaml logs ows
- name: Test DEV config
run: |
docker compose -f docker-compose.ows.yaml run \
-e DATACUBE_OWS_CFG=ows_refactored.dev_af_ows_root_cfg.ows_cfg \
-T ows \
datacube-ows-cfg check -i /env/config/inventory/dev_af/inventory.json
- name: Test PROD config
run: |
docker compose -f docker-compose.ows.yaml run \
-e DATACUBE_OWS_CFG=ows_refactored.prod_af_ows_root_cfg.ows_cfg \
-T ows \
datacube-ows-cfg check -i /env/config/inventory/prod_af/inventory.json
- name: Remove the DB
run: |
docker compose -f docker-compose.ows.yaml down
upload-translation:
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python environment
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poeditor
mkdir output
- name: Prepare the DB
run: |
docker compose -f docker-compose.ows.yaml up -d
sleep 5
docker compose -f docker-compose.ows.yaml exec -T ows datacube system init
docker compose -f docker-compose.ows.yaml exec -T ows datacube-ows-update --schema --role postgres
- name: Generate English Terms translation file
run: |
docker compose -f docker-compose.ows.yaml exec \
-e DATACUBE_OWS_CFG=ows_refactored.prod_af_ows_root_cfg.ows_cfg \
-T ows \
datacube-ows-cfg extract -m /env/config/output/messages.po
- name: Copy messages.po from Docker container to host
run: |
docker cp $(docker compose -f docker-compose.ows.yaml ps -q ows):/env/config/output/messages.po ./output/messages.po
- name: Set file permissions for messages.po
run: |
sudo chmod 644 ./output/messages.po
- name: Upload terms to POEditor.com
if: github.ref == 'refs/heads/master' || github.event_name == 'release' || github.event_name == 'pull_request'
env:
POEDITOR_API_TOKEN: ${{ secrets.POEDITOR_API_TOKEN }}
POEDITOR_PROJECT_ID: "747296"
run: |
python .github/workflows/scripts/upload-po.py
- name: Remove the DB
run: |
docker compose -f docker-compose.ows.yaml down
build-and-push:
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poeditor
- name: Download translation from POEditor.com
env:
POEDITOR_API_TOKEN: ${{ secrets.POEDITOR_API_TOKEN }}
POEDITOR_PROJECT_ID: "471013"
run: |
python .github/workflows/scripts/download-mo.py
- name: Push to DockerHub (master branch or tagged release only)
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
env:
DOCKER_USER: deafricadockersvs
run: |
echo "Login to DockerHub as ${DOCKER_USER}"
echo "${{ secrets.DEAFRICA_DOCKER_PASSWORD }}" | docker login -u "${DOCKER_USER}" --password-stdin
# figure out extra tag
git fetch --prune --unshallow 2> /dev/null || true
tag=$(git describe --tags)
DOCKER_IMAGE=digitalearthafrica/deafrica-config
# build local docker image
docker build -t ${DOCKER_IMAGE}:latest .
# tag and push images
docker tag ${DOCKER_IMAGE}:latest ${DOCKER_IMAGE}:${tag}
docker push ${DOCKER_IMAGE}:latest
docker push ${DOCKER_IMAGE}:${tag}