Skip to content

Commit

Permalink
Create py.yml workflow file
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinbarabash committed Dec 29, 2024
1 parent 3890b6f commit 4fa98fa
Show file tree
Hide file tree
Showing 7 changed files with 144 additions and 44 deletions.
89 changes: 89 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Node CI

on:
push:
branches:
- main
pull_request:

jobs:
lint:
runs-on: ubuntu-latest
env:
CI: true
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Cache node modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.OS }}-build-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-node_modules-
- name: yarn install
run: yarn install
- name: lint
run: yarn lint

build:
runs-on: ubuntu-latest
env:
CI: true
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Cache node modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.OS }}-build-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-node_modules-
- name: yarn install
run: yarn install
- name: yarn build
run: yarn build

docs:
runs-on: ubuntu-latest
env:
CI: true
steps:
- uses: actions/checkout@v4
with:
submodules: "true"
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: yarn install
working-directory: math-blocks
run: yarn install
- name: yarn typedoc
working-directory: math-blocks
run: yarn typedoc
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "math-blocks"]
path = math-blocks
url = [email protected]:math-blocks/math-blocks.git
26 changes: 13 additions & 13 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'
import js from "@eslint/js";
import globals from "globals";
import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";
import tseslint from "typescript-eslint";

export default tseslint.config(
{ ignores: ['dist'] },
{ ignores: ["dist", "math-blocks"] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
files: ["**/*.{ts,tsx}"],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
"react-hooks": reactHooks,
"react-refresh": reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': [
'warn',
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
},
},
)
}
);
1 change: 1 addition & 0 deletions math-blocks
Submodule math-blocks added at 71cc61
25 changes: 25 additions & 0 deletions src/homepage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Link } from "react-router-dom";

const Homepage = () => {
return (
<div>
<h1>MathBlocks Demos</h1>
<ul>
<li>
<Link to="/baseline">Baseline</Link>
</li>
<li>
<Link to="/editor">Editor</Link>
</li>
<li>
<Link to="/parser">Parser</Link>
</li>
<li>
<Link to="/solver">Solver</Link>
</li>
</ul>
</div>
);
};

export default Homepage;
35 changes: 4 additions & 31 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { createRoot } from "react-dom/client";
import { createHashRouter, RouterProvider, Link } from "react-router-dom";
import { createHashRouter, RouterProvider } from "react-router-dom";

import Homepage from "./homepage";
import NotFound from "./not-found";

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

const Homepage = () => {
return (
<div>
<h1>MathBlocks Demos</h1>
<ul>
<li>
<Link to="/baseline">Baseline</Link>
</li>
<li>
<Link to="/editor">Editor</Link>
</li>
<li>
<Link to="/parser">Parser</Link>
</li>
<li>
<Link to="/solver">Solver</Link>
</li>
</ul>
</div>
);
};

const NotFound = () => {
return (
<div>
<h1>404: Not Found</h1>
</div>
);
};

const router = createHashRouter([
{
path: "/",
Expand Down
9 changes: 9 additions & 0 deletions src/not-found.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const NotFound = () => {
return (
<div>
<h1>404: Not Found</h1>
</div>
);
};

export default NotFound;

0 comments on commit 4fa98fa

Please sign in to comment.