Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ks6088ts authored Aug 1, 2024
0 parents commit 8ab468c
Show file tree
Hide file tree
Showing 24 changed files with 1,285 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "Python 3.10",
"image": "mcr.microsoft.com/devcontainers/python:3.10-bookworm",
"customizations": {
"vscode": {
"settings": {
"python.defaultInterpreterPath": "/usr/local/bin/python",
"python.testing.pytestEnabled": true,
"python.testing.unittestEnabled": false,
"files.exclude": {
".coverage": true,
".pytest_cache": true,
"__pycache__": true
}
},
"extensions": [
"ms-python.python",
"charliermarsh.ruff",
"ms-python.black-formatter"
]
}
},
"postCreateCommand": "pipx install poetry && make install-deps-dev",
"remoteUser": "vscode"
}
13 changes: 13 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.git
.github
.venv
*.pyc
*.env
.coverage
.devcontainer
.gitignore
.pre-commit-config.yaml
.pytest_cache
.ruff_cache
__pycache__
tests
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @ks6088ts
22 changes: 22 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Contributor Code of Conduct

As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.

We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality.

Examples of unacceptable behavior by participants include:

- The use of sexualized language or imagery
- Personal attacks
- Trolling or insulting/derogatory comments
- Public or private harassment
- Publishing other's private information, such as physical or electronic addresses, without explicit permission
- Other unethical or unprofessional conduct.

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. By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team.

This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.

This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)
69 changes: 69 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Contributing to this project

This project welcomes contributions and suggestions.

