Skip to content

Commit fb00d97

Browse files
committed
update scripts/ci
1 parent f1d71d5 commit fb00d97

37 files changed

+2156
-402
lines changed

.github/workflows/civ2.yml

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- release*
8+
pull_request:
9+
10+
env:
11+
REGISTRY: ghcr.io
12+
REGISTRYPATH: ghcr.io/stac-utils/
13+
PGSTACIMAGE: ghcr.io/stac-utils/pgstac-postgres
14+
PGSTACLATEST: ghcr.io/stac-utils/pgstac-postgres:latest
15+
IMAGE_NAME: ${{ github.repository }}
16+
DOCKER_BUILDKIT: 1
17+
PIP_BREAK_SYSTEM_PACKAGES: 1
18+
PGPASSWORD: postgres
19+
PGHOST: postgres
20+
PGDATABASE: postgres
21+
PGUSER: postgres
22+
POSTGRES_PASSWORD: postgres
23+
24+
jobs:
25+
# This builds a base postgres image that has everything installed to be able to run pgstac.
26+
buildpg:
27+
name: Build and push base postgres image
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Docker Meta
31+
id: meta
32+
uses: docker/metadata-action@v5
33+
with:
34+
images: |
35+
pgstac/pgstac-postgres
36+
${{ env.PGSTACIMAGE }}
37+
tags: |
38+
type=ref,event=branch
39+
type=ref,event=pr
40+
type=semver,pattern={{version}}
41+
type=semver,pattern={{major}}.{{minor}}
42+
type=semver,pattern={{major}}
43+
type=sha
44+
- uses: docker/setup-buildx-action@v3
45+
- name: Log in to the Container registry
46+
uses: docker/login-action@v3
47+
with:
48+
registry: ${{ env.REGISTRY }}
49+
username: ${{ github.actor }}
50+
password: ${{ secrets.GITHUB_TOKEN }}
51+
- name: Build and Push Base Postgres
52+
uses: docker/build-push-action@v5
53+
with:
54+
platforms: linux/amd64,linux/arm64
55+
context: .
56+
target: pgstac
57+
file: docker/pgstac/Dockerfile
58+
tags: ${{ steps.meta.outputs.tags }}
59+
push: true
60+
cache-from: type=gha
61+
cache-to: type=gha, mode=max
62+
63+
linux:
64+
runs-on: ubuntu-latest
65+
strategy:
66+
matrix:
67+
target: [x86_64, x86, aarch64, armv7, s390x, ppc64le]
68+
steps:
69+
- uses: actions/checkout@v3
70+
- uses: actions/setup-python@v4
71+
with:
72+
python-version: '3.10'
73+
- name: Build wheels
74+
uses: PyO3/maturin-action@v1
75+
with:
76+
working-directory: src/pypgstac
77+
target: ${{ matrix.target }}
78+
args: --release --out /tmp/dist
79+
sccache: 'true'
80+
manylinux: auto
81+
- name: Upload wheels
82+
uses: actions/upload-artifact@v3
83+
with:
84+
name: wheels
85+
path: /tmp/dist/*
86+
87+
windows:
88+
runs-on: windows-latest
89+
strategy:
90+
matrix:
91+
target: [x64, x86]
92+
steps:
93+
- uses: actions/checkout@v3
94+
- uses: actions/setup-python@v4
95+
with:
96+
python-version: '3.10'
97+
architecture: ${{ matrix.target }}
98+
- name: Build wheels
99+
uses: PyO3/maturin-action@v1
100+
with:
101+
working-directory: src/pypgstac
102+
target: ${{ matrix.target }}
103+
args: --release --out /tmp/dist
104+
sccache: 'true'
105+
- name: Upload wheels
106+
uses: actions/upload-artifact@v3
107+
with:
108+
name: wheels
109+
path: /tmp/dist/*
110+
111+
macos:
112+
runs-on: macos-latest
113+
strategy:
114+
matrix:
115+
target: [x86_64, aarch64]
116+
steps:
117+
- uses: actions/checkout@v3
118+
- uses: actions/setup-python@v4
119+
with:
120+
python-version: '3.10'
121+
- name: Build wheels
122+
uses: PyO3/maturin-action@v1
123+
with:
124+
working-directory: src/pypgstac
125+
target: ${{ matrix.target }}
126+
args: --release --out /tmp/dist
127+
sccache: 'true'
128+
- name: Upload wheels
129+
uses: actions/upload-artifact@v3
130+
with:
131+
name: wheels
132+
path: /tmp/dist/*
133+
134+
sdist:
135+
runs-on: ubuntu-latest
136+
steps:
137+
- uses: actions/checkout@v3
138+
- name: Build sdist
139+
uses: PyO3/maturin-action@v1
140+
with:
141+
working-directory: src/pypgstac
142+
command: sdist
143+
args: --out /tmp/dist
144+
- name: Upload sdist
145+
uses: actions/upload-artifact@v3
146+
with:
147+
name: wheels
148+
path: /tmp/dist/*
149+
150+
test:
151+
name: test
152+
needs: [buildpg, linux]
153+
runs-on: ubuntu-latest
154+
services:
155+
postgres:
156+
image: ghcr.io/stac-utils/pgstac-postgres:latest
157+
options: >-
158+
--health-cmd pg_isready
159+
--health-interval 10s
160+
--health-timeout 5s
161+
--health-retries 5
162+
163+
steps:
164+
- uses: actions/checkout@v3
165+
- name: Get Wheel
166+
uses: actions/download-artifact@v4
167+
with:
168+
name: wheels
169+
path: /tmp/wheels
170+
- name: Install pypgstac
171+
working-directory: /__w/pgstac/pgstac/src/pypgstac
172+
run: |
173+
for i in /tmp/wheels/pypgstac*x86_64.whl; do uv pip install pypgstac@$i; done
174+
175+
- name: Run tests
176+
working-directory: /__w/pgstac/pgstac/docker/pypgstac/bin
177+
run: |
178+
./test

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ src/pypgstac/target
1111
src/pypgstac/python/pypgstac/*.so
1212
.vscode
1313
.ipynb_checkpoints
14+
src/pypgstac/.mypy_cache
15+
src/pypgstac/.pytest_cache
16+
src/pypgstac/.mypy_cache

.pre-commit-config.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v4.4.0
5+
rev: v5.0.0
66
hooks:
77
- id: trailing-whitespace
88
- id: check-yaml
@@ -13,17 +13,20 @@ repos:
1313
- id: detect-private-key
1414
- id: check-json
1515
- id: mixed-line-ending
16+
args: [--fix=auto]
1617
- id: check-merge-conflict
1718
- id: check-executables-have-shebangs
1819
- id: check-symlinks
1920

2021

2122
- repo: https://github.com/charliermarsh/ruff-pre-commit
22-
rev: 'v0.0.284'
23+
rev: 'v0.7.1'
2324
hooks:
2425
- id: ruff
2526
files: pypgstac\/.*\.py$
2627
args: [--fix, --exit-non-zero-on-fix]
28+
- id: ruff-format
29+
files: pypgstac\/.*\.py$
2730

2831
- repo: local
2932
hooks:

CHANGELOG.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8-
## [Unreleased]
8+
## [v0.9.2]
99

1010
### Added
1111

@@ -16,7 +16,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1616
- the text search is un-indexed and will be very slow for item-level searches!
1717

1818
### Fixed
19-
19+
- Fix paging links and add tests for collections_search
20+
- Fix issues with scripts and docker
2021
- Add `open=True` in `psycopg.ConnectionPool` to avoid future behavior change
2122
- Switch from postgres `server_version` to `server_version_num` to get PG version (Fixes #300)
2223
- Allow read-only replicas work even when the context extension is enabled (Fixes #300)
@@ -531,7 +532,7 @@ _TODO_
531532

532533
- Fixed issue with pypgstac loads which caused some writes to fail ([#18](https://github.com/stac-utils/pgstac/pull/18))
533534

534-
[Unreleased]: https://github.com/stac-utils/pgstac/compare/v0.9.1...main
535+
[v0.9.2]: https://github.com/stac-utils/pgstac/compare/v0.9.1...v0.9.2
535536
[v0.9.1]: https://github.com/stac-utils/pgstac/compare/v0.9.0...v0.9.1
536537
[v0.9.0]: https://github.com/stac-utils/pgstac/compare/v0.8.5...v0.9.0
537538
[v0.8.5]: https://github.com/stac-utils/pgstac/compare/v0.8.4...v0.8.5

docker-compose.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,20 @@ services:
1717
- PGDATABASE=postgis
1818
ports:
1919
- "5439:5432"
20+
develop:
21+
watch:
22+
- action: rebuild
23+
path: ./src/pgstac
24+
healthcheck:
25+
test: ["CMD-SHELL", "pg_isready"]
26+
interval: 1s
27+
retries: 15
28+
start_period: 30s
29+
timeout: 10s
2030
volumes:
2131
- pgstac-pgdata:/var/lib/postgresql/data
2232
command: postgres
33+
2334
pypgstac:
2435
container_name: pypgstac
2536
image: pypgstac
@@ -35,6 +46,13 @@ services:
3546
- PGPASSWORD=password
3647
- PGDATABASE=postgis
3748
depends_on:
38-
- pgstac
49+
pgstac:
50+
condition: service_healthy
51+
restart: true
52+
develop:
53+
watch:
54+
- action: rebuild
55+
path: ./src/pypgstac
56+
3957
volumes:
4058
pgstac-pgdata:

0 commit comments

Comments
 (0)