Skip to content

Commit

Permalink
feat(templates): Add an optional Dependabot file to projects generate…
Browse files Browse the repository at this point in the history
…d from templates (#1728)

* feat(templates): Add an optional Dependabot file to projects generated from templates

* Update replay files

* Move .github dir

* Add pre-commit checks for workflow and dependabot files

* Add replay file for GitHub CI files

* Use existing replay file
  • Loading branch information
edgarrmondragon authored May 24, 2023
1 parent 44b6ae9 commit 723112d
Show file tree
Hide file tree
Showing 20 changed files with 114 additions and 29 deletions.
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ repos:
tests/core/test_simpleeval.py
)$
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.23.0
hooks:
- id: check-dependabot
- id: check-github-workflows
- id: check-readthedocs

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.269
hooks:
Expand Down
2 changes: 1 addition & 1 deletion cookiecutter/tap-template/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"JWT",
"Custom or N/A"
],
"include_cicd_sample_template": ["GitHub", "None (Skip)"],
"include_ci_files": ["GitHub", "None (Skip)"],
"license": ["Apache-2.0"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,6 @@ name: Test {{cookiecutter.tap_id}}
on: [push]

jobs:
linting:
runs-on: ubuntu-latest
strategy:
matrix:
# Only lint using the primary version used for dev
python-version: ["3.9"]
steps:
- uses: actions/checkout@v3
- name: Set up Python {{ '${{ matrix.python-version }}' }}
uses: actions/setup-python@v4
with:
python-version: {{ '${{ matrix.python-version }}' }}
- name: Install pipx and Poetry
run: |
pip install pipx poetry
- name: Run lint command from tox.ini
run: |
pipx run tox -e lint

pytest:
runs-on: ubuntu-latest
env:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix: "chore(deps): "
prefix-development: "chore(deps-dev): "
- package-ecosystem: pip
directory: "/.github/workflows"
schedule:
interval: daily
commit-message:
prefix: "ci: "
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: "weekly"
commit-message:
prefix: "ci: "
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.23.0
hooks:
- id: check-dependabot
- id: check-github-workflows

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.269
hooks:
Expand Down
1 change: 1 addition & 0 deletions cookiecutter/target-template/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"library_name": "{{ cookiecutter.target_id.replace('-', '_') }}",
"variant": "None (Skip)",
"serialization_method": ["Per record", "Per batch", "SQL"],
"include_ci_files": ["GitHub", "None (Skip)"],
"license": ["Apache-2.0"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
### A CI workflow template that runs linting and python testing
### TODO: Modify as needed or as desired.

name: Test {{cookiecutter.tap_id}}

on: [push]

jobs:
pytest:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: {{ '${{secrets.GITHUB_TOKEN}}' }}
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python {{ '${{ matrix.python-version }}' }}
uses: actions/setup-python@v4
with:
python-version: {{ '${{ matrix.python-version }}' }}
- name: Install Poetry
run: |
pip install poetry
- name: Install dependencies
run: |
poetry install
- name: Test with pytest
run: |
poetry run pytest
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix: "chore(deps): "
prefix-development: "chore(deps-dev): "
- package-ecosystem: pip
directory: "/.github/workflows"
schedule:
interval: daily
commit-message:
prefix: "ci: "
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: "weekly"
commit-message:
prefix: "ci: "
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.23.0
hooks:
- id: check-dependabot
- id: check-github-workflows

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.269
hooks:
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/cookiecutters/tap-graphql-jwt.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"variant": "None (Skip)",
"stream_type": "GraphQL",
"auth_method": "JWT",
"include_cicd_sample_template": "None (Skip)",
"include_ci_files": "None (Skip)",
"license": "Apache-2.0",
"_template": "../tap-template/",
"_output_dir": "."
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/cookiecutters/tap-other-custom.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"variant": "None (Skip)",
"stream_type": "Other",
"auth_method": "Custom or N/A",
"include_cicd_sample_template": "None (Skip)",
"include_ci_files": "None (Skip)",
"license": "Apache-2.0",
"_template": "../tap-template/",
"_output_dir": "."
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/cookiecutters/tap-rest-api_key-github.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"variant": "None (Skip)",
"stream_type": "REST",
"auth_method": "API Key",
"include_cicd_sample_template": "GitHub",
"include_ci_files": "GitHub",
"license": "Apache-2.0",
"_template": "../tap-template/",
"_output_dir": "."
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/cookiecutters/tap-rest-basic_auth.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"variant": "None (Skip)",
"stream_type": "REST",
"auth_method": "Basic Auth",
"include_cicd_sample_template": "None (Skip)",
"include_ci_files": "None (Skip)",
"license": "Apache-2.0",
"_template": "../tap-template/",
"_output_dir": "."
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/cookiecutters/tap-rest-bearer_token.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"variant": "None (Skip)",
"stream_type": "REST",
"auth_method": "Bearer Token",
"include_cicd_sample_template": "None (Skip)",
"include_ci_files": "None (Skip)",
"license": "Apache-2.0",
"_template": "../tap-template/",
"_output_dir": "."
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/cookiecutters/tap-rest-custom.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"variant": "None (Skip)",
"stream_type": "REST",
"auth_method": "Custom or N/A",
"include_cicd_sample_template": "None (Skip)",
"include_ci_files": "None (Skip)",
"license": "Apache-2.0",
"_template": "../tap-template/",
"_output_dir": "."
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/cookiecutters/tap-rest-jwt.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"variant": "None (Skip)",
"stream_type": "REST",
"auth_method": "JWT",
"include_cicd_sample_template": "None (Skip)",
"include_ci_files": "None (Skip)",
"license": "Apache-2.0",
"_template": "../tap-template/",
"_output_dir": "."
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/cookiecutters/tap-rest-oauth2.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"variant": "None (Skip)",
"stream_type": "REST",
"auth_method": "OAuth2",
"include_cicd_sample_template": "None (Skip)",
"include_ci_files": "None (Skip)",
"license": "Apache-2.0",
"_template": "../tap-template/",
"_output_dir": "."
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/cookiecutters/tap-sql-custom.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"variant": "None (Skip)",
"stream_type": "SQL",
"auth_method": "Custom or N/A",
"include_cicd_sample_template": "None (Skip)",
"include_ci_files": "None (Skip)",
"license": "Apache-2.0",
"_template": "../tap-template/",
"_output_dir": "."
Expand Down
1 change: 1 addition & 0 deletions e2e-tests/cookiecutters/target-per_record.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"library_name": "target_per_record",
"variant": "None (Skip)",
"serialization_method": "Per record",
"include_ci_files": "None (Skip)",
"license": "Apache-2.0",
"_template": "./sdk/cookiecutter/target-template",
"_output_dir": "."
Expand Down
1 change: 1 addition & 0 deletions e2e-tests/cookiecutters/target-sql.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"library_name": "target_sql",
"variant": "None (Skip)",
"serialization_method": "SQL",
"include_ci_files": "None (Skip)",
"license": "Apache-2.0",
"_template": "./sdk/cookiecutter/target-template",
"_output_dir": "."
Expand Down

0 comments on commit 723112d

Please # to comment.