Montara CI is a GitHub Action that allows you to execute a pipeline test run in Montara before merging a pull request. If the pipeline fails, the pull request can not be merged.
-
Create a Montara account
-
Connect Montara to your data warehouse (see Docs).
-
Connect Montara to your git repo in the Montara settings page (see Docs).
-
Montara CI triggers a test run via a webhook. Copy the webhook URL from the pipeline settings page in Montara.
-
Create a
ci.ymlfile in your.github/workflowsdirectory with the following content: -
[Recommended] Add a required status check in your repo settings to ensure that the pipeline runs successfully before merging a PR.
-
[Recommended] The test run will run on an isolated schema according to the user who created the PR. You can also specify a fallback schema to override this behavior if the PR is created outside of Montara.
-
[Optional] You can pass variables to the test run by setting the
variablesparameter to a JSON object of key-value pairs. for example:variables: '{"var1": "value1", "var2": "value2"}'
-
[Optional] The test run by default will run a Montara smart run. You can disable this by setting the
isSmartRunparameter tofalse. -
[Optional] You can choose to run the montara pipline with full refreshby setting the
fullRefreshparameter totrue. -
[Optional] The test run by default will run in parallel to any pipelines that might run at the same time. You can disable this by setting the
allowConcurrentPipelineRunsparameter tofalse.
name: Montara CI
on:
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: read
issues: write
pull-requests: write
jobs:
montara:
runs-on: ubuntu-latest
steps:
- name: Montara CI
uses: montara-io/montara-ci@v1.0.20
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
webhookUrl: <your-montara-webhook-url>
fallbackSchema: <[optional]your-fallback-schema>[optional]
isSmartRun: <[optional]true|false>
fullRefresh: <[optional]true|false>
allowConcurrentPipelineRuns: <[optional]true|false>
variables: <[optional]{key: value}>- You're good to go 🚀. Go ahead and create a new PR.
-
Clone the repo
git clone github.com/montara-io/montara-ci -
🛠️ Install the dependencies
npm install
-
🏗️ Package the TypeScript for distribution
npm run bundle
-
✅ Run the tests
$ npm test PASS ./index.test.js ✓ throws invalid number (3ms) ✓ wait 500 ms (504ms) ✓ test runs (95ms) ...
-
Make your changes
-
Format, test, and build the action
npm run all
npm run allsh ./script/release- Find your newly created tag in the tags section of the repo.
- Release the tag.