Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

fix: test each example individually #39

Merged
merged 10 commits into from
Sep 16, 2021
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
67 changes: 60 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,71 @@ on:
branches: [master]

jobs:
build:
examples:
runs-on: ubuntu-latest
name: Test ${{ matrix.project }}
strategy:
matrix:
project:
- browser-add-readable-stream
- browser-angular
- browser-browserify
- browser-create-react-app
- browser-exchange-files
- browser-ipns-publish
- browser-lit
- browser-mfs
- browser-nextjs
- browser-parceljs
- browser-readablestream
- browser-script-tag
- browser-service-worker
- browser-sharing-node-across-tabs
- browser-video-streaming
- browser-vue
- browser-webpack
- circuit-relaying
- custom-ipfs-repo
- custom-ipld-formats
- custom-libp2p
- http-client-browser-pubsub
- http-client-bundle-webpack
- http-client-name-api
- http-client-upload-file
- ipfs-101
- ipfs-client-add-files
- run-in-electron
- running-multiple-nodes
- traverse-ipld-graphs
- types-use-ipfs-from-ts
- types-use-ipfs-from-typed-js
defaults:
run:
working-directory: examples/${{ matrix.project }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- run: npm install
- uses: GabrielBB/xvfb-action@v1
name: Run tests
with:
run: npm test
working-directory: examples/${{ matrix.project }}

monorepo:
runs-on: ubuntu-latest
name: Test monorepo
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "16"
cache: "yarn"
node-version: 16
cache: yarn
- name: Install dependencies
run: yarn install
- name: Install dependencies for browsers
run: npx playwright install-deps
- name: Run test:examples
run: npx xvfb-maybe yarn run test:examples
- uses: GabrielBB/xvfb-action@v1
name: Run test:examples
with:
run: yarn run test:examples
1 change: 1 addition & 0 deletions examples/browser-exchange-files/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@babel/core": "^7.14.8",
"@playwright/test": "^1.12.3",
"ipfs-http-client": "^52.0.1",
"libp2p-webrtc-star": "^0.23.0",
"parcel": "latest",
"playwright": "^1.12.3",
"rimraf": "^3.0.2",
Expand Down
3 changes: 2 additions & 1 deletion examples/browser-ipns-publish/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"ipfs-utils": "^8.1.4",
"ipns": "^0.13.3",
"it-last": "^1.0.4",
"multihashes": "^4.0.2",
"libp2p-websockets": "^0.16.1",
"multiformats": "^9.4.7",
"p-retry": "^4.2.0",
"uint8arrays": "^3.0.0"
},
Expand Down
4 changes: 2 additions & 2 deletions examples/browser-ipns-publish/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ const cryptoKeys = require("human-crypto-keys"); // { getKeyPairFromSeed }
const { toString: uint8ArrayToString } = require('uint8arrays/to-string')
const { fromString: uint8ArrayFromString } = require('uint8arrays/from-string')
const { sha256 } = require('multiformats/hashes/sha2')
const { base58btc } = require('multiformats/bases/base58')
const WS = require('libp2p-websockets')
const transportKey = WS.prototype[Symbol.toStringTag]
const filters = require('libp2p-websockets/src/filters')
const mh = require('multihashes')

const { sleep, Logger, onEnterPress, catchAndLog } = require("./util");

Expand Down Expand Up @@ -205,7 +205,7 @@ async function main() {
last(ipfsAPI.name.resolve(keys.id, { stream: false })); // save the pubsub topic to the server to make them listen

// set up the topic from ipns key
let b58 = await mh.fromB58String(keys.id);
let b58 = base58btc.decode(`z${keys.id}`)
const ipnsKeys = ipns.getIdKeys(b58);
const topic = `${namespace}${uint8ArrayToString(ipnsKeys.routingKey._buf, 'base64url')}`;

Expand Down
3 changes: 2 additions & 1 deletion examples/browser-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"eslint-plugin-vue": "^7.2.0",
"playwright": "^1.12.3",
"rimraf": "^3.0.2",
"test-util-ipfs-example": "^1.0.2"
"test-util-ipfs-example": "^1.0.2",
"util": "^0.12.4"
oliveriosousa marked this conversation as resolved.
Show resolved Hide resolved
}
}