Skip to content

Commit

Permalink
chore(repo): update tooling and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
looztra committed Aug 23, 2024
1 parent 2b3af87 commit 65eb28d
Show file tree
Hide file tree
Showing 17 changed files with 423 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
max_line_length = 120
trim_trailing_whitespace = true

# 4 space indentation
# don't check for max_line_length, rely on pylint
[*.py]
indent_style = space
indent_size = 4
max_line_length = unset

[Makefile]
indent_style = tab
max_line_length = unset

[*.mk]
indent_style = tab
max_line_length = unset

[*.{yml,yaml}]
indent_size = 2
indent_style = space
max_line_length = unset

# Fix for json files
[*.json]
max_line_length = unset

[*.md]
trim_trailing_whitespace = false
max_line_length = unset
indent_size = unset

[LICENSE]
max_line_length = unset
indent_style = unset
indent_size = unset

[*.txt]
max_line_length = unset

[*.{sh,bats,bash}]
max_line_length = unset
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @looztra
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Bug report
about: Create a report to help us improve
title: ""
labels: bug
assignees: ""
---

## Describe the bug

<!-- A clear and concise description of what the bug is. -->

## Steps to reproduce

<!-- Steps to reproduce the behavior: -->

## Expected behavior

<!-- A clear and concise description of what you expected to happen. -->

## Screenshots

<!-- If applicable, add screenshots to help explain your problem. -->

## Additional context

<!-- Add any other context about the problem here. -->
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Feature request
about: Suggest an idea for this project
title: ""
labels: enhancement
assignees: ""
---

## Is your feature request related to a problem? Please describe.

<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->

## Describe the solution you'd like

<!-- A clear and concise description of what you want to happen. -->

## Describe alternatives you've considered

<!-- A clear and concise description of any alternative solutions or features you've considered. -->

## Additional context

<!-- Add any other context or screenshots about the feature request here. -->
33 changes: 33 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Description

## What this PR Provides

<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Documentation
- [ ] Chore (gha, tools, pre-commit)
- [ ] Tests

## Usage examples

<!--- Provide examples of intended usage -->

## How Has This Been Tested?

<!--- Please describe in detail how you tested your changes. -->

## Checklist

<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->

- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
79 changes: 79 additions & 0 deletions .github/workflows/code_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
name: Code checks

on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master
workflow_dispatch:

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-checks
cancel-in-progress: true

jobs:
plugin_test:
strategy:
matrix:
os:
- macos-latest
- ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- name: asdf_plugin_test default
uses: asdf-vm/actions/plugin-test@v3
with:
command: k9s --version

- name: asdf_plugin_test 0.13.0
uses: asdf-vm/actions/plugin-test@v3
with:
command: k9s --version
version: 0.13.0

- name: asdf_plugin_test 0.24.2
uses: asdf-vm/actions/plugin-test@v3
with:
command: k9s --version
version: 0.24.2

- name: asdf_plugin_test 0.26.0
uses: asdf-vm/actions/plugin-test@v3
with:
command: k9s --version
version: 0.26.0

- name: asdf_plugin_test 0.27.0
uses: asdf-vm/actions/plugin-test@v3
with:
command: k9s --version
version: 0.27.0

lint_and_tests:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Tools with asdf
uses: asdf-vm/actions/install@v3

- uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-3|${{ hashFiles('.pre-commit-config.yaml') }}

- name: Run pre-commit checks
shell: bash
run: |
pre-commit run --all-files
- name: Test plugin with bats
run: |
asdf plugin-add k9s "${GITHUB_WORKSPACE}"
bats test
41 changes: 41 additions & 0 deletions .github/workflows/lint_pr_title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
name: Semantic Pull Request checks

on:
pull_request_target:
types:
- opened
- edited
- synchronize

jobs:
validate-pr-title:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
id: lint_pr_title
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
requireScope: true
- uses: marocchino/sticky-pull-request-comment@v2
# When the previous steps fails, the workflow would stop. By adding this
# condition you can continue the execution with the populated error message.
if: always() && (steps.lint_pr_title.outputs.error_message != null)
with:
header: pr-title-lint-error
message: |
Hey dear contributors ! 👋🏼
We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted.
Error details:
```
${{ steps.lint_pr_title.outputs.error_message }}
```
# Delete a previous comment when the issue has been resolved
- if: ${{ steps.lint_pr_title.outputs.error_message == null }}
uses: marocchino/sticky-pull-request-comment@v2
with:
header: pr-title-lint-error
delete: true
21 changes: 21 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: Release

on:
push:
branches:
- main
- master

permissions:
contents: write
pull-requests: write

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: GoogleCloudPlatform/release-please-action@v4
with:
release-type: simple
token: ${{ secrets.RELEASE_PLEASE_TOKEN }}
24 changes: 24 additions & 0 deletions .github/workflows/workflows_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: Worflows checks

on:
push:
branches:
- main
- master
pull_request:

jobs:
repo-checks:
name: Check the repository github actions workflows
timeout-minutes: 10
runs-on: ubuntu-latest

steps:
- name: Checkout current branch
uses: actions/checkout@v4

- name: Run actionlint
uses: reviewdog/action-actionlint@v1
with:
fail_on_error: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vscode/
5 changes: 5 additions & 0 deletions .markdownlint-cli2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
globs:
- '**/*.md'
- '!.venv*/**/*.md'
- '!CHANGELOG.md'
20 changes: 20 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
# For a list of all rules, see here: https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md

# Default state for all rules
default: true

# MD013/line-length - Line length
MD013: false

# MD024/Multiple headings with the same content
MD024: false

# MD026/no-trailing-punctuation - Trailing punctuation in heading
MD026: false

# MD033/no-inline-html - Inline HTML
MD033: false

# MD037/Spaces inside emphasis markers
MD037: false
Loading

0 comments on commit 65eb28d

Please sign in to comment.