Skip to content

Commit

Permalink
setup project, add initial set of workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
ITProKyle committed Jul 22, 2024
1 parent 8869c10 commit e02e193
Show file tree
Hide file tree
Showing 20 changed files with 2,017 additions and 1 deletion.
64 changes: 64 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# https://github.com/release-drafter/release-drafter
autolabeler: # cspell:ignore autolabeler
- label: bug
branch: [/^(bug|bugfix|fix|hotfix)\/.*/]
- label: changelog:skip
branch: [/^(dependabot)\/.*/, /^pre-commit-ci-update-config/, /^renovate\/.*lockfile/]
- label: dependencies
branch: [/^(depend|dependabot|renovate)\/.*/]
- label: documentation
branch: [/^(docs)\/.*/]
- label: feature
branch: [/^(enhancement|feat|feature)\/.*/]
- label: github_actions
files:
- .github/workflows/*.yml
- label: maintenance
branch: [/^(chore|maint|maintain|maintenance)\/.*/]
- label: changelog:patch
branch: [/^(bug|bugfix|fix|hotfix)\/.*/]
- label: release
branch: [/^(release)\/.*/]
categories:
- title: 🚀 Features
labels:
- feature
- enhancement
- title: 🐛 Bug Fixes
labels:
- bug
- title: 🧶 Dependencies
labels:
- dependencies
- title: 📖 Doc Updates
labels:
- documentation
- title: 🧰 Maintenance
label: maintenance
category-template: >-
### $TITLE
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
commitish: master # cspell:ignore commitish
exclude-contributors:
- dependabot
exclude-labels:
- changelog:skip
- release
name-template: v$RESOLVED_VERSION
sort-direction: ascending
tag-template: v$RESOLVED_VERSION
template: |
## What Changed
$CHANGES
version-resolver:
major:
labels:
- changelog:major
minor:
labels:
- changelog:minor
patch:
labels:
- changelog:patch
default: patch
6 changes: 6 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"github>finleyfamily/renovate"
]
}
11 changes: 11 additions & 0 deletions .github/workflows/local.on-pr-target.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: PR Target

on:
pull_request_target:
types:
- opened
- reopened

jobs:
assign-author-to-pr:
uses: ./workflows/.github/workflows/pr.assign-author.yml
16 changes: 16 additions & 0 deletions .github/workflows/local.on-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Push

on:
pull_request: # any pull request
push:
branches:
- master

env:
NODE_VERSION: '20'

jobs:
spellcheck:
uses: ./.github/workflows/spellcheck.yml
with:
node-version: ${{ env.NODE_VERSION }}
12 changes: 12 additions & 0 deletions .github/workflows/local.release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Release Drafter

on:
push:
branches:
- master

jobs:
release-drafter:
permissions:
contents: write
uses: ./workflows/.github/workflows/release-drafter.yml
12 changes: 12 additions & 0 deletions .github/workflows/pr.assign-author.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Assign Author To PR

on:
workflow_call:

jobs:
assign-author-to-pr:
name: Assign Author to PR
if: ${{ !endswith(github.actor, '[bot]') }}
runs-on: ubuntu-latest
steps:
- uses: technote-space/assign-author@v1 # cspell:ignore technote
15 changes: 15 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Release Drafter

on:
workflow_call:

jobs:
release-drafter:
name: Release Drafter
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v6.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20 changes: 20 additions & 0 deletions .github/workflows/spellcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Spellcheck

on:
workflow_call:
inputs:
node-version:
required: false
type: string

jobs:
spellcheck:
name: Spellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
- run: make setup-npm
- run: make spellcheck
3 changes: 3 additions & 0 deletions .markdownlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
default: true
MD013: false # line-length
MD024: false # no-duplicate-heading/no-duplicate-header
61 changes: 61 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
default_language_version:
node: system

exclude: |
(?x)^(
(.*/)?package-lock\.json|
(.*/)?poetry\.lock
)$
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-json
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: file-contents-sorter
args: [--unique]
files: |
(?x)^(
\.dockerignore|
\.gitignore
)$
- id: pretty-format-json
args: [--autofix, --indent, '4']
exclude: |
(?x)^(
(.*)?(cdk|package|tsconfig|tslint)\.json
)$
- id: pretty-format-json
args: [--autofix, --indent, '2']
files: |
(?x)^(
(.*)?(cdk|package|tsconfig|tslint)\.json
)$
- id: trailing-whitespace
- id: mixed-line-ending
args: [--fix=lf]
- repo: https://github.com/pappasam/toml-sort
rev: v0.23.1
hooks:
- id: toml-sort-fix
- repo: https://github.com/ITProKyle/pre-commit-hook-yamlfmt
rev: v0.3.0
hooks:
- id: yamlfmt
args: [--mapping, '2', --offset, '2', --sequence, '4']
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.17
hooks:
- id: mdformat
additional_dependencies:
- mdformat-frontmatter
- mdformat-gfm
- mdformat-toc
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.41.0
hooks:
- id: markdownlint
9 changes: 9 additions & 0 deletions .vscode/cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"allowCompoundWords": true,
"import": [
"@itprokyle/cspell-dict/cspell-ext.json"
],
"maxNumberOfProblems": 100,
"version": "0.2",
"words": []
}
14 changes: 14 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"recommendations": [
"DavidAnson.vscode-markdownlint",
"charliermarsh.ruff",
"editorconfig.editorconfig",
"lextudio.restructuredtext",
"ms-python.black-formatter",
"ms-python.python",
"ms-python.vscode-pylance",
"redhat.vscode-yaml",
"streetsidesoftware.code-spell-checker",
"tamasfe.even-better-toml"
]
}
21 changes: 21 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"[python]": {
"editor.codeActionsOnSave": {
"source.fixAll.ruff": "explicit",
"source.organizeImports": "always"
},
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.detectIndentation": false,
"editor.formatOnSave": true,
"editor.insertSpaces": true,
"editor.rulers": [
81,
88,
100
],
"editor.tabSize": 4
},
"cSpell.enabled": true,
"files.insertFinalNewline": true,
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python"
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2024 Kyle Finley

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
44 changes: 44 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
CI := $(if $(CI),yes,no)
SHELL := /bin/bash

ifeq ($(CI), yes)
POETRY_OPTS = "-v"
PRE_COMMIT_OPTS = --show-diff-on-failure --verbose
endif

help: ## show this message
@awk \
'BEGIN {FS = ":.*##"; printf "\nUsage: make \033[36m<target>\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-30s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) }' \
$(MAKEFILE_LIST)

run-pre-commit: ## run pre-commit for all files
@poetry run pre-commit run $(PRE_COMMIT_OPTS) \
--all-files \
--color always

setup: setup-poetry setup-pre-commit setup-npm ## setup development environment

setup-npm: ## install node dependencies with npm
@npm ci

setup-poetry: ## setup python virtual environment
@if [[ -d .venv ]]; then \
poetry run python -m pip --version >/dev/null 2>&1 || rm -rf ./.venv/* ./.venv/.*; \
fi
@poetry check
@poetry install $(POETRY_OPTS) --sync

setup-pre-commit: ## install pre-commit git hooks
@poetry run pre-commit install

spellcheck: ## run cspell
@echo "Running cSpell to checking spelling..."
@npm exec --no -- cspell lint . \
--color \
--config .vscode/cspell.json \
--dot \
--gitignore \
--must-find-files \
--no-progress \
--relative \
--show-context
Loading

0 comments on commit e02e193

Please sign in to comment.