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 12, 2024
1 parent 19adfe5 commit 58b27f0
Show file tree
Hide file tree
Showing 54 changed files with 18,788 additions and 59,630 deletions.
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
Loading

0 comments on commit 58b27f0

Please sign in to comment.