- [Code of Conduct](#coc)
- [Issues and Bugs](#issue)
- [Feature Requests](#feature)
- [Submission Guidelines](#submit)

## <a name="coc"></a> Code of Conduct

Help us keep this project open and inclusive. Please read and follow our [Code of Conduct](./CODE_OF_CONDUCT.md).

## <a name="issue"></a> Found an Issue?

If you find a bug in the source code or a mistake in the documentation, you can help us by
[submitting an issue](#submit-issue) to the GitHub Repository. Even better, you can
[submit a Pull Request](#submit-pr) with a fix.

## <a name="feature"></a> Want a Feature?

You can _request_ a new feature by [submitting an issue](#submit-issue) to the GitHub
Repository. If you would like to _implement_ a new feature, please submit an issue with
a proposal for your work first, to be sure that we can use it.

- **Small Features** can be crafted and directly [submitted as a Pull Request](#submit-pr).

## <a name="submit"></a> Submission Guidelines

### <a name="submit-issue"></a> Submitting an Issue

Before you submit an issue, search the archive, maybe your question was already answered.

If your issue appears to be a bug, and hasn't been reported, open a new issue.
Help us to maximize the effort we can spend fixing issues and adding new
features, by not reporting duplicate issues. Providing the following information will increase the chances of your issue being dealt with quickly:

- **Overview of the Issue** - if an error is being thrown a non-minified stack trace helps
- **Version** - what version is affected (e.g. 0.1.2)
- **Motivation for or Use Case** - explain what are you trying to do and why the current behavior is a bug for you
- **Browsers and Operating System** - is this a problem with all browsers?
- **Reproduce the Error** - provide a live example or a unambiguous set of steps
- **Related Issues** - has a similar issue been reported before?
- **Suggest a Fix** - if you can't fix the bug yourself, perhaps you can point to what might be
causing the problem (line of code or commit)

You can file new issues by providing the above information at the corresponding repository's issues link: https://github.com/ks6088ts/template-python/issues/new.

### <a name="submit-pr"></a> Submitting a Pull Request (PR)

Before you submit your Pull Request (PR) consider the following guidelines:

- Search the repository https://github.com/ks6088ts/template-python/pulls for an open or closed PR that relates to your submission. You don't want to duplicate effort.

- Make your changes in a new git fork
- Commit your changes using a descriptive commit message
- Push your fork to GitHub
- In GitHub, create a pull request
- If we suggest changes then:

- Make the required updates.
- Rebase your fork and force push to your GitHub repository (this will update your Pull Request):

```shell
git rebase main -i
git push -f
```

That's it! Thank you for your contribution!
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug Report
about: Create a bug report
title: Bug Report
labels: bug
assignees: ks6088ts
---

<!-- IF SUFFICIENT INFORMATION IS NOT PROVIDED VIA THE FOLLOWING TEMPLATE THE ISSUE MIGHT BE CLOSED WITHOUT FURTHER CONSIDERATION OR INVESTIGATION -->

## System Information

- OS and Version:
- Software Version:

## Expected Behavior

<!-- Tell us what should happen -->

## Current Behavior

<!-- Tell us what happens instead of the expected behavior -->

## Steps to Reproduce

<!-- Provide a link to a live example, or an specific set of steps to -->

1.
1.
1.

## Logs

<!-- Provide logs if possible -->

## Additional Information

<!-- Any additional information that might be useful -->
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Support Request
url: https://github.com/ks6088ts/template-python/issues
about: Create an issue for support request or question relating to this repository
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE/enhancement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: Enhancement Issue
about: Create an enhancement issue
title: Enhancement Issue
labels: feature
assignees: ks6088ts
---

## What would you like to be added?

<!-- Tell us what you would like to be added -->

## Why is this needed?

<!-- Tell us why this is needed -->
64 changes: 64 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
## What this PR does / why we need it

<!-- Describe the intention of the changes being proposed. What problem does it solve or functionality does it add? -->

- ...

## Which issue(s) this PR fixes:

<!--
Automatically closes linked issue when PR is merged.
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->

Fixes #

## Does this introduce a breaking change?

<!-- Mark one with an "x". -->

```
[ ] Yes
[ ] No
```

## Pull Request Type

What kind of change does this Pull Request introduce?

<!-- Please check the one that applies to this PR using "x". -->

```
[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:
```

## How to Test

- Get the code

```
git clone [email protected]:ks6088ts/template-python.git
cd template-python
```

- Test the code
<!-- Add steps to run the tests suite and/or manually test -->

```
make ci-test
```

## What to Check

Verify that the following are valid

- ...

## Additional Information

<!-- Add any other helpful information that may be needed here. -->
10 changes: 10 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
41 changes: 41 additions & 0 deletions .github/workflows/docker-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: docker-release
on:
push:
tags:
- "v*"
jobs:
release:
runs-on: "ubuntu-latest"
timeout-minutes: 5
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# https://github.com/docker/build-push-action/issues/42#issuecomment-915323168
- name: Set Versions
uses: actions/github-script@v7
id: set_version
with:
script: |
const tag = context.ref.substring(10)
const no_v = tag.replace('v', '')
const dash_index = no_v.lastIndexOf('-')
const no_dash = (dash_index > -1) ? no_v.substring(0, dash_index) : no_v
core.setOutput('tag', tag)
core.setOutput('no-v', no_v)
core.setOutput('no-dash', no_dash)
- name: Build and push tag ${{steps.set_version.outputs.no-dash}}
uses: docker/build-push-action@v6
with:
context: .
push: true
build-args: |
GIT_REVISION=${{ github.sha }}
GIT_TAG=${{steps.set_version.outputs.no-dash}}
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/template-python:${{steps.set_version.outputs.no-dash}}
${{ secrets.DOCKERHUB_USERNAME }}/template-python:latest
28 changes: 28 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: docker

on:
push:
branches:
- "main"
- "feature/**"
pull_request:
branches:
- "main"

jobs:
docker:
runs-on: "ubuntu-latest"
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # to retrieve git tags
# How to set system path variable in github action workflow: https://stackoverflow.com/a/68214331
- name: Add to PATH
shell: bash
run: |
echo "/home/runner/bin" >> $GITHUB_PATH
- name: Run CI tests for Docker
shell: bash
run: |
make ci-test-docker TOOLS_DIR="/home/runner/bin"
35 changes: 35 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: test

on:
push:
branches:
- "main"
- "feature/**"
pull_request:
branches:
- "main"

jobs:
test:
strategy:
matrix:
platform:
- "ubuntu-latest"
python-version:
- "3.10"
runs-on: ${{ matrix.platform }}
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Set up Poetry
shell: bash
run: pipx install poetry
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "poetry"
- name: Run CI tests
shell: bash
run: |
make ci-test
Loading

0 comments on commit 8ab468c

Please sign in to comment.