Skip to content

Commit ef8c282

Browse files
authored
Merge pull request #105 from chvmvd/update-github-actions
Update GitHub Actions
2 parents f616e93 + c4f2a51 commit ef8c282

File tree

12 files changed

+926
-100
lines changed

12 files changed

+926
-100
lines changed

.github/actions/build/action.yml

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,8 @@
22
runs:
33
using: "Composite"
44
steps:
5-
- name: Setup Node.js
6-
uses: actions/setup-node@v3
7-
with:
8-
node-version: latest
9-
10-
- name: Cache Node Modules
11-
uses: actions/cache@v3
12-
id: node_modules_cache_id
13-
with:
14-
path: "**/node_modules"
15-
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
16-
17-
- name: Install Node Modules
18-
if: steps.node_modules_cache_id.outputs.cache-hit != 'true'
19-
run: npm ci
20-
shell: bash
5+
- name: Install Node Mudules
6+
uses: ./.github/actions/install_node_modules
217

228
- name: Build
239
run: npm run build

.github/actions/install_node_modules/action.yml

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
runs:
3+
using: "Composite"
4+
steps:
5+
- name: Setup Python
6+
uses: actions/setup-python@v4
7+
with:
8+
python-version: latest
9+
10+
- name: Cache Poetry
11+
uses: actions/cache@v3
12+
id: poetry_cache_id
13+
with:
14+
path: ~/.cache/pypoetry
15+
key: poetry-cache-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ env.POETRY_VERSION }}
16+
17+
- name: Cache Poetry Packages
18+
uses: actions/cache@v3
19+
id: poetry_packages_cache_id
20+
with:
21+
path: ~/.local
22+
key: poetry-packages-cache-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('**/poetry.lock') }}
23+
24+
- name: Setup Poetry
25+
if: steps.poetry_cache_id.outputs.cache-hit != 'true'
26+
run: curl -sSL https://install.python-poetry.org | python3 -
27+
shell: bash
28+
29+
- name: Install Poetry Packages
30+
if: steps.poetry_packages_cache_id.outputs.cache-hit != 'true'
31+
run: poetry install
32+
shell: bash

.github/workflows/black.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

.github/workflows/formatter.yml

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
---
2+
name: Formatter
3+
4+
on:
5+
push:
6+
pull_request:
7+
branches: [master, main]
8+
9+
jobs:
10+
changes:
11+
name: Check Changes
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout Code
15+
uses: actions/checkout@v3
16+
17+
- name: Check Changes
18+
uses: dorny/paths-filter@v2
19+
id: changes
20+
with:
21+
filters: |
22+
python-files:
23+
- '**.py,**.pyi,**.ipynb'
24+
25+
databooks:
26+
name: Databooks
27+
needs: changes
28+
if: needs.changes.outputs.python-files == 'true'
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout Code
32+
uses: actions/checkout@v3
33+
34+
- name: Install Python Modules
35+
uses: ./.github/actions/install_python_modules
36+
37+
- name: Run Databooks
38+
run: poetry run databooks meta --no-rm-outs --rm-exec --yes .
39+
40+
prettier:
41+
name: Prettier
42+
runs-on: ubuntu-latest
43+
steps:
44+
- name: Checkout Code
45+
uses: actions/checkout@v3
46+
47+
- name: Install Node Mudules
48+
uses: ./.github/actions/install_node_modules
49+
50+
- name: Run Prettier
51+
run: npx prettier --write .
52+
53+
black:
54+
name: Black
55+
needs: databooks
56+
if: needs.changes.outputs.python-files == 'true'
57+
runs-on: ubuntu-latest
58+
steps:
59+
- name: Checkout Code
60+
uses: actions/checkout@v3
61+
62+
- name: Install Python Modules
63+
uses: ./.github/actions/install_python_modules
64+
65+
- name: Run Black
66+
run: poetry run black .
67+
68+
nbqa-isort:
69+
name: nqQA-isort
70+
needs: black
71+
if: needs.changes.outputs.python-files == 'true'
72+
runs-on: ubuntu-latest
73+
steps:
74+
- name: Checkout Code
75+
uses: actions/checkout@v3
76+
77+
- name: Install Python Modules
78+
uses: ./.github/actions/install_python_modules
79+
80+
- name: Run nqQA isort
81+
run: poetry run nbqa isort .
82+
83+
nbqa-pyupgrade:
84+
name: nqQA-pyupgrade
85+
needs: black
86+
if: needs.changes.outputs.python-files == 'true'
87+
runs-on: ubuntu-latest
88+
steps:
89+
- name: Checkout Code
90+
uses: actions/checkout@v3
91+
92+
- name: Install Python Modules
93+
uses: ./.github/actions/install_python_modules
94+
95+
- name: Run nqQA pyupgrade
96+
run: poetry run nbqa pyupgrade .
97+
98+
pre-commit:
99+
name: pre-commit
100+
needs: black
101+
runs-on: ubuntu-latest
102+
steps:
103+
- name: Checkout Code
104+
uses: actions/checkout@v3
105+
106+
- name: Setup Python
107+
uses: actions/setup-python@v4
108+
with:
109+
python-version: latest
110+
111+
- name: Install Python Modules
112+
uses: ./.github/actions/install_python_modules
113+
114+
- name: Cache pre-commit
115+
uses: actions/cache@v3
116+
id: pre-commit_cache_id
117+
with:
118+
path: ~/.cache/pre-commit
119+
key: pre-commit-cache-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('.pre-commit-config.yaml') }}
120+
121+
- name: Install pre-commit environment
122+
if: steps.pre-commit_cache_id.outputs.cache-hit != 'true'
123+
run: pre-commit run --all-files
124+
125+
- name: Run pre-commit
126+
run: pre-commit run --all-files
127+
128+
commit:
129+
name: Commit
130+
needs: prettier
131+
runs-on: ubuntu-latest
132+
steps:
133+
- name: Commit
134+
uses: stefanzweifel/git-auto-commit-action@v4
135+
with:
136+
commit_message: Formatted!

