Skip to content

Commit e0f6d0b

Browse files
Create py.yml workflow file (#3)
* Create py.yml workflow file * run build-tsc before running typedoc * Update deploy.yml to include docs
1 parent 3890b6f commit e0f6d0b

File tree

9 files changed

+184
-45
lines changed

9 files changed

+184
-45
lines changed

.github/workflows/deploy.yml

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,37 @@ on:
44
- main
55

66
jobs:
7+
docs:
8+
runs-on: ubuntu-latest
9+
env:
10+
CI: true
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
submodules: "true"
15+
- name: Use Node.js 20.x
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: 20.x
19+
- name: yarn install
20+
working-directory: math-blocks
21+
run: yarn install
22+
- name: yarn build-tsc
23+
working-directory: math-blocks
24+
run: yarn build-tsc
25+
- name: yarn typedoc
26+
working-directory: math-blocks
27+
run: yarn typedoc
28+
- name: Upload Docs artifact
29+
uses: actions/upload-pages-artifact@v4
30+
with:
31+
path: ./docs/
32+
name: docs
33+
734
build:
35+
needs: docs
36+
permissions:
37+
actions: read # to access artifacts from the build job
838
runs-on: ubuntu-latest
939
env:
1040
CI: true
@@ -34,8 +64,13 @@ jobs:
3464
run: yarn install --frozen-lockfile
3565
- name: yarn build
3666
run: yarn build
67+
- name: download artifact
68+
uses: actions/download-artifact@v4
69+
with:
70+
name: docs
71+
path: ./dist/docs
3772
- name: Upload Page Artifact
38-
uses: actions/upload-pages-artifact@v3
73+
uses: actions/upload-pages-artifact@v4
3974
with:
4075
path: ./dist/
4176

.github/workflows/pr.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Node CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
env:
13+
CI: true
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Use Node.js 20.x
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: 20.x
20+
- name: Get yarn cache
21+
id: yarn-cache
22+
run: echo "::set-output name=dir::$(yarn cache dir)"
23+
- uses: actions/cache@v4
24+
with:
25+
path: ${{ steps.yarn-cache.outputs.dir }}
26+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
27+
restore-keys: |
28+
${{ runner.os }}-yarn-
29+
- name: Cache node modules
30+
uses: actions/cache@v4
31+
with:
32+
path: node_modules
33+
key: ${{ runner.OS }}-build-${{ hashFiles('**/yarn.lock') }}
34+
restore-keys: |
35+
${{ runner.OS }}-node_modules-
36+
- name: yarn install
37+
run: yarn install
38+
- name: lint
39+
run: yarn lint
40+
41+
build:
42+
runs-on: ubuntu-latest
43+
env:
44+
CI: true
45+
steps:
46+
- uses: actions/checkout@v4
47+
- name: Use Node.js 20.x
48+
uses: actions/setup-node@v4
49+
with:
50+
node-version: 20.x
51+
- name: Get yarn cache
52+
id: yarn-cache
53+
run: echo "::set-output name=dir::$(yarn cache dir)"
54+
- uses: actions/cache@v4
55+
with:
56+
path: ${{ steps.yarn-cache.outputs.dir }}
57+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
58+
restore-keys: |
59+
${{ runner.os }}-yarn-
60+
- name: Cache node modules
61+
uses: actions/cache@v4
62+
with:
63+
path: node_modules
64+
key: ${{ runner.OS }}-build-${{ hashFiles('**/yarn.lock') }}
65+
restore-keys: |
66+
${{ runner.OS }}-node_modules-
67+
- name: yarn install
68+
run: yarn install
69+
- name: yarn build
70+
run: yarn build
71+
72+
docs:
73+
runs-on: ubuntu-latest
74+
env:
75+
CI: true
76+
steps:
77+
- uses: actions/checkout@v4
78+
with:
79+
submodules: "true"
80+
- name: Use Node.js 20.x
81+
uses: actions/setup-node@v4
82+
with:
83+
node-version: 20.x
84+
- name: yarn install
85+
working-directory: math-blocks
86+
run: yarn install
87+
- name: yarn build-tsc
88+
working-directory: math-blocks
89+
run: yarn build-tsc
90+
- name: yarn typedoc
91+
working-directory: math-blocks
92+
run: yarn typedoc

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
node_modules
22
dist
3+
.buildcache
34
.vscode
45
.DS_Store
56
.vite

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "math-blocks"]
2+
path = math-blocks
3+
url = [email protected]:math-blocks/math-blocks.git

