Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Add build workflow #363

Merged
merged 2 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build

on:
push:

permissions:
contents: write
id-token: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: hynek/build-and-inspect-python-package@v2

# publish:
# runs-on: ubuntu-latest
# needs: build
# environment:
# name: publishing
# url: https://pypi.org/project/tap-stackexchange/
# if: startsWith(github.ref, 'refs/tags/')
# steps:
# - uses: actions/download-artifact@v4
# with:
# name: Packages
# path: dist
# - name: Upload wheel to release
# uses: svenstaro/upload-release-action@v2
# with:
# file: dist/*.whl
# tag: ${{ github.ref }}
# overwrite: true
# file_glob: true

# - name: Publish
# uses: pypa/[email protected]
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
PIP_CONSTRAINT: .github/workflows/constraints.txt
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- name: Checkout code
Expand All @@ -39,8 +39,8 @@ jobs:
pipx install tox
tox --version

- name: Run lint command from tox.ini
- name: Run tests
env:
TAP_STACKEXCHANGE_KEY: ${{ secrets.TAP_STACKEXCHANGE_KEY }}
run: |
tox -e pytest
tox -e py$(echo ${{ matrix.python-version }} | tr -d .)
6 changes: 1 addition & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ repos:
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]

- repo: https://github.com/psf/black
rev: 23.12.1
hooks:
- id: black
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
Expand Down
765 changes: 431 additions & 334 deletions poetry.lock

Large diffs are not rendered by default.

32 changes: 19 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,54 @@ name = "tap-stackexchange"
version = "0.0.1"
description = "`tap-stackexchange` is a Singer tap for StackExchange, built with the Meltano SDK for Singer Taps."
authors = ["Edgar Ramírez-Mondragón <[email protected]>"]
classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
keywords = [
"ELT",
"StackExchange",
]
license = "Apache 2.0"
license = "Apache-2.0"
readme = "README.md"

[tool.poetry.dependencies]
python = ">=3.8,<4"
pyrate-limiter = "==3.*"
requests-cache = "==1.*"
python = ">=3.8"
pyrate-limiter = { version = "==3.*", python = "<4" }
requests-cache = { version = "==1.*", python = "<4" }
singer-sdk = "0.34.*"

[tool.poetry.group.dev.dependencies]
pytest-httpserver = "^1.0.8"
pytest-httpserver = { version = "^1.0.8", python = "<4" }
singer-sdk = {extras = ["testing"], version = ">=0.23.0"}

[tool.black]
line-length = 88

[tool.pytest.ini_options]
addopts = "-vvv"

[[tool.mypy.overrides]]
module = [
"ratelimit",
]
ignore_missing_imports = true

[build-system]
requires = ["poetry-core>=1.0.8"]
requires = ["poetry-core==1.8.1"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.scripts]
# CLI declaration
tap-stackexchange = 'tap_stackexchange.tap:TapStackExchange.cli'

[tool.ruff]
line-length = 88
target-version = "py38"

[tool.ruff.lint]
ignore = [
"ANN101", # missing-type-self
]
select = ["ALL"]
target-version = "py38"

[tool.ruff.flake8-annotations]
allow-star-arg-any = true
Expand Down
2 changes: 1 addition & 1 deletion tap_stackexchange/tap.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class TapStackExchange(Tap):
th.Property(
"tags",
th.ArrayType(th.StringType),
default=[],
default=["LimeSurvey"],
description="Question tags",
),
th.Property(
Expand Down
17 changes: 7 additions & 10 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
# This file can be used to customize tox tests as well as other test frameworks like flake8 and mypy

[tox]
envlist = py310
isolated_build = true
requires =
tox>=4
envlist = py{38,39,310,311,312}

[testenv]
allowlist_externals = poetry

[testenv:pytest]
# Run the python tests.
# To execute, run `tox -e pytest`
passenv = TAP_STACKEXCHANGE_*
envlist = py38, py39, py310, py311
deps =
pytest-httpserver
singer-sdk[testing]
commands =
poetry install -v
poetry run pytest
pytest

[flake8]
select = DAR
Expand Down