Skip to content

Commit

Permalink
fix: Add missing template files and add uvicorn dependency (#1)
Browse files Browse the repository at this point in the history
* add missing template files
* uvicorn dependency added into environment.yml
  • Loading branch information
egekocabas committed Nov 21, 2023
1 parent c1c5aa1 commit b881a08
Show file tree
Hide file tree
Showing 14 changed files with 947 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Changes here will be overwritten by Copier
_commit: "6516951"
_src_path: git@github.com:la-famiglia-jst2324/parma-mining-template.git
module_name: github
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.conda_lock_files/** linguist-generated=true
* text=auto
*.{py,yaml,yml,sh} text eol=lf
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @robinholzi
18 changes: 18 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Motivation

<!-- Why is this change necessary? Link issues here if applicable. -->

# Changes

<!-- What changes have been performed? -->

# Checklist

- [ ] added myself as assignee
- [ ] correct reviewers
- [ ] descriptive PR title using [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/).
- [ ] description explains the motivation and details of the changes
- [ ] tests cover my changes
- [ ] documentation is updated
- [ ] CI is green
- [ ] breaking changes are discussed with the team and documented in the PR title `!` (e.g. `feat!: Update endpoint`)
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
reviewers:
- "robinholzi"
98 changes: 98 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# PULL REQUEST LABELS
autolabeler:
# Conventional Commit Types (https://github.com/commitizen/conventional-commit-types)
- label: build
title:
- '/^build(\(.*\))?(\!)?\:/'
- label: chore
title:
- '/^chore(\(.*\))?(\!)?\:/'
- label: ci
title:
- '/^ci(\(.*\))?(\!)?\:/'
- label: documentation
title:
- '/^docs(\(.*\))?(\!)?\:/'
- label: enhancement
title:
- '/^feat(\(.*\))?(\!)?\:/'
- label: fix
title:
- '/^fix(\(.*\))?(\!)?\:/'
- label: performance
title:
- '/^perf(\(.*\))?(\!)?\:/'
- label: refactor
title:
- '/^refactor(\(.*\))?(\!)?\:/'
- label: revert
title:
- '/^revert(\(.*\))?(\!)?\:/'
- label: style
title:
- '/^style(\(.*\))?(\!)?\:/'
- label: test
title:
- '/^test(\(.*\))?(\!)?\:/'
# Custom Types
- label: breaking
title:
- '/^[a-z]+(\(.*\))?\!\:/'
# >>> AUTOMATIC VERSIONING (PRE 1.0)
version-resolver:
minor:
labels:
- breaking
default: patch
# >>> RELEASE CONFIGURATION
name-template: "v$RESOLVED_VERSION"
tag-template: "v$RESOLVED_VERSION"
category-template: "### $TITLE"
change-template: "- $TITLE by @$AUTHOR in [#$NUMBER]($URL)"
replacers:
# remove conventional commit tag & scope from change list
- search: '/- [a-z]+(\(.*\))?(\!)?\: /g'
replace: "- "
template: |
## What's Changed
$CHANGES
**Full Changelog:** [`$PREVIOUS_TAG...v$RESOLVED_VERSION`](https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION)
categories:
- title: ⚠️ Breaking Changes
labels:
- breaking
- title: ✨ New Features
labels:
- enhancement
- title: 🐞 Bug Fixes
labels:
- fix
- title: 🏎️ Performance Improvements
labels:
- performance
- title: 📚 Documentation
labels:
- documentation
- title: 🏗️ Testing
labels:
- test
- title: ⚙️ Automation
labels:
- ci
- title: 🛠 Builds
labels:
- build
- title: 💎 Code Style
labels:
- style
- title: 📦 Refactorings
labels:
- refactor
- title: ♻️ Chores
labels:
- chore
- title: 🗑 Reverts
labels:
- revert
66 changes: 66 additions & 0 deletions .github/workflows/chore.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Chore
on:
pull_request:
branches: [main]
types: [opened, reopened, edited, synchronize]
push:
branches: [main]

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

jobs:
check-pr-title:
name: PR title validation
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: validate conventional commit message
id: lint
uses: amannn/action-semantic-pull-request@v5
with:
subjectPattern: ^[A-Z].+[^. ]$ # subject must start with uppercase letter and may not end with a dot/space
env:
GITHUB_TOKEN: ${{ github.token }}
- name: post comment about invalid PR title
if: failure()
uses: marocchino/sticky-pull-request-comment@v2
with:
header: conventional-commit-pr-title
message: |
Thanks for contributing to ParmaAI! 👋🏼
Please use PR titles according to [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted.
<details><summary><b>Details</b></summary>
```
${{ steps.lint.outputs.error_message }}
```
</details>
- name: delete comment about invalid PR title
if: success()
uses: marocchino/sticky-pull-request-comment@v2
with:
header: conventional-commit-pr-title
delete: true

release-drafter:
name: ${{ github.event_name == 'pull_request' && 'Assign Labels' || 'Draft Release' }}
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: ${{ github.event_name == 'pull_request' && 'Assign labels' || 'Update release draft' }}
uses: release-drafter/release-drafter@v5
with:
disable-releaser: ${{ github.event_name == 'pull_request' }}
disable-autolabeler: ${{ github.event_name == 'push' }}
env:
GITHUB_TOKEN: ${{ github.token }}
59 changes: 59 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: CI
permissions: write-all
on:
pull_request:
push:
branches: [main]

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

defaults:
run:
shell: bash -el {0}

jobs:
pre-commit-checks:
name: Pre-commit Checks
runs-on: ubuntu-latest
timeout-minutes: 30
env:
PRE_COMMIT_USE_MICROMAMBA: 1
steps:
- uses: actions/checkout@v4
- name: micromamba installation
uses: mamba-org/setup-micromamba@da9b4fa3cd810fa222215d6062647d3e717e7662
- name: add micromamba to GITHUB_PATH
run: echo "${HOME}/micromamba-bin" >> "$GITHUB_PATH"
- name: Install Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Run pre-commit checks
uses: pre-commit/action@v3.0.0
env:
PRE_COMMIT_USE_MICROMAMBA: 1

ci:
name: Testing CI
runs-on: ubuntu-latest
timeout-minutes: 30
# TODO: include services database container once needed
steps:
- uses: actions/checkout@v4
- name: conda env setup
uses: mamba-org/setup-micromamba@da9b4fa3cd810fa222215d6062647d3e717e7662
with:
environment-file: environment.yml
cache-environment: true
- name: Install package
run: python -m pip install --no-build-isolation --no-deps --disable-pip-version-check -e .
- name: Run unit tests
run: python -m pytest --cov-report=xml
- name: Get Cover
uses: orgoro/coverage@v3.1
if: github.event_name == 'pull_request'
with:
coverageFile: ./coverage.xml
token: ${{ github.token }}
20 changes: 20 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Deploy
on:
release:
types: [published]

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

defaults:
run:
shell: bash -el {0}

jobs:
prod-deployment:
name: Publish release
runs-on: ubuntu-latest
steps:
- name: dummy
run: echo "TODO"
47 changes: 47 additions & 0 deletions .github/workflows/tag-major.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Major Tag
on:
release:
types: [published]

permissions:
contents: write

jobs:
create-major-tag:
name: major tag creation
runs-on: ubuntu-latest
steps:
- name: Get major version
id: version
run: |
MAJOR=$(echo ${{ github.ref_name }} | cut -d'.' -f1 | cut -c2-)
echo "major=$MAJOR" >> $GITHUB_OUTPUT
- name: Delete existing tag
continue-on-error: true
uses: actions/github-script@v6
with:
script: |
await github.rest.git.deleteRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `tags/v${{ steps.version.outputs.major }}`,
});
- name: Create tag
uses: actions/github-script@v6
with:
script: |
const newTag = "v${{ steps.version.outputs.major }}";
const createdTag = await github.rest.git.createTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag: newTag,
message: "Moving pointer to ${{ github.ref_name }}",
object: "${{ github.sha }}",
type: "commit",
});
await github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `refs/tags/${newTag}`,
sha: createdTag.data.sha
});
Loading

0 comments on commit b881a08

Please sign in to comment.