Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial partner driver testing github action #9

Merged
merged 73 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
f85161a
Add initial partner driver testing github action
snoe Dec 2, 2024
970bfdc
Add workflow
snoe Dec 2, 2024
a53c87f
Update workflow
snoe Dec 2, 2024
bade995
Try adding on push
snoe Dec 2, 2024
5292189
Rename file
snoe Dec 2, 2024
de6fba7
add checkout step
snoe Dec 2, 2024
6a7f7de
Fix secret use
snoe Dec 3, 2024
32c4d4b
Fix dockerfile ref
snoe Dec 3, 2024
f2e2b5a
Fix warning about input
snoe Dec 3, 2024
ce3321d
Fix dockerfile path?
snoe Dec 3, 2024
5aba9ef
Fix up run
snoe Dec 3, 2024
8ea9299
Fix pull
snoe Dec 3, 2024
7ef2307
Ensure correct dirs
snoe Dec 3, 2024
1f3b159
Try dockerless run
snoe Dec 4, 2024
0a5e400
Workflow test
snoe Dec 4, 2024
9a8502a
Try again
snoe Dec 4, 2024
a625f6e
Callable workflow test
snoe Dec 4, 2024
cfea49d
Test without clojure build
snoe Dec 4, 2024
18e157d
Fix double name
snoe Dec 4, 2024
7b1852c
Add type to inputs
snoe Dec 4, 2024
fcb7965
Use mb_version input
snoe Dec 4, 2024
0f1b527
Use mb_version input
snoe Dec 4, 2024
72bc13e
Test
snoe Dec 4, 2024
724693d
Try referencing docker-compose
snoe Dec 4, 2024
233e17e
Move docker-compose
snoe Dec 4, 2024
24b3e60
add yarn lock path
snoe Dec 4, 2024
722a33a
Try running tests
snoe Dec 4, 2024
f3be48e
Fix partner-driver path
snoe Dec 4, 2024
7e7db5f
Add junit results
snoe Dec 4, 2024
996bf5e
Run all tests, add junit report
snoe Dec 4, 2024
df7fd28
Add ocient and starbust runs
snoe Dec 4, 2024
a374d79
Fix param
snoe Dec 4, 2024
1b1e961
Echo DOCKER var
snoe Dec 4, 2024
c9dc270
starburst uses main
snoe Dec 4, 2024
25267ba
Add working-dir to test reporter
snoe Dec 4, 2024
0769a41
Add clickhouse version tests
snoe Dec 5, 2024
5f4b13b
try setting version based off var
snoe Dec 5, 2024
d8f34af
Fix error
snoe Dec 5, 2024
e9b69e6
Try version matrix
snoe Dec 5, 2024
2025513
matrix drivers
snoe Dec 5, 2024
4191e41
Quote line
snoe Dec 5, 2024
683a9af
Try getting partner refs
snoe Dec 5, 2024
c38f909
Add timeout
snoe Dec 5, 2024
8aded43
Fix yq install
snoe Dec 5, 2024
9f0d8b1
Escape in yq string
snoe Dec 5, 2024
49e37e6
Fix name
snoe Dec 5, 2024
bc38de0
Test outputs
snoe Dec 5, 2024
31b31e6
Trying to get refs working
snoe Dec 5, 2024
15b10f7
unwrap driver array
snoe Dec 5, 2024
6b998bc
Remove stray colon
snoe Dec 5, 2024
81a611a
Try ref again
snoe Dec 5, 2024
ef450e1
Try using docker for starburst and exasol
snoe Dec 5, 2024
5969436
Cleanup
snoe Dec 5, 2024
bfbe29f
Add jar build and upload
snoe Dec 6, 2024
2ef5637
Add env var for test host
snoe Dec 6, 2024
1491f4f
Checkout out to modules/drivers/ with driver name
snoe Dec 6, 2024
17a6dcc
Fix checkout path
snoe Dec 6, 2024
d8789d4
Add 1password env to workflow
snoe Dec 6, 2024
e98f731
Add ee run, try to mask env
snoe Dec 6, 2024
112248d
Accidentally dropped test
snoe Dec 6, 2024
7706ab2
Don't pass secrets between steps
snoe Dec 6, 2024
62bf044
Fix artifact path
snoe Dec 6, 2024
a6d62fe
Fix artifact name
snoe Dec 6, 2024
d926dad
Fix artifact name again
snoe Dec 6, 2024
2b4555c
Update cron to once per hour
snoe Dec 9, 2024
4e6272f
Address PR and allow subdir for starburst
snoe Dec 10, 2024
4c528a1
Fix event handling
snoe Dec 10, 2024
4b65935
Run on all pushes for now
snoe Dec 10, 2024
a87389b
Test deps/root
snoe Dec 10, 2024
a4c505f
Fix brackets
snoe Dec 10, 2024
59e2608
Merge branch 'main' into partner-driver-testing
snoe Dec 10, 2024
a679bf1
Fix quotes
snoe Dec 10, 2024
11c0676
Drop deps/root attempt
snoe Dec 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 150 additions & 0 deletions .github/workflows/callable-partner-driver.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
name: Test Partner Driver

