feat: use non-npm Fluence CLI (#302)

* feat: use non-npm Fluence CLI

* Replace nox version

* Setup fcli in cargo tests

* Fix

* remove npx

---------

Co-authored-by: Anatoly Laskaris <github_me@nahsi.dev>
This commit is contained in:
shamsartem 2023-12-05 12:27:53 +01:00 committed by GitHub
parent 2405f41702
commit d77fd12b4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 21 additions and 28434 deletions

View File

@ -54,6 +54,11 @@ jobs:
with: with:
artifact-name: marine artifact-name: marine
- name: Setup fcli
uses: fluencelabs/setup-fluence@v1
with:
version: stage
- name: Import secrets - name: Import secrets
if: inputs.snapshot == true if: inputs.snapshot == true
uses: hashicorp/vault-action@v2.7.3 uses: hashicorp/vault-action@v2.7.3

View File

@ -10,11 +10,11 @@ on:
nox-image: nox-image:
description: "nox image tag" description: "nox image tag"
type: string type: string
default: "fluencelabs/nox:unstable_minimal" default: "fluencelabs/nox:unstable"
fcli-version: fcli-version:
description: "@fluencelabs/cli version" description: "@fluencelabs/cli version"
type: string type: string
default: "null" default: "stage"
cargo-dependencies: cargo-dependencies:
description: "Cargo dependencies map" description: "Cargo dependencies map"
type: string type: string
@ -76,14 +76,11 @@ jobs:
run: npm install run: npm install
working-directory: aqua-tests working-directory: aqua-tests
- name: Set fcli version - name: Setup fcli
if: inputs.fcli-version != 'null' uses: fluencelabs/setup-fluence@v1
uses: fluencelabs/github-actions/npm-set-dependency@main
with: with:
package: "@fluencelabs/cli" artifact: fcli
version: ${{ inputs.fcli-version }} version: ${{ inputs.fcli-version }}
working-directory: aqua-tests
flags: "--save-dev"
- name: Setup Rust toolchain - name: Setup Rust toolchain
uses: dsherret/rust-toolchain-file@v1 uses: dsherret/rust-toolchain-file@v1
@ -141,7 +138,7 @@ jobs:
- name: Install fcli dependencies - name: Install fcli dependencies
env: env:
FLUENCE_USER_DIR: "${{ github.workspace }}/tmp/.fluence" FLUENCE_USER_DIR: "${{ github.workspace }}/tmp/.fluence"
run: npx fluence dep i --no-input run: fluence dep i --no-input
working-directory: aqua-tests working-directory: aqua-tests
- name: Print fcli version - name: Print fcli version
@ -162,7 +159,7 @@ jobs:
cat <<SNAPSHOT >> $GITHUB_STEP_SUMMARY cat <<SNAPSHOT >> $GITHUB_STEP_SUMMARY
## Used versions ## Used versions
\`\`\` \`\`\`
$(npx fluence dep v) $(fluence dep v)
\`\`\` \`\`\`
SNAPSHOT SNAPSHOT

View File

@ -7,7 +7,7 @@ dependencies:
npm: npm:
"@fluencelabs/registry": 0.6.2 "@fluencelabs/registry": 0.6.2
``` ```
And then run `fluence dependency npm i` And then run `fluence dep npm i`
If you are developing from scratch without Fluence CLI, you should install it via npm: If you are developing from scratch without Fluence CLI, you should install it via npm:

View File

@ -11,7 +11,7 @@
"compile-aqua": "fluence aqua -i . -o ./target/typescript", "compile-aqua": "fluence aqua -i . -o ./target/typescript",
"generate-aqua": "../service/build.sh", "generate-aqua": "../service/build.sh",
"build": "npm run compile-aqua", "build": "npm run compile-aqua",
"secret": "npx fluence key new" "secret": "fluence key new"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -29,7 +29,6 @@
}, },
"homepage": "https://github.com/fluencelabs/registry", "homepage": "https://github.com/fluencelabs/registry",
"devDependencies": { "devDependencies": {
"@fluencelabs/cli": "0.13.0",
"@fluencelabs/fluence-network-environment": "1.1.2" "@fluencelabs/fluence-network-environment": "1.1.2"
} }
} }

View File

@ -5,7 +5,7 @@ import os
import inspect import inspect
from config import get_local from config import get_local
delegator.run("npx fluence dep npm i", block=True) delegator.run("fluence dep npm i", block=True)
default_peers = json.loads(delegator.run( default_peers = json.loads(delegator.run(
f"node ./getDefaultPeers.js", block=True).out) f"node ./getDefaultPeers.js", block=True).out)
@ -58,7 +58,7 @@ def run_aqua(func, args, relay=get_random_relay()):
# when running one test at a time, the stack is shorter so we need to use a different index # when running one test at a time, the stack is shorter so we need to use a different index
test_name = inspect.stack()[-32][3] test_name = inspect.stack()[-32][3]
command = f"npx fluence run -k {test_name} --relay {relay} -f '{call}' --data '{json.dumps(data)}' --import 'node_modules' --quiet --particle-id" command = f"fluence run -k {test_name} --relay {relay} -f '{call}' --data '{json.dumps(data)}' --import 'node_modules' --quiet --particle-id"
print(command) print(command)
c = delegator.run(command, block=True) c = delegator.run(command, block=True)
lines = c.out.splitlines() lines = c.out.splitlines()

View File

@ -2,6 +2,6 @@ import delegator
def test_fluence_cli_version(): def test_fluence_cli_version():
c = delegator.run(f"npx fluence --version", block=True) c = delegator.run(f"fluence --version", block=True)
print(f"Fluence CLI version: {c.out}") print(f"Fluence CLI version: {c.out}")
assert True assert True

View File

@ -28,8 +28,5 @@
"bugs": { "bugs": {
"url": "https://github.com/fluencelabs/registry/issues" "url": "https://github.com/fluencelabs/registry/issues"
}, },
"homepage": "https://github.com/fluencelabs/registry", "homepage": "https://github.com/fluencelabs/registry"
"devDependencies": {
"@fluencelabs/cli": "0.13.0"
}
} }

View File

@ -11,7 +11,7 @@ DISTRO_TARGET=distro/registry-service
mkdir -p "$DISTRO_TARGET" mkdir -p "$DISTRO_TARGET"
cd ./aqua cd ./aqua
npx fluence aqua -i ../spell/spell.aqua --no-relay --air -o "../$DISTRO_TARGET/air" fluence aqua -i ../spell/spell.aqua --no-relay --air -o "../$DISTRO_TARGET/air"
cd - cd -
cp service/artifacts/registry.wasm service/artifacts/sqlite3.wasm distro/Config.toml "$DISTRO_TARGET" cp service/artifacts/registry.wasm service/artifacts/sqlite3.wasm distro/Config.toml "$DISTRO_TARGET"

View File

@ -18,13 +18,10 @@ This example shows how to use Registry to discover and call fluence services wit
## Set up the environment ## Set up the environment
1. Install the latest version of Fluence CLI: 1. [Install the latest version of Fluence CLI](https://github.com/fluencelabs/cli#installation-and-usage)
```sh
npm i -g @fluencelabs/cli
```
2. Install Fluence project dependencies. It may take a while: 2. Install Fluence project dependencies. It may take a while:
```sh ```sh
fluence dependency i fluence dep i
``` ```
3. Install JS dependencies: 3. Install JS dependencies:
```sh ```sh

28403
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +0,0 @@
{
"dependencies": {
"@fluencelabs/cli": "0.13.0"
}
}