forked from sqlfluff/sqlfluff
-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (76 loc) · 2.25 KB
/
ci-test-dbt.yml
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
#############################
## GitHub Actions CI Tests ##
#############################
#
# This is a reusable workflow to make CI tests more modular.
# See: https://docs.github.com/en/actions/using-workflows/reusing-workflows
#
# Called by ci-tests.yml
# This one does the dbt tests
#
name: Modular SQLFluff dbt test workflow
on:
workflow_call:
inputs:
python-version:
required: true
type: string
dbt-version:
required: true
type: string
coverage:
required: false
type: boolean
default: false
secrets:
gh_token:
required: true
jobs:
modular-python-test:
name: py${{ inputs.python-version }}-${{ inputs.dbt-version }}
runs-on: ubuntu-latest
env:
FORCE_COLOR: 1
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
POSTGRES_PASSWORD: password
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
cache: 'pip'
cache-dependency-path: |
setup.cfg
requirements_dev.txt
- name: Install dependencies
run: pip install tox
- name: Run the tests (with coverage)
if: ${{ inputs.coverage }}
run: tox -e ${{ inputs.dbt-version }} -- --cov=sqlfluff_templater_dbt plugins/sqlfluff-templater-dbt
- name: Run the tests (without coverage)
if: ${{ !inputs.coverage }}
run: tox -e ${{ inputs.dbt-version }} -- plugins/sqlfluff-templater-dbt
- name: Upload coverage data (github)
uses: actions/upload-artifact@v4
if: ${{ inputs.coverage }}
with:
name: coverage-data-py${{ inputs.python-version }}-${{ inputs.dbt-version }}
path: ".coverage.*"
if-no-files-found: ignore
include-hidden-files: true