Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 2 additions & 16 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,8 @@
runs:
using: "Composite"
steps:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: latest

- name: Cache Node Modules
uses: actions/cache@v3
id: node_modules_cache_id
with:
path: "**/node_modules"
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}

- name: Install Node Modules
if: steps.node_modules_cache_id.outputs.cache-hit != 'true'
run: npm ci
shell: bash
- name: Install Node Mudules
uses: ./.github/actions/install_node_modules

- name: Build
run: npm run build
Expand Down
20 changes: 20 additions & 0 deletions .github/actions/install_node_modules/action.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions .github/actions/install_python_modules/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
runs:
using: "Composite"
steps:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: latest

- name: Cache Poetry
uses: actions/cache@v3
id: poetry_cache_id
with:
path: ~/.cache/pypoetry
key: poetry-cache-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ env.POETRY_VERSION }}

- name: Cache Poetry Packages
uses: actions/cache@v3
id: poetry_packages_cache_id
with:
path: ~/.local
key: poetry-packages-cache-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('**/poetry.lock') }}

- name: Setup Poetry
if: steps.poetry_cache_id.outputs.cache-hit != 'true'
run: curl -sSL https://install.python-poetry.org | python3 -
shell: bash

- name: Install Poetry Packages
if: steps.poetry_packages_cache_id.outputs.cache-hit != 'true'
run: poetry install
shell: bash
39 changes: 0 additions & 39 deletions .github/workflows/black.yml

This file was deleted.

136 changes: 136 additions & 0 deletions .github/workflows/formatter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
---
name: Formatter

on:
push:
pull_request:
branches: [master, main]

jobs:
changes:
name: Check Changes
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Check Changes
uses: dorny/paths-filter@v2
id: changes
with:
filters: |
python-files:
- '**.py,**.pyi,**.ipynb'

databooks:
name: Databooks
needs: changes
if: needs.changes.outputs.python-files == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Install Python Modules
uses: ./.github/actions/install_python_modules

- name: Run Databooks
run: poetry run databooks meta --no-rm-outs --rm-exec --yes .

prettier:
name: Prettier
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Install Node Mudules
uses: ./.github/actions/install_node_modules

- name: Run Prettier
run: npx prettier --write .

black:
name: Black
needs: databooks
if: needs.changes.outputs.python-files == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Install Python Modules
uses: ./.github/actions/install_python_modules

- name: Run Black
run: poetry run black .

nbqa-isort:
name: nqQA-isort
needs: black
if: needs.changes.outputs.python-files == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Install Python Modules
uses: ./.github/actions/install_python_modules

- name: Run nqQA isort
run: poetry run nbqa isort .

nbqa-pyupgrade:
name: nqQA-pyupgrade
needs: black
if: needs.changes.outputs.python-files == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Install Python Modules
uses: ./.github/actions/install_python_modules

- name: Run nqQA pyupgrade
run: poetry run nbqa pyupgrade .

pre-commit:
name: pre-commit
needs: black
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: latest

- name: Install Python Modules
uses: ./.github/actions/install_python_modules

- name: Cache pre-commit
uses: actions/cache@v3
id: pre-commit_cache_id
with:
path: ~/.cache/pre-commit
key: pre-commit-cache-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('.pre-commit-config.yaml') }}

- name: Install pre-commit environment
if: steps.pre-commit_cache_id.outputs.cache-hit != 'true'
run: pre-commit run --all-files

- name: Run pre-commit
run: pre-commit run --all-files

commit:
name: Commit
needs: prettier
runs-on: ubuntu-latest
steps:
- name: Commit
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Formatted!
35 changes: 0 additions & 35 deletions .github/workflows/prettier.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .markdownlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# Rules by id #
###############
MD013: false
MD033: false # Allow inline HTML
MD033: false
MD041: false
#################
# Rules by tags #
Expand Down
15 changes: 8 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ repos:
rev: 1.2.3
hooks:
- id: databooks-meta
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0-alpha.3
hooks:
- id: prettier
# - repo: https://github.com/pre-commit/mirrors-prettier
# rev: v3.0.0-alpha.3
# hooks:
# - id: prettier
- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black
- id: black-jupyter
exclude: .*sum_1to100.ipynb
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v8.26.0
hooks:
Expand Down Expand Up @@ -47,9 +48,9 @@ repos:
# - id: nbqa-mypy
# - id: nbqa-pylint
- id: nbqa-pyupgrade
# - id: nbqa-yapf
# - id: nbqa-autopep8
exclude: .*sum_1to(20|100).ipynb
# - id: nbqa-yapf
# - id: nbqa-autopep8
# exclude: .*sum_1to(20|100).ipynb
# - id: nbqa-pydocstyle
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
Expand Down
38 changes: 38 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
yaml-files:
- "*.yaml"
- "*.yml"
- ".yamllint"

ignore: |
.git
node_modules
build
.docusaurus
/my-website

rules:
braces: enable
brackets: enable
colons: enable
commas: enable
comments:
level: warning
comments-indentation:
level: warning
document-end: disable
document-start:
level: warning
empty-lines: enable
empty-values: disable
float-values: disable
hyphens: enable
indentation: enable
key-duplicates: enable
key-ordering: disable
line-length: disable
new-line-at-end-of-file: enable
new-lines: enable
octal-values: disable
quoted-strings: disable
trailing-spaces: enable
Loading