Skip to content

Commit

Permalink
*: use npm workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
tharvik committed Feb 5, 2024
1 parent 9159787 commit 134bbdd
Show file tree
Hide file tree
Showing 46 changed files with 19,730 additions and 9,529 deletions.
1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

103 changes: 34 additions & 69 deletions .github/workflows/lint-test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:

env:
node_version: 16
lib_dir: discojs/
lib_core_dir: discojs/discojs-core/
lib_web_dir: discojs/discojs-web/
lib_node_dir: discojs/discojs-node/
Expand Down Expand Up @@ -37,11 +36,8 @@ jobs:
with:
node-version: ${{ env.node_version }}
cache: npm
cache-dependency-path: ${{ env.lib_dir }}/package-lock.json
- run: npm ci
working-directory: ${{ env.lib_dir }}
- run: npm run lint
# TODO npx ts-standard

lint-lib-node:
runs-on: ubuntu-latest
Expand All @@ -54,9 +50,8 @@ jobs:
with:
node-version: ${{ env.node_version }}
cache: npm
cache-dependency-path: ${{ env.lib_dir }}/package-lock.json
- run: npm ci
working-directory: ${{ env.lib_dir }}
- run: npm run build --workspace=@epfml/discojs-core
- run: npm run lint

lint-lib-web:
Expand All @@ -70,9 +65,8 @@ jobs:
with:
node-version: ${{ env.node_version }}
cache: npm
cache-dependency-path: ${{ env.lib_dir }}/package-lock.json
- run: npm ci
working-directory: ${{ env.lib_dir }}
- run: npm run build --workspace=@epfml/discojs-core
- run: npm run lint

lint-server:
Expand All @@ -88,15 +82,11 @@ jobs:
node-version: ${{ env.node_version }}
cache: npm
cache-dependency-path: |
${{ env.lib_dir }}/package-lock.json
package-lock.json
${{ env.server_dir }}/package-lock.json
- run: npm ci
working-directory: ${{ env.lib_dir }}
- run: npm run build
working-directory: ${{ env.lib_node_dir }}
- run: npm ci && npm link ../discojs/discojs-node
- run: npm run build --workspace=@epfml/discojs-{core,node}
- run: npx eslint --max-warnings 0 .
# TODO npx ts-standard

lint-web-client:
needs: build-lib-web
Expand All @@ -111,13 +101,10 @@ jobs:
node-version: ${{ env.node_version }}
cache: npm
cache-dependency-path: |
${{ env.lib_dir }}/package-lock.json
package-lock.json
${{ env.client_dir }}/package-lock.json
- run: npm ci
working-directory: ${{ env.lib_dir }}
- run: npm run build
working-directory: ${{ env.lib_web_dir }}
- run: npm ci
- run: npm run build --workspace=@epfml/discojs{-core,}
- run: npm run lint

build-lib-node:
Expand All @@ -132,9 +119,8 @@ jobs:
with:
node-version: ${{ env.node_version }}
cache: npm
cache-dependency-path: ${{ env.lib_dir }}/package-lock.json
- run: npm ci
working-directory: ${{ env.lib_dir }}
- run: npm run build --workspace=@epfml/discojs-core
- run: npm run build

build-lib-web:
Expand All @@ -149,9 +135,8 @@ jobs:
with:
node-version: ${{ env.node_version }}
cache: npm
cache-dependency-path: ${{ env.lib_dir }}/package-lock.json
- run: npm ci
working-directory: ${{ env.lib_dir }}
- run: npm run build --workspace=@epfml/discojs-core
- run: npm run build

build-server:
Expand All @@ -167,13 +152,10 @@ jobs:
node-version: ${{ env.node_version }}
cache: npm
cache-dependency-path: |
${{ env.lib_dir }}/package-lock.json
package-lock.json
${{ env.server_dir }}/package-lock.json
- run: npm ci
working-directory: ${{ env.lib_dir }}
- run: npm run build
working-directory: ${{ env.lib_node_dir }}
- run: npm ci && npm link ../discojs/discojs-node
- run: npm run build --workspace=@epfml/discojs-{core,node}
- run: npm run build

build-server-docker:
Expand All @@ -199,17 +181,15 @@ jobs:
node-version: ${{ env.node_version }}
cache: npm
cache-dependency-path: |
${{ env.lib_dir }}/package-lock.json
package-lock.json
${{ env.client_dir }}/package-lock.json
- run: npm ci
working-directory: ${{ env.lib_dir }}
- run: npm run build
working-directory: ${{ env.lib_web_dir }}
- run: npm ci
- run: npm run build --workspace=@epfml/discojs{-core,}
- run: npm run build

test-lib-core:
needs: [build-lib-node, build-server-docker, test-server, download-training-data]
needs:
[build-lib-node, build-server-docker, test-server, download-training-data]
runs-on: ubuntu-latest
defaults:
run:
Expand All @@ -224,16 +204,14 @@ jobs:
with:
node-version: ${{ env.node_version }}
cache: npm
cache-dependency-path: |
${{ env.lib_dir }}/package-lock.json
- run: npm ci
working-directory: ${{ env.lib_dir }}
- run: npm run build
working-directory: ${{ env.lib_node_dir }}
- run: npm run build --workspace=@epfml/discojs-{core,node}
- run: ../../with_server npm test

test-lib-node:
needs: [build-lib-node, build-server-docker, test-server, download-training-data]
needs:
[build-lib-node, build-server-docker, test-server, download-training-data]
runs-on: ubuntu-latest
defaults:
run:
Expand All @@ -248,16 +226,13 @@ jobs:
with:
node-version: ${{ env.node_version }}
cache: npm
cache-dependency-path: |
${{ env.lib_dir }}/package-lock.json
- run: npm ci
working-directory: ${{ env.lib_dir }}
- run: npm run build
working-directory: ${{ env.lib_node_dir }}
- run: npm run build --workspace=@epfml/discojs-core
- run: ../../with_server npm test

