Metis Test Suite

Metis Test Action

This GitHub Action allows you to create a new test in Metis, and comment on a pull request with the results of the test. we use your pr-name as your test name.

Prerequisites

  • A Metis account with a valid API key. https://docs.metisdata.io/metis/getting-started/what-is-metis
  • Metis SDK installed on your project. https://docs.metisdata.io/metis/sdk-integration/general

Inputs

  • metis_api_key: The Metis API key to use for creating the test
  • github_token: The GitHub token to use for commenting on the pull request

Usage

1.

Add the following code to your GitHub Actions workflow file:
- name: Metis Test
id: tag_pr
uses: metis-data/test-queries-[email protected]
with:
metis_api_key: ${{ secrets.METIS_API_KEY }}
github_token: ${{ secrets.GITHUB_TOKEN }}

2.

Inject tag_pr in your env for your sdk usage
- name: E2E Test that check sql queries on real database
.
.
env:
METIS_TAG_PR: ${{ steps.tag_pr.outputs.pr_tag }}
.
.

Github workflow example

name: E2E-TEST-EXAMPLE
on:
# Run workflow every 6 hours
schedule:
- cron: '0 */6 * * *'
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
steps:
- name: set TAG PR Value step
id: tag_pr
uses: metis-data/test-queries-[email protected]
with:
metis_api_key: ${{ secrets.METIS_API_KEY}}
github_token: ${{ secrets.GITHUB_TOKEN}}
- name: checkout
uses: actions/[email protected]
- name: setup-node
uses: actions/setup-[email protected]
with:
node-version: 18.x
- name: test
env:
METIS_TAG_PR: ${{ steps.tag_pr.outputs.pr_tag }}
METIS_API_KEY: ${{ secrets.METIS_API_KEY}} #Optional
DATABASE_URL: ${{ secrets.METIS_E2E_DB_CONNECTION }} #Optional
# Run your e2e test
run: npm ci && npm run test-sql-queries