-
Notifications
You must be signed in to change notification settings - Fork 22
184 lines (158 loc) · 5.92 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
name: CI
# On every pull request, but only on push to main
on:
push:
branches:
- main
tags:
- '*'
paths:
# Only rebuild website when docs have changed
- 'runtime/**'
- 'dockerfiles/**'
- 'docker-compose.*'
- '.github/workflows/ci.yml'
- '.isort.cfg'
- '.mypy.ini'
- 'ruff.toml'
- '.pre-commit-config.yaml'
pull_request:
jobs:
tests:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Run pre-commit
run: |
python -m pip install --upgrade pip
python -m pip install pre-commit
pre-commit run --all-files
- name: Launch services
run: docker-compose up -d stac raster vector
- name: install lib postgres
run: |
sudo apt update
wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O- | sudo apt-key add -
echo "deb [arch=amd64] http://apt.postgresql.org/pub/repos/apt/ focal-pgdg main" | sudo tee /etc/apt/sources.list.d/postgresql.list
sudo apt update
sudo apt-get install --yes libpq-dev postgis postgresql-14-postgis-3
- name: Install python dependencies
run: |
python -m pip install pytest pytest-asyncio httpx pypgstac==0.7.1 psycopg[pool] brotlipy boto3 pytest-pgsql psycopg2
- name: Test CDK DB Bootstrap
working-directory: ./infrastructure/aws
run: |
python -m pytest tests/test_bootstrap.py -v -ss
- name: Ingest Stac Items/Collection
run: |
pypgstac pgready --dsn postgresql://username:[email protected]:5439/postgis
pypgstac load collections .github/workflows/data/noaa-emergency-response.json --dsn postgresql://username:[email protected]:5439/postgis --method insert_ignore
pypgstac load items .github/workflows/data/noaa-eri-nashville2020.json --dsn postgresql://username:[email protected]:5439/postgis --method insert_ignore
psql postgresql://username:[email protected]:5439/postgis -f .github/workflows/data/my_data.sql
# see https://github.com/developmentseed/tipg/issues/37
- name: Restart the Vector service
run: |
docker-compose stop vector
docker-compose up -d vector
- name: Sleep for 10 seconds
run: sleep 10s
shell: bash
- name: Integrations tests
run: python -m pytest .github/workflows/tests/
- name: Stop services
run: docker-compose stop
publish-docker:
needs: [tests]
if: github.ref == 'refs/heads/main' || startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to Github
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set tag version
id: tag
run: |
echo "version=${GITHUB_REF#refs/*/}"
echo "version=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
#############################################################################
# RASTER
- name: RASTER - Build and push latest
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v2
with:
platforms: linux/amd64
context: .
file: dockerfiles/Dockerfile.raster-uvicorn
push: true
tags: |
ghcr.io/developmentseed/eoapi-raster:latest
- name: RASTER - Build and push tags
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
uses: docker/build-push-action@v2
with:
platforms: linux/amd64
context: .
file: dockerfiles/Dockerfile.raster-uvicorn
push: true
tags: |
ghcr.io/developmentseed/eoapi-raster:${{ steps.tag.outputs.tag }}
#############################################################################
# STAC
- name: STAC - Build and push latest
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v2
with:
context: .
file: dockerfiles/Dockerfile.stac-uvicorn
push: true
tags: |
ghcr.io/developmentseed/eoapi-stac:latest
- name: STAC - Build and push tags
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
uses: docker/build-push-action@v2
with:
context: .
file: dockerfiles/Dockerfile.stac-uvicorn
push: true
tags: |
ghcr.io/developmentseed/eoapi-stac:${{ steps.tag.outputs.tag }}
#############################################################################
# VECTOR
- name: VECTOR - Build and push latest
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v2
with:
context: .
file: dockerfiles/Dockerfile.vector-uvicorn
push: true
tags: |
ghcr.io/developmentseed/eoapi-vector:latest
- name: VECTOR - Build and push tags
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
uses: docker/build-push-action@v2
with:
context: .
file: dockerfiles/Dockerfile.vector-uvicorn
push: true
tags: |
ghcr.io/developmentseed/eoapi-vector:${{ steps.tag.outputs.tag }}