.github/workflows/prettier.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

.markdownlint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# Rules by id #
2020
###############
2121
MD013: false
22-
MD033: false # Allow inline HTML
22+
MD033: false
2323
MD041: false
2424
#################
2525
# Rules by tags #

.pre-commit-config.yaml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@ repos:
77
rev: 1.2.3
88
hooks:
99
- id: databooks-meta
10-
- repo: https://github.com/pre-commit/mirrors-prettier
11-
rev: v3.0.0-alpha.3
12-
hooks:
13-
- id: prettier
10+
# - repo: https://github.com/pre-commit/mirrors-prettier
11+
# rev: v3.0.0-alpha.3
12+
# hooks:
13+
# - id: prettier
1414
- repo: https://github.com/psf/black
1515
rev: 22.10.0
1616
hooks:
1717
- id: black
1818
- id: black-jupyter
19+
exclude: .*sum_1to100.ipynb
1920
- repo: https://github.com/pre-commit/mirrors-eslint
2021
rev: v8.26.0
2122
hooks:
@@ -47,9 +48,9 @@ repos:
4748
# - id: nbqa-mypy
4849
# - id: nbqa-pylint
4950
- id: nbqa-pyupgrade
50-
# - id: nbqa-yapf
51-
# - id: nbqa-autopep8
52-
exclude: .*sum_1to(20|100).ipynb
51+
# - id: nbqa-yapf
52+
# - id: nbqa-autopep8
53+
# exclude: .*sum_1to(20|100).ipynb
5354
# - id: nbqa-pydocstyle
5455
- repo: https://github.com/pre-commit/pre-commit-hooks
5556
rev: v4.3.0

.yamllint.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
yaml-files:
3+
- "*.yaml"
4+
- "*.yml"
5+
- ".yamllint"
6+
7+
ignore: |
8+
.git
9+
node_modules
10+
build
11+
.docusaurus
12+
/my-website
13+
14+
rules:
15+
braces: enable
16+
brackets: enable
17+
colons: enable
18+
commas: enable
19+
comments:
20+
level: warning
21+
comments-indentation:
22+
level: warning
23+
document-end: disable
24+
document-start:
25+
level: warning
26+
empty-lines: enable
27+
empty-values: disable
28+
float-values: disable
29+
hyphens: enable
30+
indentation: enable
31+
key-duplicates: enable
32+
key-ordering: disable
33+
line-length: disable
34+
new-line-at-end-of-file: enable
35+
new-lines: enable
36+
octal-values: disable
37+
quoted-strings: disable
38+
trailing-spaces: enable

0 commit comments

Comments
 (0)