on:
workflow_call:
inputs:
DRIVER:
description: 'Driver to use'
type: string
required: true
MB_REF:
type: string
required: true
PARTNER_REF:
type: string
required: true
REPO:
type: string
required: true
DOCKER:
type: boolean
required: true
secrets:
OP_SERVICE_ACCOUNT_TOKEN:
required: true

jobs:
run-tests:
timeout-minutes: 45
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./metabase
steps:
- uses: actions/checkout@v4
with:
path: registry

- name: Checkout Metabase Repo
uses: actions/checkout@v4
with:
path: metabase
repository: metabase/metabase
ref: ${{ inputs.MB_REF }}

- name: Checkout Driver Repo
uses: actions/checkout@v4
with:
repository: ${{ inputs.REPO }}
path: metabase/modules/drivers/${{ inputs.DRIVER }}
ref: ${{ inputs.PARTNER_REF }}

- name: Set up JDK 21
uses: actions/setup-java@v2
with:
distribution: temurin
java-version: 21
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we might want to test this on a few different versions: at least 11 and 21

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think 21 should be sufficient for now, as we get more in the weeds having a mechanism for multiple java versions would make sense.


- name: Start Database in Docker
if: ${{ inputs.DOCKER }}
uses: hoverkraft-tech/[email protected]
with:
compose-file: "./registry/docker-compose.yml"
services: |
${{ inputs.DRIVER }}

- name: Install Clojure CLI
run: |
curl -O https://download.clojure.org/install/linux-install-1.11.1.1262.sh &&
sudo bash ./linux-install-1.11.1.1262.sh

- uses: 1password/install-cli-action@v1

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: "18"
cache: "yarn"
cache-dependency-path: ./metabase/yarn.lock

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

- name: Build static-viz
run: yarn build-static-viz

- name: Setup docker
if: ${{ inputs.DOCKER }}
run: |
sudo echo "127.0.0.1 ${{ inputs.DRIVER }}" | sudo tee -a /etc/hosts

- name: Run tests
run: |

export DRIVER=${{ inputs.DRIVER }}

