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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,28 @@ on:
push:
paths:
- 'client/**'
- 'Makefile'
- '.github/workflows/unit_tests.yml'
- '.github/workflows/client_tests.yml'
pull_request:
paths:
- 'client/**'
- 'Makefile'
- '.github/workflows/unit_tests.yml'
- '.github/workflows/client_tests.yml'

jobs:
python:
python_client_unittests:
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: "./client"
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python: [3.5, 3.6, 3.7, 3.8]
python: [3.6, 3.7, 3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
python-version: ${{ matrix.python }}
- name: venv cache
id: venvcache
uses: actions/cache@v2
Expand Down Expand Up @@ -72,12 +70,10 @@ jobs:
run: |
make coverage.xml
- name: Codecov
# Switch this back to v1 once codecov-actions fixes their tags.
uses: codecov/codecov-action@v1.0.7
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
flags: unittests
env_vars: OS,PYTHON
flags: ${{ matrix.os }},python,python-${{ matrix.python }},client
name: ci-codecov
# This action has a tendency to timeout
fail_ci_if_error: false
55 changes: 55 additions & 0 deletions .github/workflows/dashboard_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Dashboard Unit Tests

on:
push:
paths:
- 'dashboard/**'
- '.github/workflows/dashboard_tests.yml'
pull_request:
paths:
- 'dashboard/**'
- '.github/workflows/dashboard_tests.yml'

jobs:
dashboard_unittests:
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: "./dashboard"
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node: [12.x, 14.x]
steps:
- uses: actions/checkout@v2
- name: Set up Node.js ${{ matrix.node }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- name: Node modules cache
id: nodecache
uses: actions/cache@v2
with:
path: "./node_modules"
key: ${{ runner.os }}-${{ matrix.node }}-node_modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-${{ matrix.node }}-node_modules-
- name: Install dependencies
if: steps.nodecache.outputs.cache-hit != 'true'
run: |
make install-dev
- name: Check format
run: |
make check-format
- name: Test
run: |
# Generating a coverage report also runs the tests.
make coverage
- name: Codecov
uses: codecov/codecov-action@v1
with:
directory: ./coverage
flags: ${{ matrix.os }},node,node-${{ matrix.node }},dashboard
name: ci-codecov
# This action has a tendency to timeout
fail_ci_if_error: false
29 changes: 29 additions & 0 deletions dashboard/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# print out test coverage to sysout and into coverage directory. We add .PHONY
# to make sure that it always runs even if the coverage directory has been
# generated.
.PHONY: coverage
coverage: install-dev
npm test -- --coverage

# Run all tests in src/ that end in .test.js or .spec.js. Outside of the CI this
# runs tests on all affected files that would be committed.
test: install-dev
npm run test

clean:
rm build/.install-dev

# format formats all HTML/CSS/JS/JSON/etc. files in-place.
format: install-dev
npx prettier --write .

# returns a non-zero value if code is not formatted.
check-format: install-dev
npx prettier --check .

install-dev: build/.install-dev

# install-dev installs all dashboard dependencies.
build/.install-dev: package.json package-lock.json
npm install
mkdir -p build && touch build/.install-dev
12 changes: 7 additions & 5 deletions dashboard/src/components/app/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ import { ThemeProvider } from "@material-ui/core/styles";
import Nav from "components/nav";

export const App = (props) => (
<Wrapper><Nav></Nav></Wrapper>
<Wrapper>
<Nav></Nav>
</Wrapper>
);

export const Wrapper = ({ children }) => (
<ThemeProvider theme={theme}>
<CssBaseline />
{ children }
</ThemeProvider>
<ThemeProvider theme={theme}>
<CssBaseline />
{children}
</ThemeProvider>
);

export default App;
6 changes: 4 additions & 2 deletions dashboard/src/components/nav/Nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,11 @@ const NavDrawerSections = [

export const DrawerLists = ({ classes, sections }) =>
sections
.map((sectionProps) => <DrawerList classes={classes} {...sectionProps} />)
.map((sectionProps) => (
<DrawerList key={sectionProps.name} classes={classes} {...sectionProps} />
))
// Add a divider before each section
.flatMap((section) => [<Divider />, section]);
.flatMap((section, idx) => [<Divider key={idx} />, section]);

export const DrawerList = ({ classes, name, items }) => (
<List>
Expand Down
15 changes: 11 additions & 4 deletions dashboard/src/components/nav/Nav.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ describe("Nav", () => {
};

it("hasn't changed", () => {
const tree = renderer.create(<Nav><div>abc</div><div>def</div></Nav>).toJSON();
const tree = renderer
.create(
<Nav>
<div>abc</div>
<div>def</div>
</Nav>
)
.toJSON();
expect(tree).toMatchSnapshot();
});

Expand All @@ -31,13 +38,13 @@ describe("Nav", () => {
);

it("renders sections", () => {
expect(drawerLists.find("DrawerList")).toHaveLength(3)
expect(drawerLists.find("DrawerList")).toHaveLength(3);
});

it("prepends divider", () => {
expect(drawerLists).toHaveLength(6)
expect(drawerLists).toHaveLength(6);
for (var i of [0, 2, 4]) {
expect(drawerLists.at(i).name()).toMatch(/Divider/)
expect(drawerLists.at(i).name()).toMatch(/Divider/);
}
});
});
Expand Down
3 changes: 1 addition & 2 deletions dashboard/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import * as serviceWorker from "./serviceWorker";

ReactDOM.render(
<React.StrictMode>
<App />
,
<App />,
</React.StrictMode>,
document.querySelector("#root")
);
Expand Down