Skip to content

Commit

Permalink
added basic CI/CD workflows (#12)
Browse files Browse the repository at this point in the history
* added basic CI/CD workflows

* removed unsupported python version 3.10

* deleted uneeded gitlab ci file

* linted code, added tox

* updated the tox testing/linting code

* added isort dev dep

Co-authored-by: Josh Lloyd <[email protected]>
Co-authored-by: Josh Lloyd <[email protected]>
  • Loading branch information
3 people authored Feb 18, 2022
1 parent 4b98c89 commit 67d4d62
Show file tree
Hide file tree
Showing 21 changed files with 705 additions and 277 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[email protected]
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CI (Testing/Linting) Workflow

on: [push]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install pipx
python -m pipx ensurepath
python -m pipx install poetry
# Force update PATH to include pipx executables
export PATH=$PATH:/root/.local/bin
# Create virtual environment and install dependencies
poetry env use python
poetry install --no-root
- name: Test and lint the code
run: |
poetry run tox -e py
34 changes: 34 additions & 0 deletions .github/workflows/releases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Publish New Releases to Pypi

on:
release:
types: [published]

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install pipx
python -m pipx ensurepath
python -m pipx install poetry
# Force update PATH to include pipx executables
export PATH=$PATH:/root/.local/bin
# Create virtual environment and install dependencies
poetry env use python
poetry install --no-root
- name: Build package
run: poetry build
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN_PROD }}
28 changes: 0 additions & 28 deletions .gitlab-ci.yml

This file was deleted.

11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ poetry install

### Create and Run Tests

Create tests within the `tap_rest_api_msdk/tests` subfolder and
Create tests within the `tests/` directory and
then run:

```bash
Expand All @@ -151,6 +151,15 @@ You can also test the `tap-rest-api-msdk` CLI interface directly using `poetry r
poetry run tap-rest-api-msdk --help
```

### Continuous Integration
Run through the full suite of tests and linters by running

```bash
poetry run tox -e py
```

These must pass in order for PR's to be merged.

### Testing with [Meltano](https://www.meltano.com)

_**Note:** This tap will work in any Singer environment and does not require Meltano.
Expand Down
35 changes: 35 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[mypy]
python_version = 3.8
warn_unused_configs = True
warn_return_any = True
exclude = tests

[mypy-singer.*]
# Library 'pipelinewise-singer-tools' does not have type hints:
# - https://github.com/transferwise/pipelinewise-singer-python/issues/25
ignore_missing_imports = True

[mypy-backoff.*]
# Frozen due to pipelinewise-singer-tools dependency
ignore_missing_imports = True

[mypy-bcrypt.*]
ignore_missing_imports = True

[mypy-joblib.*]
ignore_missing_imports = True

[mypy-pyarrow.*]
ignore_missing_imports = True

[mypy-pandas.*]
ignore_missing_imports = True

[mypy-jsonschema.*]
ignore_missing_imports = True

[mypy-jsonpath_ng.*]
ignore_missing_imports = True

[mypy-genson.*]
ignore_missing_imports = True
40 changes: 39 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ black = "^21.9b0"
pydocstyle = "^6.1.1"
mypy = "^0.910"
types-requests = "^2.25.8"
requests-mock = "^1.9.3"
isort = "^5.10.1"

[tool.black]
exclude = ".*simpleeval.*"

[tool.isort]
profile = "black"
multi_line_output = 3 # Vertical Hanging Indent
src_paths = "singer_sdk"
known_first_party = ["tests", "samples"]

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
1 change: 1 addition & 0 deletions tap_rest_api_msdk/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Package initialization."""
10 changes: 8 additions & 2 deletions tap_rest_api_msdk/client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""REST client handling, including RestApiStream base class."""

from pathlib import Path
from typing import Any

from singer_sdk.streams import RESTStream

Expand All @@ -11,6 +12,11 @@ class RestApiStream(RESTStream):
"""rest-api stream class."""

@property
def url_base(self) -> str:
"""Return the API URL root, configurable via tap settings."""
def url_base(self) -> Any:
"""Return the API URL root, configurable via tap settings.
Returns:
The base url for the api call.
"""
return self.config["api_url"]
Loading

0 comments on commit 67d4d62

Please sign in to comment.