Skip to content

Commit

Permalink
workflows: Use service containers for MariaDB and MySQL
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelkuhn committed Mar 17, 2024
1 parent 4e2db1f commit ceba9f0
Showing 1 changed file with 22 additions and 23 deletions.
45 changes: 22 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,28 @@ jobs:
dist: ubuntu-20.04
dependencies: system
services:
mariadb:
image: ${{ matrix.julea.db == 'mysql' && matrix.julea.db-server == 'mariadb' && 'docker.io/library/mariadb' || '' }}
env:
MARIADB_RANDOM_ROOT_PASSWORD: yes
MARIADB_DATABASE: juleadb
MARIADB_USER: julea
MARIADB_PASSWORD: aeluj
ports:
- 3306:3306
mongodb:
image: ${{ matrix.julea.kv == 'mongodb' && 'docker.io/library/mongo' || '' }}
ports:
- 27017:27017
mysql:
image: ${{ matrix.julea.db == 'mysql' && matrix.julea.db-server == 'mysql' && 'docker.io/library/mysql' || '' }}
env:
MYSQL_RANDOM_ROOT_PASSWORD: yes
MYSQL_DATABASE: juleadb
MYSQL_USER: julea
MYSQL_PASSWORD: aeluj
ports:
- 3306:3306
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -263,10 +281,13 @@ jobs:
sudo sysctl vm.mmap_rnd_bits=28
- name: Clean up system packages
# We need to remove glib-network, otherwise libproxy might cause crashes.
# FIXME https://bugs.launchpad.net/ubuntu/+source/mariadb-10.1/+bug/1806263
# Ubuntu 20.04 and 22.04 have MySQL 8.0
run: |
sudo apt --yes purge glib-networking
sudo apt --yes purge glib-networking mysql-client mysql-client-8.0 mysql-server mysql-server-8.0
sudo apt --yes --purge autoremove
sudo aa-remove-unknown
sudo rm --recursive --force /var/lib/mysql
- name: Install dependencies
if: ${{ matrix.dependencies == 'system' }}
run: |
Expand All @@ -290,28 +311,6 @@ jobs:
if: ${{ matrix.dependencies == 'spack' && steps.cache.outputs.cache-hit != 'true' }}
run: |
exit 1
- name: Set up MySQL
if: ${{ matrix.julea.db == 'mysql' && matrix.julea.db-server == 'mysql' }}
run: |
sudo systemctl start mysql.service
mysql --user=root --password=root --execute="CREATE DATABASE juleadb;"
mysql --user=root --password=root --execute="CREATE USER 'julea'@'localhost' IDENTIFIED WITH mysql_native_password BY 'aeluj';"
mysql --user=root --password=root --execute="GRANT ALL ON juleadb.* TO 'julea'@'localhost';"
- name: Set up MariaDB
if: ${{ matrix.julea.db == 'mysql' && matrix.julea.db-server == 'mariadb' }}
# FIXME https://bugs.launchpad.net/ubuntu/+source/mariadb-10.1/+bug/1806263
# Ubuntu 20.04 and 22.04 have MySQL 8.0
run: |
sudo apt --yes purge mysql-client mysql-client-8.0 mysql-server mysql-server-8.0
sudo apt --yes --purge autoremove
sudo aa-remove-unknown
sudo rm --recursive --force /var/lib/mysql
sudo apt update || true
sudo apt --yes --no-install-recommends install mariadb-server
sudo systemctl start mariadb.service
sudo mariadb --execute="CREATE DATABASE juleadb;"
sudo mariadb --execute="CREATE USER 'julea'@'localhost' IDENTIFIED BY 'aeluj';"
sudo mariadb --execute="GRANT ALL ON juleadb.* TO 'julea'@'localhost';"
- name: Configure and build
env:
CC: ${{ matrix.os.compiler }}
Expand Down

0 comments on commit ceba9f0

Please sign in to comment.