Skip to content

Commit

Permalink
chore(setup): add python package basic structure (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
vascoalramos committed Feb 2, 2023
1 parent 3c2efe7 commit e15b056
Show file tree
Hide file tree
Showing 12 changed files with 462 additions and 18 deletions.
36 changes: 36 additions & 0 deletions .github/ISSUE_TEMPLATE/bugfix-request.md
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
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/chore-request.md
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
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.md
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
5 changes: 5 additions & 0 deletions .github/semantic.yml
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
76 changes: 76 additions & 0 deletions .github/workflows/merge-main.yaml
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
57 changes: 57 additions & 0 deletions .github/workflows/pull-request.yaml
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
87 changes: 87 additions & 0 deletions .github/workflows/release.yaml
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 }}
15 changes: 8 additions & 7 deletions .releaserc.json
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"
]
}
22 changes: 11 additions & 11 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@

## 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, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behaviour 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
- 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 behaviour 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
- 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

Expand Down
Loading

0 comments on commit e15b056

Please sign in to comment.