Skip to content

Commit

Permalink
ci: Add build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Jan 10, 2024
1 parent 25c4a1a commit b0a07e1
Show file tree
Hide file tree
Showing 7 changed files with 501 additions and 366 deletions.
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.

31 changes: 18 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,53 @@ 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"

[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

0 comments on commit b0a07e1

Please sign in to comment.