Skip to content

Commit

Permalink
MySQL tests in CI (#1952)
Browse files Browse the repository at this point in the history
MySQL tests in CI
  • Loading branch information
whscullin authored Oct 8, 2024
1 parent dff529e commit 4f17832
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 5 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/db-mysql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: MySQL DB

on: [pull_request, workflow_call]

jobs:
# Label of the container job
test-mysql:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]

steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: npm install, build, and test
run: |
npm ci --loglevel error
npm run build
npm run build-duckdb-db
./test/mysql/mysql_start.sh
npm run test-silent -- -- test
./test/mysql/mysql_stop.sh
env:
MALLOY_DATABASES: mysql
MYSQL_HOST: '127.0.0.1'
MYSQL_PORT: 3306
MYSQL_USER: root
MYSQL_DATABASE: malloytest
13 changes: 13 additions & 0 deletions .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,34 @@ jobs:
uses: './.github/workflows/db-motherduck.yaml'
secrets:
MOTHERDUCK_TOKEN_10: ${{ secrets.MOTHERDUCK_TOKEN_10 }}
db-mysql:
uses: './.github/workflows/db-mysql.yaml'
db-postgres:
uses: './.github/workflows/db-postgres.yaml'
db-presto:
uses: './.github/workflows/db-presto.yaml'
secrets:
BQ_PRESTO_TRINO_KEY: ${{ secrets.BQ_PRESTO_TRINO_KEY }}
db-snowflake:
uses: './.github/workflows/db-snowflake.yaml'
secrets:
SNOWFLAKE_CONNECTION: ${{ secrets.SNOWFLAKE_CONNECTION }}
db-trino:
uses: './.github/workflows/db-trino.yaml'
secrets:
BQ_PRESTO_TRINO_KEY: ${{ secrets.BQ_PRESTO_TRINO_KEY }}
main:
uses: './.github/workflows/main.yaml'

malloy-tests:
needs:
- db-bigquery
- db-motherduck
- db-mysql
- db-postgres
- db-presto
- db-snowflake
- db-trino
- main
runs-on: ubuntu-latest
steps:
Expand Down
11 changes: 6 additions & 5 deletions test/mysql/mysql_start.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#! /bin/bash
set -e

rm -rf .tmp
mkdir .tmp

#

# run docker
docker run -p 3306:3306 -d -v $PWD/../data/mysql:/init_data --name mysql-malloy -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -d mysql:8.4.2
SCRIPTDIR=$(dirname $0)
docker run -p 3306:3306 -d -v $SCRIPTDIR/../data/mysql:/init_data --name mysql-malloy -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -d mysql:8.4.2

# wait for server to start
counter=0
Expand All @@ -27,6 +28,6 @@ done
# load the test data.
docker exec mysql-malloy cp /init_data/malloytest.mysql.gz /tmp
docker exec mysql-malloy gunzip /tmp/malloytest.mysql.gz
docker exec mysql-malloy mysql -uroot -e 'drop database if exists malloytest; create database malloytest; use malloytest; source /tmp/malloytest.mysql'
docker exec mysql-malloy mysql -P3306 -h127.0.0.1 -uroot -e 'drop database if exists malloytest; create database malloytest; use malloytest; source /tmp/malloytest.mysql;'

echo "MySQL running on port 3306"
echo "MySQL running on port 3306"

0 comments on commit 4f17832

Please sign in to comment.