Skip to content

Commit

Permalink
Use docker for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Kayrnt committed Dec 15, 2024
1 parent 48985b6 commit b1a081f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
30 changes: 19 additions & 11 deletions .github/workflows/pr_lint_models.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,6 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }} # Check out the code of the PR

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install Python packages
run: python -m pip install dbt-bigquery~=1.8.2 sqlfluff-templater-dbt

- name: Write keyfile if secret is defined
run: |
if [ -z "${{ secrets.DBT_ENV_SECRET_BIGQUERY_TEST_SERVICE_ACCOUNT }}" ]; then
Expand All @@ -52,10 +44,20 @@ jobs:
fi
- name: Test database connection
run: dbt debug
run: |
docker run -ti \
-v $(pwd)/integration_tests:/usr/app/ \
-v $(pwd)/keyfile.json:/usr/app/keyfile.json \
dbt-bigquery-monitoring-base:main \
-c "dbt debug"
- name: Install dbt packages
run: dbt deps
run: |
docker run -ti \
-v $(pwd)/integration_tests:/usr/app/ \
-v $(pwd)/keyfile.json:/usr/app/keyfile.json \
dbt-bigquery-monitoring-base:main \
-c "dbt deps"
- name: Get changed files
id: get_file_changes
Expand Down Expand Up @@ -86,7 +88,13 @@ jobs:
if: steps.get_files_to_lint.outputs.lintees != ''
shell: bash -l {0}
run: |
sqlfluff lint --format github-annotation --annotation-level failure --nofail ${{ steps.get_files_to_lint.outputs.lintees }} > annotations.json
touch annotations.json && \
docker run -ti \
-v $(pwd)/integration_tests:/usr/app/ \
-v $(pwd)/keyfile.json:/usr/app/keyfile.json \
-v rw:$(pwd)/annotations.json:/usr/app/annotations.json \
dbt-bigquery-monitoring-base:main \
-c "sqlfluff lint --format github-annotation --annotation-level failure --nofail ${{ steps.get_files_to_lint.outputs.lintees }} > annotations.json"
sed -i '/^\[/!d' annotations.json # see https://github.com/sqlfluff/sqlfluff/issues/2244
- name: Annotate
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ RUN pip install --no-cache-dir \
&& rm -rf /usr/local/share/doc /root/.cache/

WORKDIR /usr/app/
ENTRYPOINT ["zsh"]
ENTRYPOINT ["bash"]
2 changes: 1 addition & 1 deletion packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ packages:
- package: dbt-labs/dbt_utils
version: [">=0.8.0", "<2.0.0"]
# - package: dbt-labs/codegen
# version: 0.12.1
# version: 0.13.1

0 comments on commit b1a081f

Please sign in to comment.