Skip to content

Commit

Permalink
Initial repo setup (#1)
Browse files Browse the repository at this point in the history
* refactor: Add initial files

* ci: Add basic GitHub template files

* feat: Added the check-api-for-breaking-changes.yml reusable workflow

* ci: Get pre-commit hooks to play nicely with each other

* feat: Added an action to run CodeQL analysis

* docs: Switch to tables for input documentation

* docs: Break up the readme with line breaks

* docs: Move each Action/Workflow document section into a separate markdown file

* docs: Update codeql-analysis readme

* feat: Added a workflow to validate Open Source community standards are being met in a repository

* docs: Update docs to just use the main branch as the hash
  • Loading branch information
nfelt14 authored Aug 15, 2024
1 parent ff285ad commit 33d6596
Show file tree
Hide file tree
Showing 24 changed files with 1,033 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Set default behavior to automatically normalize line endings.
* text=auto

# Force batch scripts to always use CRLF line endings so that if a repo is accessed
# in Windows via a file share from Linux, the scripts will work.
*.{cmd,[cC][mM][dD]} text eol=crlf
*.{bat,[bB][aA][tT]} text eol=crlf

# Force bash scripts to always use LF line endings so that if a repo is accessed
# in Unix via a file share from Windows, the scripts will work.
*.sh text eol=lf
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence they
# will be requested for review when someone opens a pull request.
* @tektronix/python-package-ci-cd-admins
43 changes: 43 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
name: Bug Report
description: File a bug report here
title: '[BUG]: '
labels: [bug]
body:
- type: markdown
attributes:
value: |
Thank you for taking the time to submit a bug report!
Please make sure there aren't any open/closed issues for this topic already.
- type: textarea
id: bug-description
attributes:
label: Description of the bug
description: Give us a brief description of what happened and what is the expected
behavior
validations:
required: true
- type: textarea
id: steps-to-reproduce
attributes:
label: Steps To Reproduce
description: Steps to reproduce the behavior.
placeholder: |
1. Go to '...'
2. Click on '...'
3. Scroll down to '...'
4. See error
validations:
required: true
- type: textarea
id: environment-information
attributes:
label: Environment Information
description: |
Please tell us about your environment:
- type: textarea
id: additional-information
attributes:
label: Additional Information
description: |-
Provide any additional information such as logs, screenshots, likes, scenarios in which the bug occurs so that it facilitates resolving the issue.
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: Feature Request
description: Request a new feature or enhancement
labels: [enhancement]
title: '[FEAT]: '
body:
- type: markdown
attributes:
value: |
Please make sure this feature request hasn't been already submitted by someone by looking through other open/closed issues
- type: textarea
id: description
attributes:
label: Description
description: Give us a brief description of the feature or enhancement you would
like
validations:
required: true
- type: textarea
id: additional-information
attributes:
label: Additional Information
description: Give us some additional information on the feature request like
proposed solutions, links, screenshots, etc.
32 changes: 32 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## Proposed changes

Please include a summary of the changes and any links to related issues. Please also include relevant motivation and context.

Addresses #\< fill in issue number here >

## Types of changes

What types of changes does your code introduce?
_Put an `x` in the boxes that apply_

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Functionality update (non-breaking change which updates or changes existing functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] CI/CD update (an update to the CI/CD workflows, scripts, and/or configurations)
- [ ] Documentation update (an update to enhance the user experience when reading through the docs)

## Checklist

_Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code._

- [ ] I have followed the guidelines in the [CONTRIBUTING](https://github.com/tektronix/tm_devices/blob/main/CONTRIBUTING.md) document
- [ ] I have signed the CLA
- [ ] I have checked to ensure there aren't other open [Pull Requests](https://github.com/tektronix/tm_devices/pulls) for the same update/change
- [ ] I have created (or updated) an [Issue](https://github.com/tektronix/tm_devices/issues) to track the status of this update/change and updated the link in this PR description (see above in the **Proposed changes** section) using the wording `Addresses #<issue_number>`
- [ ] I have performed a self-review of my code
- [ ] My code follows the style guidelines of this project
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] Basic linting passes locally with my changes
- [ ] I have added necessary documentation (if appropriate)
- [ ] I have updated the Changelog with a brief description of my changes
2 changes: 2 additions & 0 deletions .github/auto_assign.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
addAssignees: author
26 changes: 26 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
groups:
gh-actions-dependencies:
patterns: ['*']
labels: [gh-actions, dependencies]
commit-message:
prefix: gh-actions
include: scope
- package-ecosystem: pip
directory: /
schedule:
interval: weekly
versioning-strategy: increase-if-necessary
groups:
python-dependencies:
patterns: ['*']
labels: [python, dependencies]
commit-message:
prefix: python-deps
include: scope
27 changes: 27 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: CodeQL
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: 17 16 * * 4
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [python, javascript]
steps:
- name: Run CodeQL Analysis
uses: tektronix/python-package-ci-cd/actions/codeql-analysis@main
with:
language: ${{ matrix.language }}
codeql-queries: security-extended,security-and-quality
10 changes: 10 additions & 0 deletions .github/workflows/enforce-community-standards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: Enforce Open Source Community Standards
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
enforce-community-standards:
uses: tektronix/python-package-ci-cd/workflows/enforce-community-standards.yml@main
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ python_semantic_release_templates/.previous_changelog_for_template.md
python_semantic_release_templates/.previous_release_notes_for_template.md

# Environments
poetry.lock
.env*/
.venv*/
env*/
Expand Down
91 changes: 91 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
default_install_hook_types: [pre-commit, commit-msg]
default_stages: [pre-commit]
ci:
autofix_prs: false
autoupdate_schedule: quarterly
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 2c9f875913ee60ca25ce70243dc24d5b6415598c # frozen: v4.6.0
hooks:
- id: check-yaml
args: [--unsafe]
- id: check-toml
- id: check-json
- id: check-xml
- id: requirements-txt-fixer
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-case-conflict
- id: check-merge-conflict
- id: check-added-large-files
args: [--maxkb=3000, --enforce-all]
- id: forbid-submodules
- id: pretty-format-json
args: [--autofix, --indent=4]
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: a30f0d816e5062a67d87c8de753cfe499672b959 # frozen: v1.5.5
hooks:
- id: remove-tabs
- id: forbid-tabs
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: e2dde74d0702d15f4f43e4f4fb93e301b4bc1e30 # frozen: 0.29.1
hooks:
- id: check-dependabot
- id: check-github-actions
files: action\.(yml|yaml)
- id: check-github-workflows
args: [--verbose]
files: ^(\.github/workflows/[^/]+|workflows/[^/]+)$
- repo: https://github.com/commitizen-tools/commitizen
rev: d7e01aa9b0cfe3c1b732e66d523bbd0656221127 # frozen: v3.29.0
hooks:
- id: commitizen
stages: [commit-msg]
- repo: https://github.com/adamchainz/blacken-docs
rev: 4c97c4a0d921007af6fefae92d8447cfbf63720b # frozen: 1.18.0
hooks:
- id: blacken-docs
files: \.(rst|md|markdown|tex)$
additional_dependencies: [black==24.4.2] # This may need to be updated/removed in the future once ruff supports formatting python code blocks in markdown
args: [--line-length=100]
- repo: https://github.com/lyz-code/yamlfix
rev: 47039c9bf8039e81f092c9777a1bc8be32fb7870 # frozen: 1.16.0
hooks:
- id: yamlfix
- repo: https://github.com/executablebooks/mdformat
rev: 08fba30538869a440b5059de90af03e3502e35fb # frozen: 0.7.17
hooks:
- id: mdformat
args: [--number, --end-of-line, keep]
additional_dependencies:
- setuptools # This is required since Python 3.12 no longer installs setuptools by default in virtual environments
- mdformat-admon
- mdformat-beautysh
# - mdformat-config
- mdformat-footnote
- mdformat-frontmatter
- mdformat-gfm
- mdformat-gfm-alerts
- mdformat-mkdocs
- mdformat-shfmt
- mdformat-simple-breaks
- mdformat-tables
- mdformat-toc
- mdformat-web
- mdformat-wikilink
- repo: https://github.com/pappasam/toml-sort
rev: b9b6210da457c38122995e434b314f4c4a4a923e # frozen: v0.23.1
hooks:
- id: toml-sort-fix
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 718fbf5fa5fb8cbe6aeac32a863271695104cd5d # frozen: v0.6.0
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
- repo: https://github.com/PyCQA/docformatter
rev: dfefe062799848234b4cd60b04aa633c0608025e # frozen: v1.7.5
hooks:
- id: docformatter
additional_dependencies: [tomli]
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Changelog

The format is based on [Keep a Changelog](https://keepachangelog.com), and this
project adheres to [Semantic Versioning](https://semver.org).

Valid subsections within a version are:

- Added
- Changed
- Deprecated
- Removed
- Fixed
- Security

---

## Unreleased

Things to be included in the next release go here.
74 changes: 74 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and
expression, level of experience, education, socio-economic status, nationality,
personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, or to ban temporarily or permanently any
contributor for other behaviors that they deem inappropriate, threatening,
offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Reporting

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at: [email protected]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. You may not receive a
direct response to your email, but it is being reviewed. The project team is
obligated to maintain confidentiality with regard to the reporter of an
incident. Further details of specific enforcement policies may be posted
separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of leadership.

## Attribution

This Code of Conduct is adapted by Tektronix from the Contributor Covenant,
version 1.4, available at:
[contributor-covenant.org](https://www.contributor-covenant.org/version/1/4/code-of-conduct.html)
Loading

0 comments on commit 33d6596

Please sign in to comment.