Add io_lulc_v2 product to prod #784
Workflow file for this run
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: 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@v4 | |
- name: Set up Python environment | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.10.12 | |
- name: flake8 Lint | |
uses: py-actions/flake8@v2 | |
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@v4 | |
- name: Set up Python environment | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.10.12 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install poeditor | |
mkdir output | |
- 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: 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@v4 | |
- 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: "747296" | |
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} |