# Setup environment
export OP_SERVICE_ACCOUNT_TOKEN=${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
op item list --format=json --tags partner-testing \
| jq -r ".[] | select(.title | test(\"driver: $DRIVER\")) | .id" \
| xargs -I {} op item get {} --format=json --vault "Driver Development" \
| jq -r ".fields[] | select(.section.label == \"ENV\") | \"MB_$(echo $DRIVER | tr '[:lower:]' '[:upper:]' | tr '-' '_')_TEST_\\(.label)=\\\"\\(.value)\\\"\"" \
> driver.env

set -a
source driver.env
set +a
rm driver.env

# Move source in subdir to modules
DIR=$( yq -r ".drivers[] | select(.name == \"${DRIVER}\") | .test.dir" ../registry/registry.yaml )
if [[ "$DIR" != "null" ]]; then
mv modules/drivers/${DRIVER} ../tmp-${DRIVER}
mv ../tmp-${DRIVER}/${DIR} modules/drivers/${DRIVER}
fi

# Run tests
DRIVERS=${{ inputs.DRIVER }} \
clojure \
-Sdeps "{:jvm-opts [\"-Dci=true\"] :aliases {:partner-driver {:extra-paths [\"modules/drivers/${{ inputs.DRIVER }}/test\" \"modules/driver/${{ inputs.DRIVER }}/src\"] :extra-deps {metabase/partner-driver {:local/root \"modules/drivers/${{ inputs.DRIVER }}\"}}}}}" \
-X:dev:drivers:drivers-dev:ee:ee-dev:partner-driver:test \
:only-tags [:mb/driver-tests]

- name: Build jar
run: |
echo "{:deps {metabase/${{ inputs.DRIVER }} {:local/root \"${{ inputs.DRIVER }}\" }}}" > modules/drivers/deps.edn
bin/build-driver.sh ${{ inputs.DRIVER }}
mv resources/modules/${{ inputs.DRIVER }}.metabase-driver.jar ${{ inputs.DRIVER }}.${{ inputs.MB_REF }}.metabase-driver.jar

- name: Upload driver jar
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.DRIVER }}.${{ inputs.MB_REF }}.metabase-driver.jar
path: metabase/${{ inputs.DRIVER }}.${{ inputs.MB_REF }}.metabase-driver.jar
Comment on lines +128 to +138
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we saving these artifacts?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea is to move towards us building and using the artifacts that we include in cloud rather than relying on partner builds.


- name: Publish Test Report
uses: dorny/test-reporter@v1
if: failure()
with:
path: "target/junit/**/*_test.xml"
name: JUnit Test Report ${{ inputs.DRIVER }}
working-directory: metabase
reporter: java-junit
list-suites: failed
list-tests: failed
fail-on-error: false
51 changes: 51 additions & 0 deletions .github/workflows/test-partner-driver.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Test All Partner Drivers

on:
schedule:
- cron: "0 10 * * *"
push:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe on push to main?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think all branches is actually correct, since PRs would affect the runners and should ensure everything is working (even if not passing)

workflow_dispatch:

jobs:
setup:
runs-on: ubuntu-latest
outputs:
versions: ${{ steps.versions.outputs.value }}
drivers: ${{ steps.drivers.outputs.value }}
env:
CURRENT_VERSION: ${{ vars.CURRENT_VERSION }}
steps:
- uses: actions/checkout@v4
- name: Install yq
run: sudo snap install yq
- id: drivers
run: |
echo value=$(yq ".drivers | map({\"name\": .name, \"repo\": .test.repo\
, \"edge\": .test.refs.default\
, \"current\": (.test.refs | omit([\"default\"]) | to_entries| .[] | select((.key|tonumber) >= $CURRENT_VERSION) | .value)//.test.refs.default\
, \"previous\": (.test.refs | omit([\"default\"]) | to_entries| .[] | select((.key|tonumber) >= $(($CURRENT_VERSION - 1))) | .value)//.test.refs.default\
, \"docker\": .test.docker})" -o json registry.yaml) >> $GITHUB_OUTPUT

- id: versions
run: |
echo "value=[{\"ref\": \"master\", \"name\": \"edge\"}, {\"ref\": \"release-x.${CURRENT_VERSION}.x\", \"name\": \"current\"}, {\"ref\": \"release-x.$(($CURRENT_VERSION - 1)).x\", \"name\": \"previous\"}]" >> $GITHUB_OUTPUT
- run: |
echo "versions ${{ fromJSON(steps.versions.outputs.value) }}"
echo "drivers ${{ fromJSON(steps.drivers.outputs.value) }}"

