Skip to content

Commit

Permalink
Merge pull request #50 from UsamaSadiq/usamasadiq/replace-trvis-with-…
Browse files Browse the repository at this point in the history
…github-ci

BOM-2932: Replace Travis with GitHub CI
  • Loading branch information
jazibhumayun authored Jan 12, 2022
2 parents bad1ea9 + da16eb3 commit 82e7c97
Show file tree
Hide file tree
Showing 20 changed files with 448 additions and 405 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Python CI

on:
push:
branches:
- main
pull_request:
branches:
- '**'

jobs:
run_tests:
name: Tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-20.04 ]
python-version: [ 3.8 ]
toxenv: [ py38,quality,docs ]

steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: setup python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install pip
run: pip install -r requirements/pip.txt

- name: Install dependencies
run: pip install -r requirements/ci.txt

- name: Run Tests
env:
TOXENV: ${{ matrix.toxenv }}
run: tox

- name: Run Coverage
if: matrix.toxenv=='py38'
uses: codecov/codecov-action@v2
with:
fail_ci_if_error: true
30 changes: 30 additions & 0 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Publish package to PyPI

on:
push:
tags:
- '*'

jobs:
push:
runs-on: ubuntu-20.04

steps:
- name: Checkout
uses: actions/checkout@v2
- name: setup python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install pip
run: pip install -r requirements/pip.txt

- name: Build package
run: python setup.py sdist bdist_wheel

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_UPLOAD_TOKEN }}
30 changes: 0 additions & 30 deletions .travis.yml

This file was deleted.

3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,14 @@ upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade
upgrade: ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in
pip install -r requirements/pip-tools.txt
# Make sure to compile files after any other files they include!
$(PIP_COMPILE) --allow-unsafe -o requirements/pip.txt requirements/pip.in
$(PIP_COMPILE) -o requirements/pip-tools.txt requirements/pip-tools.in
pip install -r requirements/pip-tools.txt
$(PIP_COMPILE) -o requirements/base.txt requirements/base.in
$(PIP_COMPILE) -o requirements/test.txt requirements/test.in
$(PIP_COMPILE) -o requirements/doc.txt requirements/doc.in
$(PIP_COMPILE) -o requirements/quality.txt requirements/quality.in
$(PIP_COMPILE) -o requirements/travis.txt requirements/travis.in
$(PIP_COMPILE) -o requirements/ci.txt requirements/ci.in
$(PIP_COMPILE) -o requirements/dev.txt requirements/dev.in

quality: ## check coding style with pycodestyle and pylint
Expand Down
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
dbt-schema-builder
=============================

|pypi-badge| |travis-badge| |codecov-badge| |pyversions-badge|
|pypi-badge| |ci-badge| |codecov-badge| |pyversions-badge|
|license-badge|

The Schema Builder tool is used to create dbt schema files, sql models, and
Expand Down Expand Up @@ -83,9 +83,9 @@ For more information about these options, see the `Getting Help`_ page.
:target: https://pypi.python.org/pypi/dbt-schema-builder/
:alt: PyPI

.. |travis-badge| image:: https://travis-ci.com/edx/dbt-schema-builder.svg?branch=main
:target: https://travis-ci.com/edx/dbt-schema-builder
:alt: Travis
.. |ci-badge| image:: https://github.com/edx/dbt-schema-builder/workflows/Python%20CI/badge.svg?branch=master
:target: https://github.com/edx/dbt-schema-builder/actions?query=workflow%3A%22Python+CI%22
:alt: GitHub CI

.. |codecov-badge| image:: https://codecov.io/github/edx/dbt-schema-builder/coverage.svg?branch=main
:target: https://codecov.io/github/edx/dbt-schema-builder?branch=main
Expand Down
8 changes: 5 additions & 3 deletions dbt_schema_builder/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
import re
import string

import dbt.utils
import yaml
from dbt.config import RuntimeConfig
from dbt.exceptions import DatabaseException
from dbt.logger import GLOBAL_LOGGER as logger
from dbt.logger import log_manager
from dbt.task.compile import CompileTask
from dbt.task.generate import get_adapter
import dbt.utils

from .app import App
from .queries import COLUMN_NAME_FILTER, GET_RELATIONS_BY_SCHEMA_AND_START_LETTER_SQL, GET_RELATIONS_BY_SCHEMA_SQL
Expand Down Expand Up @@ -86,7 +86,9 @@ def fetch_full_catalog(self, adapter, source_database, schema, banned_column_nam
) from e

catalog_data = [
dict(zip(catalog_table.column_names, map(dbt.utils._coerce_decimal, row)))
dict(
zip(catalog_table.column_names, map(dbt.utils._coerce_decimal, row)) # pylint: disable=protected-access
)
for row in catalog_table
]

Expand Down Expand Up @@ -133,7 +135,7 @@ def fetch_catalog_by_letter(self, adapter, source_database, schema, banned_colum
for letter in all_letters:
catalog_data.extend(
[
dict(zip(letter.column_names, map(_coerce_decimal, row)))
dict(zip(letter.column_names, map(_coerce_decimal, row))) # pylint: disable=undefined-variable
for row in letter
]
)
Expand Down
Loading

0 comments on commit 82e7c97

Please sign in to comment.