Skip to content

Rusthydrate

Rusthydrate #392

name: CI
on:
push:
branches:
- main
pull_request:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
DOCKER_BUILDKIT: 1
jobs:
changes:
runs-on: ubuntu-latest
# Required permissions
permissions:
pull-requests: read
# Set job outputs to values from filter step
outputs:
postgres: ${{ steps.filter.outputs.postgres }}
frontend: ${{ steps.filter.outputs.frontend }}
steps:
# For pull requests it's not necessary to checkout the code
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
postgres:
- 'docker/pgstac/Dockerfile'
pgstac:
- 'docker/pgstac/**'
- 'src/pgstac/sql/*.sql'
# buildpg:
# name: Build and push base postgres
# needs: changes
# runs-on: ubuntu-latest
# if: ${{ needs.changes.outputs.postgres == 'true' }}
# steps:
# - uses: actions/checkout@v3
buildpypgstac:
name: Build pypgstac wheel with Maturin
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- uses: PyO3/maturin-action@v1
with:
working-directory: src/pypgstac
args: --release --out /tmp/dist
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: /tmp/dist
if-no-files-found: error
test:
name: test
needs: buildpypgstac
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- uses: actions/download-artifact@v3
with:
name: wheels
path: /tmp/wheels
- name: Install pypgstac from wheel
run: |
pip install --no-index -f /tmp/wheels/ pypgstac[dev,test,psycopg]
- name: Run tests
working-directory: src/pypgstac
run: |
cd src/pypgstac
pytest -vvv
# - uses: docker/setup-buildx-action@v2
# - name: docker-compose-build
# run: docker buildx bake --file docker-compose.yml --file docker-compose-cache.json
# - name: test
# id: test
# run: scripts/test
# uses: docker/build-push-action@v4
# with:
# context: .
# file: docker/pgstac/Dockerfile
# load: true
# push: false
# cache-from: type=gha
# cache-to: type=gha, mode=max
# - name: pypgstacbuilder
# id: pypgstacbuilder
# uses: docker/build-push-action@v2
# with:
# context: .
# file: docker/pypgstac/Dockerfile
# load: true
# push: false
# cache-from: type=gha
# cache-to: type=gha, mode=max
# - name: Start Database
# run: docker run -d --rm -e POSTGRES_PASSWORD=pg --expose 5432 ${{ steps.pgstacbuilder.outputs.imageid }}
# - name: Database Ready
# run: docker exec ${{ steps.pgstacbuilder.outputs.imageid }} pg_isready
# - name: Run tests
# run: docker run --rm -e PGUSER=postgres -e PGDATABASE=postgres -e PGPASSWORD ${{ steps.pypgstacbuilder.outputs.imageid }} /opt/docker/pypgstac/bin/test