Rusthydrate #402
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: 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 | |
container: ghcr.io/pyo3/maturin | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build | |
run: build --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 | |
container: python:3-slim-bullseye | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_PASSWORD: postgres | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: wheels | |
path: /tmp/wheels | |
- name: Install pypgstac from wheel | |
run: | | |
find /tmp/wheels/*.whl -exec pip install '{}[dev,test,psycopg]' \; | |
- name: Run tests | |
working-directory: src/pypgstac | |
env: | |
PGPASSWORD: lksjfalkjewkjrw | |
PGHOST: postgres | |
PGDATABASE: postgres | |
PGUSER: postgres | |
run: | | |
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 |