eslint.config.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
import js from '@eslint/js'
2-
import globals from 'globals'
3-
import reactHooks from 'eslint-plugin-react-hooks'
4-
import reactRefresh from 'eslint-plugin-react-refresh'
5-
import tseslint from 'typescript-eslint'
1+
import js from "@eslint/js";
2+
import globals from "globals";
3+
import reactHooks from "eslint-plugin-react-hooks";
4+
import reactRefresh from "eslint-plugin-react-refresh";
5+
import tseslint from "typescript-eslint";
66

77
export default tseslint.config(
8-
{ ignores: ['dist'] },
8+
{ ignores: ["dist", "math-blocks"] },
99
{
1010
extends: [js.configs.recommended, ...tseslint.configs.recommended],
11-
files: ['**/*.{ts,tsx}'],
11+
files: ["**/*.{ts,tsx}"],
1212
languageOptions: {
1313
ecmaVersion: 2020,
1414
globals: globals.browser,
1515
},
1616
plugins: {
17-
'react-hooks': reactHooks,
18-
'react-refresh': reactRefresh,
17+
"react-hooks": reactHooks,
18+
"react-refresh": reactRefresh,
1919
},
2020
rules: {
2121
...reactHooks.configs.recommended.rules,
22-
'react-refresh/only-export-components': [
23-
'warn',
22+
"react-refresh/only-export-components": [
23+
"warn",
2424
{ allowConstantExport: true },
2525
],
2626
},
27-
},
28-
)
27+
}
28+
);

math-blocks

Submodule math-blocks added at 71cc61a

src/homepage.tsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { Link } from "react-router-dom";
2+
3+
const Homepage = () => {
4+
return (
5+
<div>
6+
<h1>MathBlocks Demos</h1>
7+
<ul>
8+
<li>
9+
<Link to="/baseline">Baseline</Link>
10+
</li>
11+
<li>
12+
<Link to="/editor">Editor</Link>
13+
</li>
14+
<li>
15+
<Link to="/parser">Parser</Link>
16+
</li>
17+
<li>
18+
<Link to="/solver">Solver</Link>
19+
</li>
20+
</ul>
21+
</div>
22+
);
23+
};
24+
25+
export default Homepage;

src/index.tsx

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import { createRoot } from "react-dom/client";
2-
import { createHashRouter, RouterProvider, Link } from "react-router-dom";
2+
import { createHashRouter, RouterProvider } from "react-router-dom";
3+
4+
import Homepage from "./homepage";
5+
import NotFound from "./not-found";
36

47
import BaselinePage from "./baseline/baseline-page";
58
import EditorPage from "./editor/editor-page";
@@ -12,36 +15,6 @@ if (document.body) {
1215
document.body.appendChild(container);
1316
}
1417

15-
const Homepage = () => {
16-
return (
17-
<div>
18-
<h1>MathBlocks Demos</h1>
19-
<ul>
20-
<li>
21-
<Link to="/baseline">Baseline</Link>
22-
</li>
23-
<li>
24-
<Link to="/editor">Editor</Link>
25-
</li>
26-
<li>
27-
<Link to="/parser">Parser</Link>
28-
</li>
29-
<li>
30-
<Link to="/solver">Solver</Link>
31-
</li>
32-
</ul>
33-
</div>
34-
);
35-
};
36-
37-
const NotFound = () => {
38-
return (
39-
<div>
40-
<h1>404: Not Found</h1>
41-
</div>
42-
);
43-
};
44-
4518
const router = createHashRouter([
4619
{
4720
path: "/",

src/not-found.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const NotFound = () => {
2+
return (
3+
<div>
4+
<h1>404: Not Found</h1>
5+
</div>
6+
);
7+
};
8+
9+
export default NotFound;

0 commit comments

Comments
 (0)