Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup CI integration tests #6

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f57eaf4
Start importing model stream logic
PaulLeCam May 8, 2024
e0f2d38
Add events package
PaulLeCam May 10, 2024
21d8998
Add key-did package and tests for events
PaulLeCam May 10, 2024
38d72e0
Add tests for model protocol
PaulLeCam May 13, 2024
9750398
Add Ethereum DID package to test with did:pkh
PaulLeCam May 14, 2024
9f9d11d
Add tests for model client
PaulLeCam May 15, 2024
785b3ce
Add identifiers and codecs packages
PaulLeCam May 15, 2024
39f5c05
Include codecs in the relevant packages
PaulLeCam May 16, 2024
c401d5e
Update dependencies
PaulLeCam May 20, 2024
f6c609c
Add document protocol package
PaulLeCam May 21, 2024
1a42947
Add document client
PaulLeCam May 22, 2024
fede098
Add event container
PaulLeCam May 28, 2024
94a4793
Add document handler package
PaulLeCam May 29, 2024
deae0b9
Update dependencies
PaulLeCam Jun 11, 2024
998cb59
Add tests for document client
PaulLeCam Jun 12, 2024
1534d3b
Add tests for document handler
PaulLeCam Jun 14, 2024
fddbf71
Handle time event in model handler
PaulLeCam Jun 18, 2024
b8f0eb6
Add handlers for document events
PaulLeCam Jun 19, 2024
3364153
Add tests for MID events handling
PaulLeCam Jun 21, 2024
dbf20ef
Setup C1 integration tests
PaulLeCam Jun 25, 2024
4d51a8f
Add CI workflow for integration tests
PaulLeCam Jun 26, 2024
f6b7292
Remove option in workflow
PaulLeCam Jun 26, 2024
01f9b19
Run ceramic-one container as root
PaulLeCam Jun 26, 2024
e976e5b
Add env variable for the store dir in CI
PaulLeCam Jun 26, 2024
f2a91fc
Update states to use strings rather than CIDs
PaulLeCam Jun 26, 2024
50c3473
Update ceramic-one setup for CI
PaulLeCam Jun 27, 2024
dee76cd
Fix lint
PaulLeCam Jun 28, 2024
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
52 changes: 52 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Build and test
on: [push, pull_request]
env:
CI: true
jobs:
build:
name: Build, lint, and test on Node ${{ matrix.node }} and ${{ matrix.os }}

runs-on: ${{ matrix.os }}
strategy:
matrix:
node: [20, 22]
os: [ubuntu-latest, macOS-latest]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Use Node ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}

- name: Install pnpm
id: pnpm-install
uses: pnpm/action-setup@v3
with:
version: 9.3.0
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies and build
run: pnpm install --frozen-lockfile

- name: Lint
run: pnpm run lint:ci

- name: Test
run: pnpm run test:ci
53 changes: 53 additions & 0 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Integration tests
on: [pull_request]
env:
CI: true
jobs:
test:
name: Run integration tests
runs-on: ubuntu-latest

services:
ceramic:
image: public.ecr.aws/r5b3e0r5/3box/ceramic-one:latest
env:
CERAMIC_ONE_BIND_ADDRESS: 0.0.0.0:5001
CERAMIC_ONE_NETWORK: in-memory
CERAMIC_ONE_STORE_DIR: /
ports:
- 5001:5001

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 22

- name: Install pnpm
id: pnpm-install
uses: pnpm/action-setup@v3
with:
version: 9.3.0
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: pnpm-store

- name: Install dependencies and build
run: pnpm install --frozen-lockfile

