Skip to content

Commit 8d67ec3

Browse files
authored
Merge pull request #102 from chvmvd/update-github-actions
GitHub Actionsをコンポーネント化
2 parents 5195e4f + 6081635 commit 8d67ec3

File tree

13 files changed

+342
-323
lines changed

13 files changed

+342
-323
lines changed

.github/actions/build/action.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
runs:
3+
using: "Composite"
4+
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
21+
22+
- name: Build
23+
run: npm run build
24+
shell: bash

.github/workflows/black.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,22 @@ on:
77
branches: [main, master]
88

99
jobs:
10+
changes:
11+
name: Check Changes
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check Changes
15+
uses: dorny/paths-filter@v2
16+
id: changes
17+
with:
18+
filters: |
19+
black:
20+
- '**.py,**.ipynb'
21+
1022
black:
1123
name: Black
24+
needs: changes
25+
if: needs.changes.outputs.black == 'true'
1226
runs-on: ubuntu-latest
1327
steps:
1428
- name: Checkout Code
@@ -17,5 +31,4 @@ jobs:
1731
- name: Run Black
1832
uses: psf/black@stable
1933
with:
20-
options: '--exclude="docs/01python/07for/_samples/sum_1to100.ipynb"'
2134
jupyter: true

.github/workflows/build-test.yml

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,5 @@ jobs:
1313
- name: Checkout Code
1414
uses: actions/checkout@v3
1515

16-
- name: Setup Node.js
17-
uses: actions/setup-node@v3
18-
with:
19-
node-version: latest
20-
21-
- name: Cache Node Modules
22-
uses: actions/cache@v3
23-
id: node_modules_cache_id
24-
with:
25-
path: "**/node_modules"
26-
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
27-
28-
- name: Install Node Modules
29-
if: steps.node_modules_cache_id.outputs.cache-hit != 'true'
30-
run: npm ci
31-
32-
- name: Build Test
33-
run: npm run build
16+
- name: Build
17+
uses: ./.github/actions/build

.github/workflows/deploy.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@ jobs:
1717
- name: Checkout Code
1818
uses: actions/checkout@v3
1919

20-
- name: Install and Build 🔧
21-
run: |
22-
npm ci
23-
npm run build
20+
- name: Build
21+
uses: ./.github/actions/build
2422

2523
- name: Deploy 🚀
2624
uses: JamesIves/github-pages-deploy-action@v4

.github/workflows/eslint.yml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,42 @@ on:
77
branches: [main, master]
88

99
jobs:
10+
changes:
11+
name: Check Changes
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check Changes
15+
uses: dorny/paths-filter@v2
16+
id: changes
17+
with:
18+
filters: |
19+
eslint:
20+
- '**.js,**.jsx,**.ts,**.tsx'
21+
1022
eslint:
1123
name: ESLint
24+
needs: changes
25+
if: needs.changes.outputs.eslint == 'true'
1226
runs-on: ubuntu-latest
1327
steps:
1428
- name: Checkout Code
1529
uses: actions/checkout@v3
1630

17-
- name: Install modules
18-
run: npm ci
31+
- name: Cache Node Modules
32+
uses: actions/cache@v3
33+
id: node_modules_cache_id
34+
with:
35+
path: "**/node_modules"
36+
key: ${{ runner.os }}-eslint
37+
38+
- name: Install Node Mudules
39+
if: steps.node_modules_cache_id.outputs.cache-hit != 'true'
40+
run: npm install \
41+
@typescript-eslint/eslint-plugin \
42+
@typescript-eslint/parser eslint \
43+
eslint-config-prettier \
44+
eslint-plugin-react
45+
shell: bash
1946

2047
- name: Run ESLint
2148
run: npx eslint . --ext .js,.jsx,.ts,.tsx

.github/workflows/prettier.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name: Prettier
33

44
on:
55
push:
6-
# pull_request:
7-
# branches: [master, main]
6+
pull_request:
7+
branches: [master, main]
88

99
jobs:
1010
prettier:
@@ -16,7 +16,22 @@ jobs:
1616
with:
1717
ref: ${{ github.head_ref }}
1818

19+
- name: Cache Node Modules
20+
uses: actions/cache@v3
21+
id: node_modules_cache_id
22+
with:
23+
path: "**/node_modules"
24+
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
25+
26+
- name: Install Node Mudules
27+
if: steps.node_modules_cache_id.outputs.cache-hit != 'true'
28+
run: npm ci
29+
shell: bash
30+
1931
- name: Run Prettier
20-
uses: creyD/prettier_action@v4.2
32+
run: npx prettier --write .
33+
34+
- name: Commit
35+
uses: stefanzweifel/git-auto-commit-action@v4
2136
with:
22-
prettier_options: --write .
37+
commit_message: Formatted!

.github/workflows/preview.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
---
22
name: Deploy PR previews
33

4-
# on:
5-
# pull_request:
6-
# types:
7-
# - opened
8-
# - reopened
9-
# - synchronize
10-
# - closed
4+
on:
5+
pull_request:
6+
types:
7+
- opened
8+
- reopened
9+
- synchronize
10+
- closed
11+
branches-ignore:
12+
- "**"
1113

1214
concurrency: preview-${{ github.ref }}
1315

@@ -19,10 +21,8 @@ jobs:
1921
- name: Checkout Code
2022
uses: actions/checkout@v3
2123

22-
- name: Install and Build
23-
run: |
24-
npm ci
25-
npm run build
24+
- name: Build
25+
uses: ./.github/actions/build
2626

2727
- name: Deploy preview
2828
uses: rossjrw/pr-preview-action@v1

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
# See https://pre-commit.com for more information
23
# See https://pre-commit.com/hooks.html for more hooks
34
exclude: my-website/
@@ -15,7 +16,6 @@ repos:
1516
hooks:
1617
- id: black
1718
- id: black-jupyter
18-
exclude: .*sum_1to100.ipynb
1919
- repo: https://github.com/pre-commit/mirrors-eslint
2020
rev: v8.26.0
2121
hooks:
@@ -36,7 +36,7 @@ repos:
3636
rev: v0.12.0
3737
hooks:
3838
- id: markdownlint
39-
args: [-r, ~MD033]
39+
args: [-r, "~MD033, ~MD013"]
4040
- repo: https://github.com/nbQA-dev/nbQA
4141
rev: 1.5.3
4242
hooks:

Pipfile

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

0 commit comments

Comments
 (0)