driver:
needs: [ setup ]
name: "${{ matrix.driver.name }} : ${{ matrix.version.name }} "
strategy:
matrix:
driver: ${{fromJSON(needs.setup.outputs.drivers)}}
version: ${{fromJSON(needs.setup.outputs.versions)}}
fail-fast: false
uses: ./.github/workflows/callable-partner-driver.yml
with:
MB_REF: ${{ matrix.version.ref }}
PARTNER_REF: ${{ matrix.driver[matrix.version.name] }}
DRIVER: ${{ matrix.driver.name }}
REPO: ${{ matrix.driver.repo }}
DOCKER: ${{ matrix.driver.docker }}
secrets: inherit
39 changes: 39 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
version: "3.9"

services:
materialize:
image: materialize/materialized:latest
container_name: materialize
command:
- --availability-zone=test1
- --availability-zone=test2
- --bootstrap-role=materialize
- --system-parameter-default=max_tables=1000
environment:
MZ_NO_TELEMETRY: 1
ports:
- 6875:6875
- 6877:6877
- 6878:6878
healthcheck:
{
test: curl -f localhost:6878/api/readyz,
interval: 1s,
start_period: 35s,
}
clickhouse:
image: clickhouse/clickhouse-server:latest
ports:
- 8123:8123
- 9000:9000
exasol:
image: exasol/docker-db:7.1.23
ports:
- 8563:8563
- 2580:2580
- 443:443
starburst:
image: trinodb/trino:latest
ports:
- 8082:8080
36 changes: 36 additions & 0 deletions registry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,66 @@ drivers:
versions:
default: https://github.com/ClickHouse/metabase-clickhouse-driver/releases/download/1.50.6/clickhouse.metabase-driver.jar
49: https://github.com/ClickHouse/metabase-clickhouse-driver/releases/download/1.5.1/clickhouse.metabase-driver.jar
test:
docker: true
repo: ClickHouse/metabase-clickhouse-driver
refs:
default: master
- name: duckdb
homepage: https://github.com/MotherDuck-Open-Source/metabase_duckdb_driver
versions:
default: https://github.com/MotherDuck-Open-Source/metabase_duckdb_driver/releases/download/0.2.9/duckdb.metabase-driver.jar
49: https://github.com/MotherDuck-Open-Source/metabase_duckdb_driver/releases/download/0.2.7/duckdb.metabase-driver.jar
test:
docker: false
repo: MotherDuck-Open-Source/metabase_duckdb_driver
refs:
default: main
- name: exasol
homepage: https://github.com/exasol/metabase-driver
versions:
default: https://github.com/exasol/metabase-driver/releases/download/1.0.7/exasol.metabase-driver.jar
deps:
- https://repo1.maven.org/maven2/com/exasol/exasol-jdbc/7.1.20/exasol-jdbc-7.1.20.jar # what about 24.1.1?
test:
docker: true
repo: exasol/metabase-driver
refs:
default: main
- name: firebolt
homepage: https://docs.firebolt.io/integrations/business-intelligence/connecting-to-metabase.html
versions:
default: https://github.com/firebolt-db/metabase-firebolt-driver/releases/download/3.0.3/firebolt.metabase-driver-3.0.3.jar
test:
docker: false
repo: firebolt-db/metabase-firebolt-driver
refs:
default: develop
- name: materialize
homepage: https://github.com/MaterializeInc/metabase-materialize-driver
versions:
default: https://github.com/MaterializeInc/metabase-materialize-driver/releases/download/v1.2.0/materialize.metabase-driver.jar
test:
docker: true
repo: MaterializeInc/metabase-materialize-driver
refs:
default: master
- name: ocient
homepage: https://github.com/Xeograph/metabase-ocient-driver
versions:
default: https://github.com/Xeograph/metabase-ocient-driver/releases/download/v1.1.0/ocient.metabase-driver.jar
test:
docker: false
repo: Xeograph/metabase-ocient-driver
refs:
default: master
- name: starburst
homepage: https://github.com/starburstdata/metabase-driver
versions:
default: https://github.com/starburstdata/metabase-driver/releases/download/5.0.0/starburst-5.0.0.metabase-driver.jar
test:
docker: true
repo: starburstdata/metabase-driver
dir: drivers/starburst
refs:
default: main
Loading