- name: Test
run: cd tests/c1-integration && pnpm run test
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules
dist
.vscode
coverage
.vscode
.turbo
9 changes: 7 additions & 2 deletions .swcrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
{
"jsc": {
"parser": {
"syntax": "typescript"
"syntax": "typescript",
"decorators": true
},
"target": "es2022"
"target": "es2022",
"transform": {
"legacyDecorator": true,
"decoratorMetadata": true
}
}
}
15 changes: 10 additions & 5 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"$schema": "https://biomejs.dev/schemas/1.7.1/schema.json",
"$schema": "https://biomejs.dev/schemas/1.8.0/schema.json",
"organizeImports": {
"enabled": true,
"ignore": ["lib/**"]
"ignore": []
},
"formatter": {
"enabled": true,
"formatWithErrors": false,
"ignore": ["lib/**"],
"ignore": [],
"indentStyle": "space",
"lineWidth": 80
},
Expand All @@ -17,14 +17,19 @@
"quoteProperties": "asNeeded",
"quoteStyle": "single",
"semicolons": "asNeeded",
"trailingComma": "all"
"trailingCommas": "all"
}
},
"linter": {
"enabled": true,
"ignore": ["lib/**"],
"ignore": [],
"rules": {
"recommended": true
}
},
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
}
}
26 changes: 20 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
{
"name": "ceramic-sdk",
"private": true,
"packageManager": "[email protected]",
"scripts": {
"lint": "biome check --apply packages/*"
"build": "pnpm --filter \"@ceramic-sdk/*\" build:types && turbo run build:js",
"lint": "biome check --write packages/* tests/*",
"lint:ci": "biome ci packages/* tests/*",
"test": "turbo run test -- --passWithNoTests",
"test:ci": "turbo run test:ci -- --passWithNoTests"
},
"devDependencies": {
"@biomejs/biome": "1.7.1",
"@swc/cli": "^0.3.12",
"@swc/core": "^1.5.0",
"@types/node": "^20.12.7",
"@biomejs/biome": "1.8.2",
"@jest/globals": "^29.7.0",
"@swc/cli": "^0.3.14",
"@swc/core": "^1.6.5",
"@swc/jest": "^0.2.36",
"@types/jest": "^29.5.12",
"@types/node": "^20.14.8",
"del-cli": "^5.1.0",
"typescript": "^5.4.5"
"jest": "^29.7.0",
"tsx": "^4.15.7",
"turbo": "^2.0.5",
"typescript": "^5.5.2"
},
"pnpm": {
"overrides": {}
}
}
5 changes: 5 additions & 0 deletions packages/document-client/LICENSE-APACHE
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
19 changes: 19 additions & 0 deletions packages/document-client/LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
5 changes: 5 additions & 0 deletions packages/document-client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Ceramic Document stream client

## License

Dual licensed under MIT and Apache 2
60 changes: 60 additions & 0 deletions packages/document-client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"name": "@ceramic-sdk/document-client",
"version": "0.1.0",
"author": "3Box Labs",
"license": "(Apache-2.0 OR MIT)",
"keywords": ["ceramic", "stream", "document", "client"],
"repository": {
"type": "git",
"url": "https://github.com/ceramicstudio/ceramic-sdk",
"directory": "packages/document-client"
},
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
".": "./dist/index.js"
},
"files": ["dist"],
"engines": {
"node": ">=20"
},
"sideEffects": false,
"scripts": {
"build:clean": "del dist",
"build:js": "swc src -d ./dist --config-file ../../.swcrc --strip-leading-paths",
"build:types": "tsc --project tsconfig.json --emitDeclarationOnly --skipLibCheck",
"build": "pnpm build:clean && pnpm build:types && pnpm build:js",
"lint": "eslint src --fix",
"test": "node --experimental-vm-modules ../../node_modules/jest/bin/jest.js",
"test:ci": "pnpm run test --ci --coverage",
"prepare": "pnpm build",
"prepublishOnly": "package-check"
},
"dependencies": {
"@ceramic-sdk/document-protocol": "workspace:^",
"@ceramic-sdk/events": "workspace:^",
"@didtools/codecs": "^3.0.0",
"fast-json-patch": "^3.1.1"
},
"devDependencies": {
"@ceramic-sdk/identifiers": "workspace:^",
"@ceramic-sdk/key-did": "workspace:^",
"dids": "^5.0.2",
"uint8arrays": "^5.1.0"
},
"jest": {
"extensionsToTreatAsEsm": [".ts"],
"moduleNameMapper": {
"^(\\.{1,2}/.*)\\.js$": "$1"
},
"transform": {
"^.+\\.(t|j)s$": [
"@swc/jest",
{
"root": "../.."
}
]
}
}
}
Loading