test-lib-web:
needs: [build-lib-node, build-server-docker, test-server, download-training-data]
needs:
[build-lib-node, build-server-docker, test-server, download-training-data]
runs-on: ubuntu-latest
defaults:
run:
Expand All @@ -272,12 +247,8 @@ jobs:
with:
node-version: ${{ env.node_version }}
cache: npm
cache-dependency-path: |
${{ env.lib_dir }}/package-lock.json
- run: npm ci
working-directory: ${{ env.lib_dir }}
- run: npm run build
working-directory: ${{ env.lib_node_dir }}
- run: npm run build --workspace=@epfml/discojs-core
- run: ../../with_server npm test

test-server:
Expand All @@ -297,17 +268,20 @@ jobs:
node-version: ${{ env.node_version }}
cache: npm
cache-dependency-path: |
${{ env.lib_dir }}/package-lock.json
package-lock.json
${{ env.server_dir }}/package-lock.json
- run: npm ci
working-directory: ${{ env.lib_dir }}
- run: npm run build
working-directory: ${{ env.lib_node_dir }}
- run: npm ci && npm link ../discojs/discojs-node
- run: npm run build --workspace=@epfml/discojs-{core,node}
- run: npm test

test-web-client:
needs: [build-web-client, build-server-docker, test-server, download-training-data]
needs:
[
build-web-client,
build-server-docker,
test-server,
download-training-data,
]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -320,15 +294,11 @@ jobs:
node-version: ${{ env.node_version }}
cache: npm
cache-dependency-path: |
${{ env.lib_dir }}/package-lock.json
package-lock.json
${{ env.server_dir }}/package-lock.json
${{ env.client_dir }}/package-lock.json
- run: npm ci
working-directory: ${{ env.lib_dir }}
- run: npm run build
working-directory: ${{ env.lib_web_dir }}
- run: npm ci
working-directory: web-client/cypress
- run: npm run build --workspace=@epfml/discojs{-core,}
- uses: cypress-io/github-action@v4
with:
browser: chromium
Expand All @@ -354,14 +324,9 @@ jobs:
node-version: ${{ env.node_version }}
cache: npm
cache-dependency-path: |
${{ env.lib_dir }}/package-lock.json
package-lock.json
${{ env.server_dir }}/package-lock.json
${{ env.cli_dir }}/package-lock.json
- run: npm ci
working-directory: ${{ env.lib_dir }}
- run: npm run build
working-directory: ${{ env.lib_node_dir }}
- run: npm ci && npm link ../${{ env.lib_node_dir }} && npm run build
working-directory: ${{ env.server_dir }}
- run: npm ci && npm link ../${{ env.server_dir }} ../${{ env.lib_node_dir }}
- run: npm run build --workspace=@epfml/{discojs-{core,node},disco-server}
- run: npm start -- -t cifar10 -u 1 -e 1
17 changes: 7 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,16 @@ RUN apt-get upgrade -y \
&& curl --silent --location https://deb.nodesource.com/setup_16.x | bash - \
&& apt install -y nodejs

COPY discojs/package*.json discojs/
RUN cd discojs/ && npm ci
COPY package*.json .
COPY discojs/discojs-core/package.json discojs/discojs-core/
COPY discojs/discojs-node/package.json discojs/discojs-node/
COPY server/package*.json server/
RUN npm ci

COPY discojs/tsconfig.base.json discojs/

COPY discojs/discojs-core/types/ discojs/discojs-core/types/
COPY discojs/discojs-core/src/ discojs/discojs-core/src/

COPY discojs/discojs-core/ discojs/discojs-core/
COPY discojs/discojs-node/ discojs/discojs-node/
RUN cd discojs/discojs-node/ && npm run build

COPY server/package*.json server/
RUN cd server/ && npm ci && npm link ../discojs/discojs-node
RUN npm run build --workspace=@epfml/discojs-core --workspace=@epfml/discojs-node

COPY server/ server/
RUN cd server/ && npm run build
Expand Down
12 changes: 6 additions & 6 deletions cli/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
{
"name": "@epfml/disco-cli",
"private": true,
"main": "src/benchmark.ts",
"main": "dist/benchmark.ts",
"scripts": {
"start": "ts-node src/benchmark.ts"
"build": "tsc",
"test": ": nothing",
"start": "npm run build && node dist/benchmark.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"@epfml/disco-server": "2",
"@epfml/discojs-node": "2",
"@epfml/disco-server": "*",
"@epfml/discojs-node": "*",
"immutable": "4"
},
"devDependencies": {
Expand All @@ -21,8 +23,6 @@
"eslint-plugin-node": "11",
"eslint-plugin-promise": "5",
"ts-command-line-args": "2",
"ts-node": "10",
"ts-node-register": "1",
"typescript": "<4.5.0"
}
}
4 changes: 1 addition & 3 deletions cli/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
"declaration": true,

"baseUrl": "src",
"paths": {
"@/*": ["*"]
}
"outDir": "dist",
},
"include": ["src"]
}
38 changes: 0 additions & 38 deletions discojs/build.bat

This file was deleted.

4 changes: 0 additions & 4 deletions discojs/build.sh

This file was deleted.

2 changes: 0 additions & 2 deletions discojs/discojs-core/.gitignore

This file was deleted.

4 changes: 1 addition & 3 deletions discojs/discojs-core/.mocharc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"extension": ["ts"],
"spec": [
"src/**/*.spec.ts"
],
"spec": ["src/**/*.spec.ts"],
"require": "ts-node/register"
}
Loading

0 comments on commit 134bbdd

Please sign in to comment.