Don't mount local folder #590
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: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
DOCKER_BUILDKIT: 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=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}; | |
[[ "${{ 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; | |
ref=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}; | |
[[ "${{ 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 | |
linux: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
target: [x86_64, x86, aarch64, armv7, s390x, ppc64le] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
working-directory: src/pypgstac | |
target: ${{ matrix.target }} | |
args: --release --out /home/runner/work/pgstac/pgstac/dist | |
sccache: 'true' | |
manylinux: auto | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: /home/runner/work/pgstac/pgstac/dist/* | |
windows: | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
target: [x64, x86] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
architecture: ${{ matrix.target }} | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
working-directory: src/pypgstac | |
target: ${{ matrix.target }} | |
args: --release --out /home/runner/work/pgstac/pgstac/dist | |
sccache: 'true' | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: /home/runner/work/pgstac/pgstac/dist/* | |
macos: | |
runs-on: macos-latest | |
strategy: | |
matrix: | |
target: [x86_64, aarch64] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
working-directory: src/pypgstac | |
target: ${{ matrix.target }} | |
args: --release --out /tmp/dist | |
sccache: 'true' | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: /tmp/dist/* | |
sdist: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build sdist | |
uses: PyO3/maturin-action@v1 | |
with: | |
working-directory: src/pypgstac | |
command: sdist | |
args: --out /home/runner/work/pgstac/pgstac/dist | |
- name: Upload sdist | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: /home/runner/work/pgstac/pgstac/dist/* | |
# release: | |
# name: Release | |
# runs-on: ubuntu-latest | |
# if: "startsWith(github.ref, 'refs/tags/')" | |
# needs: [linux, windows, macos, sdist] | |
# steps: | |
# - uses: actions/download-artifact@v3 | |
# with: | |
# name: wheels | |
# - name: Publish to PyPI | |
# uses: PyO3/maturin-action@v1 | |
# env: | |
# MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | |
# with: | |
# command: upload | |
# args: --skip-existing * |