mirror of
https://github.com/fluencelabs/trust-graph-test
synced 2025-04-24 19:52:27 +00:00
setup gh, local-network and add blank example
This commit is contained in:
parent
e5c0cc3a8f
commit
5ed8ca0a34
14
.github/download_marine.sh
vendored
Executable file
14
.github/download_marine.sh
vendored
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
set -o pipefail -o errexit -o nounset
|
||||
set -x
|
||||
|
||||
MARINE_RELEASE="https://api.github.com/repos/fluencelabs/marine/releases/latest"
|
||||
OUT_DIR=/usr/local/bin
|
||||
|
||||
# get metadata about release
|
||||
curl -s -H "Accept: application/vnd.github.v3+json" $MARINE_RELEASE |
|
||||
# extract url and name for asset with name "marine"
|
||||
# also append $OUT_DIR to each name so file is saved to $OUT_DIR
|
||||
jq -r ".assets | .[] | select(.name == \"marine\") | \"\(.browser_download_url) $OUT_DIR/\(.name)\"" |
|
||||
# download assets
|
||||
xargs -n2 bash -c 'curl -L $0 -o $1 && chmod +x $1'
|
5
.github/workflows/changelog_config.json
vendored
Normal file
5
.github/workflows/changelog_config.json
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"template": "${{CHANGELOG}}\n\n${{UNCATEGORIZED}}",
|
||||
"pr_template": "- #${{NUMBER}} ${{TITLE}}",
|
||||
"empty_template": "- no changes"
|
||||
}
|
165
.github/workflows/release.yml
vendored
Normal file
165
.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,165 @@
|
||||
name: "publish-release"
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
|
||||
jobs:
|
||||
npm-publish:
|
||||
name: "Publish"
|
||||
runs-on: ubuntu-latest
|
||||
container: rust
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
steps:
|
||||
### Setup
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set env
|
||||
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
||||
|
||||
- name: Download jq
|
||||
run: |
|
||||
curl -L https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 -o /usr/local/bin/jq
|
||||
chmod +x /usr/local/bin/jq
|
||||
|
||||
- name: Download marine
|
||||
run: bash $GITHUB_WORKSPACE/.github/download_marine.sh
|
||||
|
||||
- uses: actions/setup-java@v2
|
||||
with:
|
||||
distribution: 'adopt'
|
||||
java-version: '11'
|
||||
|
||||
- name: Cache npm
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-node-v01-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-v01-
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: "15"
|
||||
registry-url: "https://registry.npmjs.org"
|
||||
|
||||
- name: Cache cargo
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
~/.cargo/bin
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: Install Rust
|
||||
working-directory: ./service
|
||||
run: |
|
||||
rustup toolchain install nightly-2021-04-24-x86_64-unknown-linux-gnu
|
||||
rustup default nightly-2021-04-24-x86_64-unknown-linux-gnu
|
||||
rustup override set nightly-2021-04-24-x86_64-unknown-linux-gnu
|
||||
rustup target add wasm32-wasi --toolchain nightly-2021-04-24-x86_64-unknown-linux-gnu
|
||||
|
||||
### Build
|
||||
- name: trust-graph.wasm
|
||||
working-directory: ./service
|
||||
run: ./build.sh
|
||||
|
||||
- name: Check Aqua compiles
|
||||
working-directory: ./aqua
|
||||
run: |
|
||||
npm i
|
||||
npm run build
|
||||
|
||||
- name: Create builtin distribution package
|
||||
run: |
|
||||
./builtin-package/package.sh
|
||||
|
||||
- name: Build Changelog
|
||||
id: changelog
|
||||
uses: mikepenz/release-changelog-builder-action@v1
|
||||
with:
|
||||
configuration: ".github/workflows/changelog_config.json"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
## Publish
|
||||
- name: Release
|
||||
id: release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
name: aqua-dht ${{ env.RELEASE_VERSION }}
|
||||
tag_name: ${{ env.RELEASE_VERSION }}
|
||||
files: |
|
||||
trust-graph.tar.gz
|
||||
body: ${{steps.changelog.outputs.changelog}}
|
||||
draft: false
|
||||
prerelease: false
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
### Publish Aqua API
|
||||
- name: Publish Aqua API
|
||||
run: |
|
||||
npm version ${{ env.RELEASE_VERSION }} --allow-same-version
|
||||
npm publish --access public
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
working-directory: ./aqua
|
||||
|
||||
## Update node-distro repo
|
||||
- name: Get tar.gz URL
|
||||
id: package-url
|
||||
uses: actions/github-script@v4
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
result-encoding: string
|
||||
script: |
|
||||
try {
|
||||
let assets = await github.repos.listReleaseAssets({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
release_id: "${{ steps.release.outputs.id }}",
|
||||
});
|
||||
console.dir(assets);
|
||||
let package = assets.data.find((a) => a.name === 'trust-graph.tar.gz');
|
||||
let url = package.browser_download_url;
|
||||
console.log("URL: " + url);
|
||||
return url;
|
||||
} catch (e) {
|
||||
console.log("Err: " + e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
- name: Calculate SHA256
|
||||
run: |
|
||||
du -hs aqua-dht.tar.gz
|
||||
echo $(sha256sum trust-graph.tar.gz)
|
||||
echo "SHA256=$(sha256sum trust-graph.tar.gz | awk '{ print $1 }')" >> $GITHUB_ENV
|
||||
|
||||
- name: Update version in node-distro repo
|
||||
uses: benc-uk/workflow-dispatch@v1
|
||||
with:
|
||||
workflow: update_service
|
||||
repo: fluencelabs/node-distro
|
||||
ref: 'main'
|
||||
token: ${{ secrets.PERSONAL_TOKEN }}
|
||||
inputs: '{
|
||||
"name": "trust-graph",
|
||||
"version": "${{ env.RELEASE_VERSION }}",
|
||||
"url": "${{ steps.package-url.outputs.result }}",
|
||||
"sha256": "${{ env.SHA256 }}"
|
||||
}'
|
||||
|
||||
- name: Log notice
|
||||
uses: actions/github-script@v4
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
console.dir(core);
|
||||
core.info("trust-graph was updated to ${{ env.RELEASE_VERSION }} in node-distro repo");
|
17
.github/workflows/tag.yml
vendored
Normal file
17
.github/workflows/tag.yml
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
name: "tag"
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
tag:
|
||||
name: "Tag"
|
||||
runs-on: "ubuntu-latest"
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Bump version and push tag
|
||||
id: tag_version
|
||||
uses: mathieudutour/github-tag-action@v5.5
|
||||
with:
|
||||
github_token: ${{ secrets.PERSONAL_TOKEN }}
|
3
example/aqua/export.aqua
Normal file
3
example/aqua/export.aqua
Normal file
@ -0,0 +1,3 @@
|
||||
import TrustGraph from "../../aqua/trust-graph.aqua"
|
||||
|
||||
export TrustGraph
|
15
example/index.ts
Normal file
15
example/index.ts
Normal file
@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Copyright 2021 Fluence Labs Limited
|
||||
*
|
||||
* 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.
|
||||
*/
|
69
example/tsconfig.json
Normal file
69
example/tsconfig.json
Normal file
@ -0,0 +1,69 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
||||
|
||||
/* Basic Options */
|
||||
// "incremental": true, /* Enable incremental compilation */
|
||||
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
|
||||
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
|
||||
// "lib": [], /* Specify library files to be included in the compilation. */
|
||||
// "allowJs": true, /* Allow javascript files to be compiled. */
|
||||
// "checkJs": true, /* Report errors in .js files. */
|
||||
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
||||
// "declaration": true, /* Generates corresponding '.d.ts' file. */
|
||||
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
||||
// "sourceMap": true, /* Generates corresponding '.map' file. */
|
||||
// "outFile": "./", /* Concatenate and emit output to single file. */
|
||||
"outDir": "./dist", /* Redirect output structure to the directory. */
|
||||
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
||||
// "composite": true, /* Enable project compilation */
|
||||
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
|
||||
// "removeComments": true, /* Do not emit comments to output. */
|
||||
// "noEmit": true, /* Do not emit outputs. */
|
||||
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
||||
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
||||
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
||||
|
||||
/* Strict Type-Checking Options */
|
||||
"strict": true, /* Enable all strict type-checking options. */
|
||||
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
||||
// "strictNullChecks": true, /* Enable strict null checks. */
|
||||
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
||||
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
|
||||
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
||||
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
||||
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
||||
|
||||
/* Additional Checks */
|
||||
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
||||
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
||||
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
||||
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
||||
|
||||
/* Module Resolution Options */
|
||||
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
||||
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
||||
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
||||
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
||||
// "typeRoots": [], /* List of folders to include type definitions from. */
|
||||
// "types": [], /* Type declaration files to be included in compilation. */
|
||||
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
||||
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
||||
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||
|
||||
/* Source Map Options */
|
||||
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
||||
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
||||
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
||||
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
||||
|
||||
/* Experimental Options */
|
||||
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
||||
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
||||
|
||||
/* Advanced Options */
|
||||
"skipLibCheck": true, /* Skip type checking of declaration files. */
|
||||
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
|
||||
}
|
||||
}
|
76
local-network/docker-compose.yml
Normal file
76
local-network/docker-compose.yml
Normal file
@ -0,0 +1,76 @@
|
||||
# management secret key is NAB5rGwT4qOEB+6nLQawkTfCOV2eiFSjgQK8bfEdZXY=
|
||||
services:
|
||||
fluence-0: # /ip4/127.0.0.1/tcp/9990/ws/p2p/12D3KooWHBG9oaVx4i3vi6c1rSBUm7MLBmyGmmbHoZ23pmjDCnvK
|
||||
command: -f ed25519 -k 29Apzfedhw2Jxh94Jj4rNSmavQ1TkNe8ALYRA7bMegobwp423aLrURxLk32WtXgXHDqoSz7GAT9fQfoMhVd1e5Ww -m 12D3KooWFRgVmb1uWcmCbmJqLr8tBQghL6ysSpK2VyE2VZbaQ6wy -t 7770 -w 9990 --bootstraps /dns4/fluence-1/tcp/7771 /dns4/fluence-2/tcp/7772
|
||||
container_name: fluence-0
|
||||
environment:
|
||||
RUST_BACKTRACE: full
|
||||
RUST_LOG: info,network=trace,aquamarine=info,aquamarine::actor=info,tokio_threadpool=info,tokio_reactor=info,mio=info,tokio_io=info,soketto=info,yamux=info,multistream_select=info,libp2p_secio=info,libp2p_websocket::framed=info,libp2p_ping=info,libp2p_core::upgrade::apply=info,libp2p_kad::kbucket=info,cranelift_codegen=info,wasmer_wasi=info,async_io=info,polling=info,wasmer_interface_types_fl=info,cranelift_codegen=info,wasmer_wasi=info,async_io=info,polling=info,wasmer_interface_types_fl=info,particle_server::behaviour::identify=info,libp2p_mplex=info,libp2p_identify=info,walrus=info,particle_protocol::libp2p_protocol::upgrade=info,kademlia::behaviour=info
|
||||
WASM_LOG: info
|
||||
image: fluencelabs/node:latest
|
||||
ports:
|
||||
- 7770:7770 # tcp
|
||||
- 9990:9990 # ws
|
||||
- 5000:5001 # ipfs rpc
|
||||
- 4000:4001 # ipfs swarm
|
||||
- 18080:18080 # /metrics
|
||||
restart: always
|
||||
volumes:
|
||||
- fluence-0:/.fluence
|
||||
- data-0:/config
|
||||
networks:
|
||||
- fluence
|
||||
|
||||
# fluence-1: # /ip4/127.0.0.1/tcp/9991/ws/p2p/12D3KooWRABanQHUn28dxavN9ZS1zZghqoZVAYtFpoN7FdtoGTFv
|
||||
# command: -f ed25519 -k 5fNENMwkUT4dW3hPs9ZwqV4qA5pdTtUChTazAx9Awe2Vpz1yaJu3VCmcEZow6YgdFBGoZoFAZUZBbF3c2Ebd2iL -m 12D3KooWFRgVmb1uWcmCbmJqLr8tBQghL6ysSpK2VyE2VZbaQ6wy -t 7771 -w 9991 --bootstraps /dns4/fluence-0/tcp/7770 /dns4/fluence-2/tcp/7772 #/dns4/kras-00.fluence.dev/tcp/7770
|
||||
# container_name: fluence-1
|
||||
# environment:
|
||||
# RUST_BACKTRACE: full
|
||||
# RUST_LOG: info,network=trace,aquamarine=info,aquamarine::actor=info,tokio_threadpool=info,tokio_reactor=info,mio=info,tokio_io=info,soketto=info,yamux=info,multistream_select=info,libp2p_secio=info,libp2p_websocket::framed=info,libp2p_ping=info,libp2p_core::upgrade::apply=info,libp2p_kad::kbucket=info,cranelift_codegen=info,wasmer_wasi=info,async_io=info,polling=info,wasmer_interface_types_fl=info,cranelift_codegen=info,wasmer_wasi=info,async_io=info,polling=info,wasmer_interface_types_fl=info,particle_server::behaviour::identify=info,libp2p_mplex=info,libp2p_identify=info,walrus=info,particle_protocol::libp2p_protocol::upgrade=info,kademlia::behaviour=info
|
||||
# WASM_LOG: info
|
||||
# image: fluencelabs/node:latest
|
||||
# ports:
|
||||
# - 7771:7771 # tcp
|
||||
# - 9991:9991 # ws
|
||||
# - 5001:5001 # ipfs rpc
|
||||
# - 4001:4001 # ipfs swarm
|
||||
# - 18081:18080 # /metrics
|
||||
# restart: always
|
||||
# volumes:
|
||||
# - fluence-1:/.fluence
|
||||
# - data-1:/config
|
||||
# networks:
|
||||
# - fluence
|
||||
#
|
||||
# fluence-2: # /ip4/127.0.0.1/tcp/9992/ws/p2p/12D3KooWFpQ7LHxcC9FEBUh3k4nSCC12jBhijJv3gJbi7wsNYzJ5
|
||||
# command: -f ed25519 -k 5DTs9LQS8Ay2dM8xBcikDRwYLMcanhsC6tynSSgpLyBZEv5Ey34LVw1fYcCuUj9A9EfvQJB2bsaGhSRoHQ7D6UE5 -m 12D3KooWFRgVmb1uWcmCbmJqLr8tBQghL6ysSpK2VyE2VZbaQ6wy -t 7772 -w 9992 --bootstraps /dns4/fluence-0/tcp/7770 /dns4/fluence-1/tcp/7771 #/dns4/kras-00.fluence.dev/tcp/7770
|
||||
# container_name: fluence-2
|
||||
# environment:
|
||||
# RUST_BACKTRACE: full
|
||||
# RUST_LOG: info,network=trace,aquamarine=info,aquamarine::actor=info,tokio_threadpool=info,tokio_reactor=info,mio=info,tokio_io=info,soketto=info,yamux=info,multistream_select=info,libp2p_secio=info,libp2p_websocket::framed=info,libp2p_ping=info,libp2p_core::upgrade::apply=info,libp2p_kad::kbucket=info,cranelift_codegen=info,wasmer_wasi=info,async_io=info,polling=info,wasmer_interface_types_fl=info,cranelift_codegen=info,wasmer_wasi=info,async_io=info,polling=info,wasmer_interface_types_fl=info,particle_server::behaviour::identify=info,libp2p_mplex=info,libp2p_identify=info,walrus=info,particle_protocol::libp2p_protocol::upgrade=info,kademlia::behaviour=info
|
||||
# WASM_LOG: info
|
||||
# image: fluencelabs/node:latest
|
||||
# ports:
|
||||
# - 7772:7772 # tcp
|
||||
# - 9992:9992 # ws
|
||||
# - 5002:5001 # ipfs rpc
|
||||
# - 4002:4001 # ipfs swarm
|
||||
# - 18082:18080 # /metrics
|
||||
# restart: always
|
||||
# volumes:
|
||||
# - fluence-2:/.fluence
|
||||
# - data-2:/config
|
||||
# networks:
|
||||
# - fluence
|
||||
|
||||
version: "3.5"
|
||||
volumes:
|
||||
fluence-0:
|
||||
# fluence-1:
|
||||
# fluence-2:
|
||||
data-0:
|
||||
# data-1:
|
||||
# data-2:
|
||||
|
||||
networks:
|
||||
fluence:
|
Loading…
x
Reference in New Issue
Block a user