Skip to content

Commit

Permalink
Add Metabase tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbyiliev committed Jul 31, 2023
1 parent 3493e59 commit 0d9472c
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/deps.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{:aliases
{:user/materialize
{:extra-paths ["PWD/modules/drivers/materialize/test"]
:extra-deps {metabase/materialize {:local/root "PWD/modules/drivers/materialize"}}}}}
90 changes: 90 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Tests

on:
workflow_dispatch:
push:
branches:
- master
paths-ignore:
- "**.md"
pull_request:

jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout Metabase Repo
uses: actions/checkout@v2
with:
repository: metabase/metabase
ref: v0.46.5

- name: Checkout Driver Repo
uses: actions/checkout@v2
with:
path: modules/drivers/materialize

- name: Prepare JDK 17
uses: actions/setup-java@v2
with:
distribution: "temurin"
java-version: "17"

- name: Add Materialize TLS instance to /etc/hosts
run: |
sudo echo "127.0.0.1 materialize" | sudo tee -a /etc/hosts
- name: Start Materialize in Docker
uses: isbang/[email protected]
with:
compose-file: "modules/drivers/materialize/docker-compose.yml"
services: |
materialize
- name: Install Clojure CLI
run: |
curl -O https://download.clojure.org/install/linux-install-1.11.1.1182.sh &&
sudo bash ./linux-install-1.11.1.1182.sh
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: "16"
cache: "yarn"

- name: Get M2 cache
uses: actions/cache@v2
with:
path: |
~/.m2
~/.gitlibs
key: ${{ runner.os }}-materialize-${{ hashFiles('**/deps.edn') }}

- name: Prepare stuff for pulses
run: yarn build-static-viz

# Use custom deps.edn containing "user/materialize" alias to include driver sources
- name: Run tests
run: |
mkdir -p /home/runner/.config/clojure
cat modules/drivers/materialize/.github/deps.edn | sed -e "s|PWD|$PWD|g" > /home/runner/.config/clojure/deps.edn
DRIVERS=materialize clojure -X:dev:drivers:drivers-dev:test:user/materialize
- name: Build Materialize driver
run: |
echo "{:deps {metabase/materialize {:local/root \"materialize\" }}}" > modules/drivers/deps.edn
bin/build-driver.sh materialize
ls -lah resources/modules
- name: Archive driver JAR
uses: actions/upload-artifact@v2
with:
name: materialize.metabase-driver.jar
path: resources/modules/materialize.metabase-driver.jar

# - name: Report test results
# uses: mikepenz/[email protected]
# if: always()
# with:
# report_paths: "**/target/junit/*.xml"
# github_token: ${{ secrets.GITHUB_TOKEN }}
20 changes: 20 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
version: "3.9"

services:
materialize:
image: materialize/materialized:latest
container_name: materialize
command:
- --availability-zone=test1
- --availability-zone=test2
ports:
- 6875:6875
- 6877:6877
- 6878:6878
healthcheck:
{
test: curl -f localhost:6878/api/readyz,
interval: 1s,
start_period: 35s,
}

0 comments on commit 0d9472c

Please sign in to comment.