forked from lightdash/lightdash
-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (95 loc) · 3.52 KB
/
Copy pathcli-tests.yml
File metadata and controls
104 lines (95 loc) · 3.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: CLI tests
on: [ deployment_status ]
env:
NODE_ENV: 'development'
jobs:
prepare-preview:
# Only trigger for correct environment and status
if: ${{ github.event.deployment_status.state == 'success' && (contains(github.event.deployment.environment, '- lightdash PR ') || contains(github.event.deployment.environment, '- lightdash-')) }}
runs-on: ubuntu-latest
outputs:
url: ${{ steps.deployment-url.outputs.url }}
steps:
- name: Get PR number
id: regex
uses: AsasInnab/regex-action@v1
with:
regex_pattern: '[0-9]+$'
regex_flags: 'gm'
search_string: ${{github.event.deployment.environment}}
- name: Get deployment url
id: deployment-url
run: echo "url=https://lightdash-pr-${{steps.regex.outputs.first_match}}.onrender.com" >> "$GITHUB_OUTPUT"
cli-tests:
runs-on: ubuntu-latest
needs: prepare-preview
strategy:
fail-fast: false
matrix:
dbt: ['1.3', '1.4', '1.5' ]
name: dbt ${{ matrix.dbt }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive # Download DBT submodule
## Install pip
- uses: actions/setup-python@v4
with:
python-version: '3.7.x'
- run: pip install dbt-postgres~=${{ matrix.dbt }}.0
## DBT seed
- name: Seed DBT
run: dbt seed --profiles-dir $PROFILES_DIR --project-dir $PROJECT_DIR --full-refresh
env:
PROJECT_DIR: "./examples/full-jaffle-shop-demo/dbt"
PROFILES_DIR: "./examples/full-jaffle-shop-demo/profiles"
PGHOST: ${{secrets.PGHOST}}
PGPASSWORD: ${{secrets.PGPASSWORD}}
PGPORT: 5432
PGUSER: postgres
PGDATABASE: postgres
SEED_SCHEMA: jaffle-${{strategy.job-index}}
## DBT run
- name: Run DBT
run: dbt run --profiles-dir $PROFILES_DIR --project-dir $PROJECT_DIR
env:
PROJECT_DIR: "./examples/full-jaffle-shop-demo/dbt"
PROFILES_DIR: "./examples/full-jaffle-shop-demo/profiles"
PGHOST: ${{secrets.PGHOST}}
PGPASSWORD: ${{secrets.PGPASSWORD}}
PGPORT: 5432
PGUSER: postgres
PGDATABASE: postgres
SEED_SCHEMA: jaffle-${{strategy.job-index}}
# Install packages
- uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'yarn'
- name: Install packages
run: yarn install --frozen-lockfile
# Build packages
- name: Build packages/common module
run: yarn common-build
- name: Build packages/warehouses module
run: yarn warehouses-build
- name: Build and install packages/cli module
run: cd packages/cli && yarn build && npm i -g
- name: Test lightdash version
run: |
lightdash_version=$(lightdash --version)
package_version=$(yarn workspace @lightdash/cli versions | grep '@lightdash/cli' | cut -d"'" -f 4)
if [ $package_version = $lightdash_version ]; then exit 0 ; else echo "Version mismatch"; exit 1; fi
# Run cypress tests
- name: Cypress run
uses: cypress-io/github-action@v5
with:
browser: chrome
project: ./packages/e2e
spec: packages/e2e/cypress/cli/**/*
config: 'baseUrl=${{needs.prepare-preview.outputs.url}}'
env:
CYPRESS_PGHOST: ${{secrets.PGHOST}}
CYPRESS_PGPASSWORD: ${{secrets.PGPASSWORD}}
CYPRESS_SEED_SCHEMA: jaffle-${{strategy.job-index}}