Skip to content

Commit

Permalink
Fix MariaDB service in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
adrien-berchet committed Oct 28, 2024
1 parent 890585e commit 2a9e24b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 10 deletions.
44 changes: 34 additions & 10 deletions .github/workflows/test_and_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,25 @@ jobs:
--health-interval 10s
--health-timeout 5s
--health-retries 5
mysql:
image: mysql:latest
ports:
- 3307:3306
env:
MYSQL_USER: gis
MYSQL_PASSWORD: gis
MYSQL_DATABASE: gis
MYSQL_ROOT_PASSWORD: gis
# Set health checks to wait until MySQL has started
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
mariadb:
image: mariadb:latest
ports:
- 3308
- 3308:3306
env:
MARIADB_USER: gis
MARIADB_PASSWORD: gis
Expand All @@ -78,10 +93,10 @@ jobs:

# Setup Conda for Python and Pypy
- name: Install Conda environment with Micromamba
uses: mamba-org/setup-micromamba@v1
uses: mamba-org/setup-micromamba@v2
with:
environment-name: test_${{ matrix.python-version.flag }}
cache-environment: true
cache-environment: false
create-args: >-
${{ matrix.python-version.pkg_name }}
libgdal
Expand All @@ -93,6 +108,11 @@ jobs:
- defaults
channel_priority: strict
# Install MariaDB
- name: Install MariaDB
run: |
sudo apt-get install -y mariadb-server mariadb-client
# Config PostgreSQL
- name: Configure PostgreSQL
run: |
Expand All @@ -111,13 +131,17 @@ jobs:
# Drop PostGIS Topology extension to "gis" database
psql -h localhost -p 5432 -U gis -d gis -c 'DROP EXTENSION IF EXISTS postgis_topology;'
# Setup MySQL
- name: Set up MySQL
# Check MySQL
- name: Check MySQL
run: |
mysql --user=gis --password=gis --host=127.0.0.1 -P 3307 -e "SELECT VERSION();"
mysql --user=root --password=gis --host=127.0.0.1 -P 3307 -e "GRANT ALL PRIVILEGES ON *.* TO 'gis'@'%' WITH GRANT OPTION;"
# Check MariaDB
- name: Check MariaDB
run: |
sudo systemctl start mysql
sudo mysql --user=root --password=root --host=127.0.0.1 -e "CREATE USER 'gis'@'%' IDENTIFIED BY 'gis';"
sudo mysql --user=root --password=root --host=127.0.0.1 -e "GRANT ALL PRIVILEGES ON *.* TO 'gis'@'%' WITH GRANT OPTION;"
mysql --user=gis --password=gis -e "CREATE DATABASE gis;"
mysql --user=gis --password=gis --host=127.0.0.1 -P 3308 -e "SELECT VERSION();"
mysql --user=root --password=gis --host=127.0.0.1 -P 3308 -e "GRANT ALL PRIVILEGES ON *.* TO 'gis'@'%' WITH GRANT OPTION;"
# Check python version
- name: Display Python version
Expand All @@ -138,7 +162,7 @@ jobs:
SPATIALITE_LIBRARY_PATH: /home/runner/micromamba/envs/test_${{ matrix.python-version.flag }}/lib/mod_spatialite.so
PROJ_LIB: /home/runner/micromamba/envs/test_${{ matrix.python-version.flag }}/share/proj
COVERAGE_FILE: .coverage
PYTEST_MYSQL_DB_URL: mysql://gis:gis@127.0.0.1/gis
PYTEST_MYSQL_DB_URL: mysql://gis:gis@127.0.0.1:3307/gis
PYTEST_MARIADB_DB_URL: mariadb://gis:gis@127.0.0.1:3308/gis
run: |
# Run the unit test suite with SQLAlchemy=1.4.* and then with the latest version of SQLAlchemy
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ python =
passenv=
PROJ_LIB
PYTEST_POSTGRESQL_DB_URL
PYTEST_MARIADB_DB_URL
PYTEST_MYSQL_DB_URL
PYTEST_SPATIALITE3_DB_URL
PYTEST_SPATIALITE4_DB_URL
Expand Down

0 comments on commit 2a9e24b

Please sign in to comment.