-
Notifications
You must be signed in to change notification settings - Fork 0
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
Changes from all commits
f85161a
970bfdc
a53c87f
bade995
5292189
de6fba7
6a7f7de
32c4d4b
f2e2b5a
ce3321d
5aba9ef
8ea9299
7ef2307
1f3b159
0a5e400
9a8502a
a625f6e
cfea49d
18e157d
7b1852c
fcb7965
0f1b527
72bc13e
724693d
233e17e
24b3e60
722a33a
f3be48e
7e7db5f
996bf5e
df7fd28
a374d79
1b1e961
c9dc270
25267ba
0769a41
5f4b13b
d8f34af
e9b69e6
2025513
4191e41
683a9af
c38f909
8aded43
9f0d8b1
49e37e6
bc38de0
31b31e6
15b10f7
6b998bc
81a611a
ef450e1
5969436
bfbe29f
2ef5637
1491f4f
17a6dcc
d8789d4
e98f731
112248d
7706ab2
62bf044
a6d62fe
d926dad
2b4555c
4e6272f
4c528a1
4b65935
a87389b
a4c505f
59e2608
a679bf1
11c0676
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 | ||
|
||
- 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why are we saving these artifacts? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
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: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe on push to There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.