generated from ydataai/opensource-template
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(setup): add python package basic structure (#1)
- Loading branch information
1 parent
3c2efe7
commit e15b056
Showing
12 changed files
with
462 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
name: Bug fix | ||
about: Describe the bug to be fixed | ||
title: 'fix: <title for the bug>' | ||
labels: fix | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Don't forget to assign:** | ||
* Project | ||
* Milestone (if any) | ||
|
||
**Environment:** dev|prod | ||
|
||
## Actual Behaviour | ||
A clear and concise description of what the bug is. | ||
|
||
## Expected behaviour | ||
A clear and concise description of what you expected to happen. | ||
|
||
## Steps To Reproduce | ||
An ordered list of the steps to reproduce the bug | ||
|
||
## Screenshots | ||
If applicable, add screenshots to help explain your problem. | ||
|
||
## Dependencies | ||
Links to other tasks that may depend or be dependent of this one. | ||
|
||
## Additional context | ||
* Browser being used | ||
* Info used to reproduce | ||
* Credentials or userid | ||
* Logs | ||
* Links |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
name: Chore | ||
about: Describe what needs to be changed | ||
title: 'chore: <title of the task>' | ||
labels: chore | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Don't forget to assign:** | ||
* Project | ||
* Milestone (if any) | ||
|
||
## Description | ||
A clear and concise description of the purpose of this task. | ||
|
||
## Additional context | ||
* Helpful documentation | ||
* Links |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
name: Feature | ||
about: Describe the task derived from a business request | ||
title: 'feat: <title>' | ||
labels: feat | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Don't forget to assign:** | ||
* Project | ||
* Milestone (if any) | ||
|
||
## Description of the feature | ||
* A clear and concise description of the business idea | ||
* Helpful documentation | ||
Acceptance criteria (if applicable) | ||
Given [context] | ||
When [a specific action is performed] | ||
Then [a set of consequences should occur] | ||
|
||
## Dependencies | ||
Links to other tasks that may depend or be dependent on this one. | ||
|
||
## Additional context | ||
* Link to the notion, if any | ||
* Screenshots for the UI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# To allow validation of only one commit, usually the one that defines the title | ||
# I think that is achieved with these options set to true. | ||
# https://github.com/Ezard/semantic-prs#configuration-options | ||
titleOnly: true | ||
allowRevertCommits: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: Merge Main | ||
|
||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
|
||
jobs: | ||
prepare: | ||
name: Calculate Version and Build Number | ||
runs-on: ubuntu-22.04 | ||
|
||
outputs: | ||
build_number: ${{ steps.build_number.outputs.value }} | ||
new_release: ${{ steps.semantic.outputs.new_release_published }} | ||
release: ${{ steps.semantic.outputs.new_release_version }} | ||
release_notes: ${{ steps.semantic.outputs.new_release_notes }} | ||
version: ${{ steps.version.outputs.value }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.ACCESS_TOKEN }} | ||
|
||
- uses: cycjimmy/semantic-release-action@v3 | ||
id: semantic | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | ||
with: | ||
dry_run: true | ||
|
||
- name: Count number or releases for tag | ||
id: build_number | ||
run: echo "value=$(($(git tag | grep -c ${{ steps.semantic.outputs.new_release_version }}) + 1))" >> $GITHUB_OUTPUT | ||
|
||
- name: Compute version | ||
id: version | ||
run: echo "value=${{ steps.semantic.outputs.new_release_version }}.rc${{ steps.build_number.outputs.value }}" >> $GITHUB_OUTPUT | ||
|
||
|
||
releases: | ||
if: needs.prepare.outputs.new_release == 'true' | ||
|
||
name: Generates Prerelease | ||
runs-on: ubuntu-22.04 | ||
|
||
needs: | ||
- prepare | ||
|
||
steps: | ||
- name: Create Pre Release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | ||
with: | ||
tag_name: ${{ needs.prepare.outputs.version }} | ||
release_name: ${{ needs.prepare.outputs.version }} | ||
body: ${{ github.event.head_commit.message }} | ||
prerelease: true | ||
|
||
- name: Delete Previous drafts | ||
uses: hugo19941994/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | ||
|
||
- name: Create Draft Release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | ||
with: | ||
tag_name: ${{ needs.prepare.outputs.release }} | ||
release_name: ${{ needs.prepare.outputs.release }} | ||
body: ${{ needs.prepare.outputs.release_notes }} | ||
draft: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Pull Request | ||
|
||
|
||
|
||
on: | ||
push: | ||
branches: | ||
- renovate/** | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
|
||
|
||
jobs: | ||
cancel_previous: | ||
name: 'Cancel Previous Runs' | ||
runs-on: ubuntu-22.04 | ||
timeout-minutes: 3 | ||
|
||
steps: | ||
- uses: ydataai/[email protected] | ||
with: | ||
ignore_sha: true | ||
access_token: ${{ secrets.ACCESS_TOKEN }} | ||
|
||
|
||
validate: | ||
name: Validate | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Cache pip dependencies | ||
id: cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
make install-all | ||
# - name: Validate code formatting | ||
# run: make lint | ||
|
||
# - name: Unit Tests | ||
# run: | | ||
# make test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
name: Release | ||
|
||
|
||
|
||
on: | ||
release: | ||
types: | ||
- released | ||
|
||
|
||
|
||
jobs: | ||
package: | ||
name: Build and Package | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Version | ||
id: version | ||
run: echo "value=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
|
||
- uses: actions/cache@v3 | ||
name: Cache pip dependencies | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
make install-dev | ||
- name: Lint | ||
run: make lint | ||
|
||
- name: Build package | ||
run: make package version=${{ steps.version.outputs.value }} | ||
|
||
- name: Upload Pipeline Artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: built-artifacts | ||
path: dist/ | ||
|
||
upload-assets: | ||
name: Upload Assets to Release | ||
runs-on: ubuntu-22.04 | ||
|
||
needs: package | ||
|
||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: built-artifacts | ||
path: dist/ | ||
|
||
- uses: AButler/[email protected] | ||
with: | ||
files: "dist/*" | ||
repo-token: ${{ secrets.ACCESS_TOKEN }} | ||
release-tag: ${{ needs.package.outputs.version }} | ||
|
||
publish-pypi: | ||
name: Publish packages to PyPi | ||
runs-on: ubuntu-22.04 | ||
|
||
needs: package | ||
|
||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: built-artifacts | ||
path: dist/ | ||
|
||
- uses: pypa/[email protected] | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
{ | ||
"branches": ["main"], | ||
"tagFormat": "${version}", | ||
"plugins": [ | ||
["@semantic-release/commit-analyzer", { | ||
[ | ||
"@semantic-release/commit-analyzer", | ||
{ | ||
"preset": "angular", | ||
"releaseRules": [ | ||
{"type": "chore", "scope": "deps", "release": "patch"} | ||
] | ||
}], | ||
"@semantic-release/release-notes-generator", | ||
"@semantic-release/github" | ||
"releaseRules": [{ "type": "chore", "scope": "deps", "release": "patch" }] | ||
} | ||
], | ||
"@semantic-release/release-notes-generator" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.