Skip to content

Commit ea5c2f0

Browse files
authored
Migrate to services approach for CI (#2322)
1 parent 5e7e62d commit ea5c2f0

1 file changed

Lines changed: 45 additions & 44 deletions

File tree

.github/workflows/main.yml

Lines changed: 45 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,42 @@ jobs:
3434
env:
3535
POSTGRES_DB: test
3636
POSTGRES_PASSWORD: ${{ secrets.DatabasePassword || 'postgres' }}
37-
37+
mysql:
38+
image: mysql:8.0
39+
env:
40+
MYSQL_ROOT_PASSWORD: mysql
41+
MYSQL_DATABASE: test_geo_app
42+
MYSQL_USER: pygeoapi
43+
MYSQL_PASSWORD: mysql
44+
ports:
45+
- 3306:3306
46+
elasticsearch:
47+
image: docker.elastic.co/elasticsearch/elasticsearch:8.17.0
48+
ports:
49+
- 9200:9200
50+
- 9300:9300
51+
env:
52+
discovery.type: single-node
53+
xpack.security.enabled: "false"
54+
ES_JAVA_OPTS: "-Xms512m -Xmx512m"
55+
opensearch:
56+
image: opensearchproject/opensearch:2.18.0
57+
ports:
58+
- 9209:9200
59+
env:
60+
discovery.type: single-node
61+
DISABLE_SECURITY_PLUGIN: "true"
62+
OPENSEARCH_JAVA_OPTS: "-Xms512m -Xmx512m"
63+
mongodb:
64+
image: mongo:8.0.4
65+
ports:
66+
- 27017:27017
67+
sensorthings:
68+
image: ghcr.io/cgs-earth/sensorthings-action:0.1.2
69+
volumes:
70+
- /var/run/docker.sock:/var/run/docker.sock
71+
3872
steps:
39-
- name: Pre-pull Docker Images
40-
run: |
41-
docker pull container-registry.oracle.com/database/express:21.3.0-xe &
42-
docker pull appropriate/curl:latest &
43-
docker pull elasticsearch:8.17.0 &
44-
docker pull opensearchproject/opensearch:2.18.0 &
45-
docker pull mongo:8.0.4 &
46-
docker pull postgis/postgis:14-3.2 &
4773
- name: Clear up GitHub runner diskspace
4874
run: |
4975
echo "Space before"
@@ -60,43 +86,21 @@ jobs:
6086
name: Setup Python ${{ matrix.python-version }}
6187
with:
6288
python-version: ${{ matrix.python-version }}
89+
- name: Install and run Oracle
90+
run: |
91+
docker run \
92+
-d \
93+
--name oracledb \
94+
-e ORACLE_PWD=oracle \
95+
-v ${{ github.workspace }}/tests/data/oracle/init-db:/opt/oracle/scripts/startup \
96+
-p 1521:1521 \
97+
container-registry.oracle.com/database/express:21.3.0-xe
6398
- name: Configure sysctl limits
6499
run: |
65100
sudo swapoff -a
66101
sudo sysctl -w vm.swappiness=1
67102
sudo sysctl -w fs.file-max=262144
68103
sudo sysctl -w vm.max_map_count=262144
69-
- name: "Install and run MySQL 📦"
70-
uses: mirromutth/mysql-action@v1.1
71-
with:
72-
host port: 3306
73-
mysql version: '8.0'
74-
mysql database: test_geo_app
75-
mysql root password: mysql # This is a dummy password here; not actually used in prod
76-
mysql user: pygeoapi
77-
mysql password: mysql
78-
79-
- name: Install and run Elasticsearch 📦
80-
uses: getong/elasticsearch-action@v1.2
81-
with:
82-
elasticsearch version: '8.17.0'
83-
host port: 9200
84-
container port: 9200
85-
host node port: 9300
86-
node port: 9300
87-
discovery type: 'single-node'
88-
- name: Install and run OpenSearch 📦
89-
uses: esmarkowski/opensearch-github-action@v1.0.0
90-
with:
91-
version: 2.18.0
92-
security-disabled: true
93-
port: 9209
94-
- name: Install and run MongoDB
95-
uses: supercharge/mongodb-github-action@1.12.0
96-
with:
97-
mongodb-version: '8.0.4'
98-
- name: Install and run SensorThingsAPI
99-
uses: cgs-earth/sensorthings-action@v0.1.2
100104
- name: Install sqlite and gpkg dependencies
101105
uses: awalsh128/cache-apt-pkgs-action@v1.4.3
102106
with:
@@ -113,9 +117,6 @@ jobs:
113117
# with:
114118
# packages: gdal-bin libgdal-dev
115119
# version: 3.11.3
116-
- name: Install and run Oracle
117-
run: |
118-
docker run -d --name oracledb -e ORACLE_PWD=oracle -v ${{ github.workspace }}/tests/data/oracle/init-db:/opt/oracle/scripts/startup -p 1521:1521 container-registry.oracle.com/database/express:21.3.0-xe
119120
- name: Install requirements 📦
120121
run: |
121122
pip3 install setuptools
@@ -131,6 +132,7 @@ jobs:
131132
pip3 install GDAL==`gdal-config --version`
132133
- name: setup test data ⚙️
133134
run: |
135+
python3 tests/load_oracle_data.py
134136
python3 tests/load_es_data.py tests/data/ne_110m_populated_places_simple.geojson geonameid
135137
python3 tests/load_opensearch_data.py tests/data/ne_110m_populated_places_simple.geojson geonameid
136138
python3 tests/load_mongo_data.py tests/data/ne_110m_populated_places_simple.geojson
@@ -140,7 +142,6 @@ jobs:
140142
psql postgresql://postgres:${{ secrets.DatabasePassword || 'postgres' }}@localhost:5432/test -f tests/data/postgres_manager_full_structure.backup.sql
141143
mysql -h 127.0.0.1 -P 3306 -u root -p'mysql' test_geo_app < tests/data/mysql_data.sql
142144
docker ps
143-
python3 tests/load_oracle_data.py
144145
- name: run API tests ⚙️
145146
run: pytest tests/api --ignore-glob='*_live.py'
146147
- name: run Formatter tests ⚙️

0 commit comments

Comments
 (0)