Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
peterschutt committed Mar 24, 2024
0 parents commit 27f30ce
Show file tree
Hide file tree
Showing 38 changed files with 3,552 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"contributorsPerLine": 7,
"projectName": "dtos",
"projectOwner": "jolt-org",
"repoType": "github",
"repoHost": "https://github.com",
"commitConvention": "angular",
"commitType": "docs"
"files": [
"docs/CONTRIBUTORS.md"
],
"linkToUsage": true,
"skipCi": true,
"contributors": []
"badgeTemplate": "![All Contributors](https://img.shields.io/github/all-contributors/<%= projectOwner %>/<%= projectName %>?labelColor=202235&color=edb641&logoColor=edb641)](#contributors-)",
}
7 changes: 7 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Code owner settings for `jolt-org`
# @maintainers should be assigned to all reviews.
# Most specific assignment takes precedence though, so if you add a more specific thing than the `*` glob, you must also add @maintainers
# For more info about code owners see https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners#codeowners-file-example

# Global Assignment
* @jolt-org/maintainers @jolt-org/members
27 changes: 27 additions & 0 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Continuous Deployment

on:
push:
tags:
- "v*.*.*"

jobs:
generate-changelog:
name: Generate changelog
runs-on: ubuntu-22.04
outputs:
release_body: ${{ steps.git-cliff.outputs.content }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Generate a changelog
uses: orhun/git-cliff-action@main
id: git-cliff
with:
config: pyproject.toml
args: -vv --latest --strip header
env:
OUTPUT: docs/CHANGELOG.rst
97 changes: 97 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Tests And Linting

on:
pull_request:
push:
branches:
- main

jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install Pre-Commit
run: python -m pip install pre-commit && pre-commit install

- name: Load cached Pre-Commit Dependencies
id: cached-pre-commit-dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pre-commit/
key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}

- name: Execute Pre-Commit
run: pre-commit run --show-diff-on-failure --color=always --all-files

test:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
timeout-minutes: 30
defaults:
run:
shell: bash
steps:
- name: Check out repository
uses: actions/checkout@v4

- uses: pdm-project/setup-pdm@v3
name: Set up PDM
with:
python-version: ${{ matrix.python-version }}
allow-python-prereleases: true
cache: true

- name: Install dependencies
run: pdm install

- name: Test
run: pdm run pytest -m ""

build-docs:
needs:
- validate
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"

- uses: pdm-project/setup-pdm@v3
name: Set up PDM
with:
python-version: "3.11"
allow-python-prereleases: true
cache: true

- name: Install dependencies
run: pdm install -G:docs

- name: Build docs
run: pdm run make docs

- name: Save PR number
env:
PR_NUMBER: ${{ github.event.number }}
run: echo $PR_NUMBER > .pr_number

- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: docs-preview
path: |
docs/_build/html
.pr_number
82 changes: 82 additions & 0 deletions .github/workflows/docs-preview.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Deploy Documentation Preview

on:
workflow_run:
workflows: [Tests And Linting]
types: [completed]

jobs:
deploy:

if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request' }}

runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Download artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow_conclusion: success

run_id: ${{ github.event.workflow_run.id }}

path: docs-preview
name: docs-preview

- name: Set PR number
run: echo "PR_NUMBER=$(cat docs-preview/.pr_number)" >> $GITHUB_ENV

- name: Deploy docs preview
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: docs-preview/docs/_build/html

token: ${{ secrets.DOCS_PREVIEW_DEPLOY_TOKEN }}

repository-name: jolt-org/dtos-docs-preview
clean: false

target-folder: ${{ env.PR_NUMBER }}

branch: gh-pages

- uses: actions/github-script@v6
env:

PR_NUMBER: ${{ env.PR_NUMBER }}

with:
script: |
const issue_number = process.env.PR_NUMBER
const body = "Documentation preview will be available shortly at https://jolt-org.github.io/dtos-docs-preview/" + issue_number
const opts = github.rest.issues.listComments.endpoint.merge({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
});
const comments = await github.paginate(opts)
for (const comment of comments) {
if (comment.user.id === 41898282 && comment.body === body) {
await github.rest.issues.deleteComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: comment.id
})
}
}
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
body: body,
})
46 changes: 46 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Documentation Building

on:
release:
types: [published]
push:
branches:
- main

jobs:
docs:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: "3.11"

- uses: pdm-project/setup-pdm@v3
name: Set up PDM
with:
python-version: "3.11"
allow-python-prereleases: true
cache: true

- name: Install dependencies
run: pdm install -G:docs

- name: Fetch gh pages
run: git fetch origin gh-pages --depth=1

- name: Build release docs
run: pdm run python tools/build_docs.py docs-build
if: github.event_name == 'release'

- name: Build dev docs
run: pdm run python tools/build_docs.py docs-build
if: github.event_name == 'push'

- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: docs-build
20 changes: 20 additions & 0 deletions .github/workflows/pr-title.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "Lint PR Title"

on:
pull_request_target:
types:
- opened
- edited
- synchronize

permissions:
pull-requests: read

jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33 changes: 33 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Latest Release

on:
release:
types: [published]
workflow_dispatch:

jobs:
publish-release:
runs-on: ubuntu-latest
permissions:
id-token: write
environment: release
steps:
- name: Check out repository
uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: "3.11"

- uses: pdm-project/setup-pdm@v3
name: Set up PDM
with:
python-version: "3.11"
allow-python-prereleases: true
cache: true

- name: Build package
run: pdm build

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
36 changes: 36 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# folders
__pycache__/
.auto_pytabs_cache/
.hypothesis/
.idea/
.mypy_cache/
.pytest_cache/
.scannerwork/
.venv/
.vscode/
*.egg-info/
build/
dist/
node_modules/
results/
site/
target/

# files
**/*.so
**/*.sqlite
**/*.sqlite*
*.iml
.DS_Store
.coverage
.dmypy.json
.python-version
.ruff_cache
/docs/_build/
coverage.*
setup.py

# pdm
.pdm.toml
.pdm-python
.pdm-build/
Loading

0 comments on commit 27f30ce

Please sign in to comment.