Skip to content

Commit

Permalink
feat(ci): fix package mismatch; add ci tests and build (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
d-roak authored Jun 19, 2024
1 parent 98123d5 commit aec1f2f
Show file tree
Hide file tree
Showing 16 changed files with 137 additions and 47 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Build Packages
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build-crdt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- shell: bash
run: |
cd packages/crdt
yarn install --frozen-lockfile
yarn build
build-network:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- shell: bash
run: |
cd packages/network
yarn install --frozen-lockfile
yarn build
build-node:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- shell: bash
run: |
cd packages/node
yarn install --frozen-lockfile
yarn build
build-object:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- shell: bash
run: |
cd packages/object
yarn install --frozen-lockfile
yarn build
build-example-canvas:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- shell: bash
run: |
# needs to build dist beforehand
cd packages/node
yarn install --frozen-lockfile
yarn build
cd ../../examples/canvas
yarn install --frozen-lockfile
yarn build
46 changes: 46 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Test Packages
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test-crdt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- shell: bash
run: |
cd packages/crdt
yarn install --frozen-lockfile
yarn test
test-network:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- shell: bash
run: |
cd packages/network
yarn install --frozen-lockfile
yarn test
test-node:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- shell: bash
run: |
cd packages/node
yarn install --frozen-lockfile
yarn test
test-object:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- shell: bash
run: |
cd packages/object
yarn install --frozen-lockfile
yarn test
4 changes: 2 additions & 2 deletions examples/canvas/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"version": "1.0.0",
"license": "MIT",
"scripts": {
"build": "webpack",
"clean": "rm -rf dist/ node_modules/",
"start": "ts-node ./src/index.ts",
"dev": "webpack-dev-server --hot",
"build": "webpack"
"start": "ts-node ./src/index.ts"
},
"dependencies": {
"@topology-foundation/crdt": "file:../../packages/crdt",
Expand Down
1 change: 0 additions & 1 deletion examples/canvas/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const render = () => {
canvas_element.innerHTML = "";
canvas_element.style.display = "inline-grid";

// TODO: adjust this to depend on the width x height
canvas_element.style.gridTemplateColumns = Array(canvas.length)
.fill("1fr")
.join(" ");
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
"url": "https://github.com/topology-foundation/ts-topology/issues"
},
"devDependencies": {
"typescript": "^5.4.5"
"@types/node": "^20.14.2",
"typescript": "^5.4.5",
"vitest": "^1.6.0"
},
"workspaces": [
"packages/*"
],
"workspaces": ["packages/*"],
"private": true
}
14 changes: 3 additions & 11 deletions packages/crdt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@
},
"type": "module",
"types": "./dist/src/index.d.ts",
"files": [
"src",
"dist",
"!dist/test",
"!**/*.tsbuildinfo"
],
"files": ["src", "dist", "!dist/test", "!**/*.tsbuildinfo"],
"exports": {
".": {
"types": "./dist/src/index.d.ts",
Expand All @@ -22,10 +17,7 @@
},
"scripts": {
"build": "tsc -b",
"clean": "rm -rf dist/ node_modules/"
},
"devDependencies": {
"@types/node": "^20.14.2",
"typescript": "^5.4.5"
"clean": "rm -rf dist/ node_modules/",
"test": "vitest"
}
}
3 changes: 3 additions & 0 deletions packages/crdt/tests/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { test } from "vitest";

test("mock", () => {});
7 changes: 3 additions & 4 deletions packages/network/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@
},
"scripts": {
"build": "tsc -b",
"clean": "rm -rf dist/ node_modules/"
"clean": "rm -rf dist/ node_modules/",
"test": "vitest"
},
"devDependencies": {
"@libp2p/interface": "^1.4.0",
"@types/node": "^20.14.2",
"react-native-webrtc": "^124.0.1",
"typescript": "^5.4.5"
"react-native-webrtc": "^124.0.1"
},
"dependencies": {
"@chainsafe/libp2p-gossipsub": "^13.0.0",
Expand Down
3 changes: 3 additions & 0 deletions packages/network/tests/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { test } from "vitest";

test("mock", () => {});
2 changes: 0 additions & 2 deletions packages/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@
"test": "vitest"
},
"devDependencies": {
"@types/node": "^20.14.2",
"tsx": "^4.15.6",
"typescript": "^5.4.5",
"vitest": "^1.6.0"
},
"dependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/node/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import {
TopologyNetworkNode,
TopologyNetworkNodeConfig,
streamToString,
} from "@topologygg/network";
import { TopologyObject } from "@topologygg/object";
} from "@topology-foundation/network";
import { TopologyObject } from "@topology-foundation/object";
import { TopologyObjectStore } from "./store";
import { fromString as uint8ArrayFromString } from "uint8arrays/from-string";
import { toString as uint8ArrayToString } from "uint8arrays/to-string";
Expand Down
2 changes: 1 addition & 1 deletion packages/node/src/run_relay.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createRelayNode } from "@topologygg/network";
import { createRelayNode } from "@topology-foundation/network";

export async function start() {
const node = await createRelayNode();
Expand Down
2 changes: 1 addition & 1 deletion packages/node/src/store.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TopologyObject } from "@topologygg/object";
import { TopologyObject } from "@topology-foundation/object";

export class TopologyObjectStore {
// TODO: should be abstracted in handling multible types of storage
Expand Down
8 changes: 2 additions & 6 deletions packages/node/tests/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
import { expect, test } from "vitest";
import { TopologyNode } from "../src/index";
import { test } from "vitest";

test("start node", () => {
const node = new TopologyNode();
node.start();
});
test("mock", () => {});
17 changes: 4 additions & 13 deletions packages/object/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@
},
"type": "module",
"types": "./dist/src/index.d.ts",
"files": [
"src",
"dist",
"!dist/test",
"!**/*.tsbuildinfo"
],
"files": ["src", "dist", "!dist/test", "!**/*.tsbuildinfo"],
"exports": {
".": {
"types": "./dist/src/index.d.ts",
Expand All @@ -22,11 +17,7 @@
},
"scripts": {
"build": "tsc -b",
"clean": "rm -rf dist/ node_modules/"
},
"devDependencies": {
"@types/node": "^20.14.2",
"typescript": "^5.4.5"
},
"dependencies": {}
"clean": "rm -rf dist/ node_modules/",
"test": "vitest"
}
}
3 changes: 3 additions & 0 deletions packages/object/tests/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { test } from "vitest";

test("mock", () => {});

0 comments on commit aec1f2f

Please sign in to comment.