Skip to content

Ingest the value of the special key 'private' into the corresponding column #666

Ingest the value of the special key 'private' into the corresponding column

Ingest the value of the special key 'private' into the corresponding column #666

name: CI
on:
push:
branches:
- main
pull_request:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
DOCKER_BUILDKIT: 1
PIP_BREAK_SYSTEM_PACKAGES: 1
jobs:
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
pgdocker: ${{ steps.check.outputs.pgtag }}
buildpgdocker: ${{ steps.check.outputs.buildpg }}
pyrustdocker: ${{ steps.check.outputs.pytag }}
buildpyrustdocker: ${{ steps.check.outputs.buildpy }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
pgstac:
- 'docker/pgstac/**'
pypgstac:
- 'docker/pypgstac/**'
- id: check
run: |
buildpg=false;
ref=$(echo ${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} | tr / _);
[[ "${{ steps.filter.outputs.pgstac }}" == "true" ]] && buildpg=true || ref=main;
echo "pgtag=${{ env.REGISTRY }}/stac-utils/pgstac-postgres:$ref" >>$GITHUB_OUTPUT;
echo "buildpg=$buildpg" >>$GITHUB_OUTPUT;
buildy=false;
[[ "${{ steps.filter.outputs.pypgstac }}" == "true" ]] && buildpy=true || ref=main;
echo "pytag=${{ env.REGISTRY }}/stac-utils/pgstac-pyrust:$ref" >>$GITHUB_OUTPUT;
echo "buildpy=$buildpg" >>$GITHUB_OUTPUT;
# This builds a base postgres image that has everything installed to be able to run pgstac. This image does not have pgstac itself installed.
buildpg:
name: Build and push base postgres image
if: ${{ needs.changes.outputs.buildpgdocker == 'true' }}
runs-on: ubuntu-latest
needs: [changes]
steps:
- uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Base Postgres
uses: docker/build-push-action@v4
with:
platforms: linux/amd64,linux/arm64
context: .
target: pgstacbase
file: docker/pgstac/Dockerfile
tags: ${{ needs.changes.outputs.pgdocker }}
push: true
cache-from: type=gha
cache-to: type=gha, mode=max
buildpyrust:
name: Build and push base pyrust
if: ${{ needs.changes.outputs.buildpyrustdocker == 'true' }}
runs-on: ubuntu-latest
needs: [changes]
steps:
- uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Base pyrust
uses: docker/build-push-action@v4
with:
platforms: linux/amd64,linux/arm64
context: .
target: pyrustbase
file: docker/pypgstac/Dockerfile
tags: ${{ needs.changes.outputs.pyrustdocker }}
push: true
cache-from: type=gha
cache-to: type=gha, mode=max
test:
name: test
needs: [changes, buildpg, buildpyrust]
runs-on: ubuntu-latest
container:
image: ${{ needs.changes.outputs.pyrustdocker }}
env:
PGPASSWORD: postgres
PGHOST: postgres
PGDATABASE: postgres
PGUSER: postgres
services:
postgres:
env:
POSTGRES_PASSWORD: postgres
image: ${{ needs.changes.outputs.pgdocker }}
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- name: Install pypgstac
working-directory: /__w/pgstac/pgstac/src/pypgstac
run: |
pip install .[dev,test,psycopg];
- name: Run tests
working-directory: /__w/pgstac/pgstac/docker/pypgstac/bin
run: |
./test