chore: Refactor CI after moving tests from aqua-playground [fixes FLU-352] (#763)

* move integration tests to repo

* Move aqua-playground CI

* Fix

* Use local aqua cli

* Move aqua tests to e2e

* Test new build.sbt

* Fix?

* Test

* Test

* Test

* Test

* Update

* Fix

* Fix

* Fix

* fix

* Fix

* Rename aqua-api to api directory for consistency

* Migrate to pnpm

* Add bump version script

* Test snapshot workflow

* fix

* Fix

* Fix

* Setup pnpm

* Update pnpm version

* Fix

* Do not publish tests

* Update

* Fix

* Fix?

* delete import

* Fix

* Fix

* Fix?

* Fix

* Fix

* Use main branch

* Fix quotes

* Fix

* Fix release

* Cleanup

* Remove compiled examples

* Cleanup

---------

Co-authored-by: DieMyst <dmitry.shakhtarin@fluence.ai>
This commit is contained in:
Anatolios Laskaris 2023-06-22 14:59:56 +03:00 committed by GitHub
parent 6cc3a969d2
commit aa10706506
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
54 changed files with 7719 additions and 26839 deletions

134
.github/e2e/docker-compose.yml vendored Normal file
View File

@ -0,0 +1,134 @@
networks:
fluence:
driver: bridge
ipam:
config:
- subnet: 10.50.10.0/24
services:
fluence-1:
image: ${RUST_PEER_IMAGE}
ports:
- 7771:7771
- 9991:9991
command:
- --aqua-pool-size=2
- -t=7771
- -w=9991
- -x=10.50.10.10
- --external-maddrs
- /dns4/fluence-1/tcp/7771
- /dns4/fluence-1/tcp/9991/ws
- --allow-private-ips
- --local
# - --bootstraps=/dns/fluence-1/tcp/7771
# 12D3KooWBM3SdXWqGaawQDGQ6JprtwswEg3FWGvGhmgmMez1vRbR
- -k=hK62afickoeP2uZbmSkAYXxxqP8ozq16VRN7qfTP719EHC5V5tjrtW57BSjUr8GvsEXmJRbtejUWyPZ2rZMyQdq
networks:
fluence:
ipv4_address: 10.50.10.10
fluence-2:
image: ${RUST_PEER_IMAGE}
ports:
- 7772:7772
- 9992:9992
command:
- --aqua-pool-size=2
- -t=7772
- -w=9992
- -x=10.50.10.20
- --external-maddrs
- /dns4/fluence-2/tcp/7772
- /dns4/fluence-2/tcp/9992/ws
- --allow-private-ips
- --bootstraps=/dns/fluence-1/tcp/7771
# 12D3KooWQdpukY3p2DhDfUfDgphAqsGu5ZUrmQ4mcHSGrRag6gQK
- -k=2WijTVdhVRzyZamWjqPx4V4iNMrajegNMwNa2PmvPSZV6RRpo5M2fsPWdQr22HVRubuJhhSw8BrWiGt6FPhFAuXy
networks:
fluence:
ipv4_address: 10.50.10.20
fluence-3:
image: ${RUST_PEER_IMAGE}
ports:
- 7773:7773
- 9993:9993
command:
- --aqua-pool-size=2
- -t=7773
- -w=9993
- -x=10.50.10.30
- --external-maddrs
- /dns4/fluence-3/tcp/7773
- /dns4/fluence-3/tcp/9993/ws
- --allow-private-ips
- --bootstraps=/dns/fluence-1/tcp/7771
# 12D3KooWRT8V5awYdEZm6aAV9HWweCEbhWd7df4wehqHZXAB7yMZ
- -k=2n2wBVanBeu2GWtvKBdrYK9DJAocgG3PrTUXMharq6TTfxqTL4sLdXL9BF23n6rsnkAY5pR9vBtx2uWYDQAiZdrX
networks:
fluence:
ipv4_address: 10.50.10.30
fluence-4:
image: ${RUST_PEER_IMAGE}
ports:
- 7774:7774
- 9994:9994
command:
- --aqua-pool-size=2
- -t=7774
- -w=9994
- -x=10.50.10.40
- --external-maddrs
- /dns4/fluence-4/tcp/7774
- /dns4/fluence-4/tcp/9994/ws
- --allow-private-ips
- --bootstraps=/dns/fluence-1/tcp/7771
# 12D3KooWBzLSu9RL7wLP6oUowzCbkCj2AGBSXkHSJKuq4wwTfwof
- -k=4zp8ucAikkjB8CmkufYiFBW4QCDUCbQG7yMjviX7W8bMyN5rfChQ2Pi5QCWThrCTbAm9uq5nbFbxtFcNZq3De4dX
networks:
fluence:
ipv4_address: 10.50.10.40
fluence-5:
image: ${RUST_PEER_IMAGE}
ports:
- 7775:7775
- 9995:9995
command:
- --aqua-pool-size=2
- -t=7775
- -w=9995
- -x=10.50.10.50
- --external-maddrs
- /dns4/fluence-5/tcp/7775
- /dns4/fluence-5/tcp/9995/ws
- --allow-private-ips
- --bootstraps=/dns/fluence-1/tcp/7771
# 12D3KooWBf6hFgrnXwHkBnwPGMysP3b1NJe5HGtAWPYfwmQ2MBiU
- -k=3ry26rm5gkJXvdqRH4FoM3ezWq4xVVsBQF7wtKq4E4pbuaa6p1F84tNqifUS7DdfJL9hs2gcdW64Wc342vHZHMUp
networks:
fluence:
ipv4_address: 10.50.10.50
fluence-6:
image: ${RUST_PEER_IMAGE}
ports:
- 7776:7776
- 9996:9996
command:
- --aqua-pool-size=2
- -t=7776
- -w=9996
- --bootstraps=/dns/fluence-1/tcp/7771
- -x=10.50.10.60
- --external-maddrs
- /dns4/fluence-6/tcp/7776
- /dns4/fluence-6/tcp/9996/ws
- --allow-private-ips
# 12D3KooWPisGn7JhooWhggndz25WM7vQ2JmA121EV8jUDQ5xMovJ
- -k=5Qh8bB1sF28uLPwr3HTvEksCeC6mAWQvebCfcgv9y6j4qKwSzNKm2tzLUg4nACUEo2KZpBw11gNCnwaAdM7o1pEn
networks:
fluence:
ipv4_address: 10.50.10.60

View File

@ -63,3 +63,8 @@ jobs:
with:
name: aqua-${{ inputs.os }}-${{ inputs.arch }}
path: cli/cli/.jvm/target/graalvm-native-image/cli
- uses: actions/upload-artifact@v3
with:
name: aqua-${{ inputs.os }}-${{ inputs.arch }}
path: cli/cli/.jvm/target/graalvm-native-image/cli

View File

@ -27,6 +27,7 @@ concurrency:
jobs:
aqua:
name: "aqua"
if: >
github.event_name == 'push' ||
contains(github.event.pull_request.labels.*.name, 'e2e')
@ -34,38 +35,24 @@ jobs:
with:
ref: ${{ github.ref }}
aqua-playground:
fluence-cli-snapshot:
name: "fluence-cli"
needs: aqua
uses: fluencelabs/aqua-playground/.github/workflows/tests.yml@master
uses: fluencelabs/fluence-cli/.github/workflows/snapshot.yml@main
with:
aqua-version: "${{ needs.aqua.outputs.aqua-version }}"
registry:
needs: aqua
uses: fluencelabs/registry/.github/workflows/tests.yml@main
with:
aqua-version: "${{ needs.aqua.outputs.aqua-version }}"
aqua-snapshots: "${{ needs.aqua.outputs.aqua-snapshots }}"
fluence-cli:
needs: aqua
uses: fluencelabs/fluence-cli/.github/workflows/tests.yml@main
with:
aqua-api-version: "${{ needs.aqua.outputs.aqua-api-version }}"
aqua-snapshots: "${{ needs.aqua.outputs.aqua-snapshots }}"
aqua-native:
name: "aqua"
strategy:
matrix:
runner:
- runs-on: ubuntu-latest
arch: amd64
os: linux
static: true
registry:
needs:
- aqua
uses: ./.github/workflows/binary.yml
- fluence-cli-snapshot
uses: fluencelabs/registry/.github/workflows/tests.yml@main
with:
runs-on: ${{ matrix.runner.runs-on }}
arch: ${{ matrix.runner.arch }}
os: ${{ matrix.runner.os }}
static: ${{ matrix.runner.static }}
aqua-snapshots: "${{ needs.aqua.outputs.aqua-snapshots }}"
fluence-cli-version: "${{ needs.fluence-cli-snapshot.outputs.version }}"

View File

@ -18,10 +18,14 @@ env:
FORCE_COLOR: true
jobs:
compile:
publish:
runs-on: builder
timeout-minutes: 60
permissions:
contents: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
@ -36,32 +40,9 @@ jobs:
with:
apps: sbt
- name: JS CLI build
run: sbt cliJS/fullLinkJS
- name: scala-js build
run: sbt ";cliJS/fullLinkJS;language-server-apiJS/fullLinkJS;aqua-apiJS/fullLinkJS"
- name: JS API build
run: sbt aqua-apiJS/fullLinkJS
- name: JS LSP build
run: sbt language-server-apiJS/fullLinkJS
- name: Upload aqua-cli artifact
uses: actions/upload-artifact@v3
with:
name: aqua-cli
path: cli/cli/.js/target/scala-*/cli-opt/main.js
- name: Upload aqua-api artifact
uses: actions/upload-artifact@v3
with:
name: aqua-api
path: api/aqua-api/.js/target/scala-*/aqua-api-opt/main.js
- name: Upload aqua-lsp artifact
uses: actions/upload-artifact@v3
with:
name: aqua-lsp
path: language-server/language-server-api/.js/target/scala-*/language-server-api-opt/main.js
aqua-cli:
name: "Publish aqua-cli"
@ -71,23 +52,12 @@ jobs:
needs:
- compile
permissions:
contents: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ inputs.tag }}
- name: Download aqua-cli artifact
uses: actions/download-artifact@v3
with:
name: aqua-cli
- run: mv scala-*/*/main.js cli/cli-npm/aqua.js
- name: Import secrets
uses: hashicorp/vault-action@v2.5.0
with:
@ -101,129 +71,24 @@ jobs:
secrets: |
kv/npmjs/fluencebot token | NODE_AUTH_TOKEN
- name: Setup node
- name: Setup pnpm
uses: pnpm/action-setup@v2.2.4
with:
version: 8
- name: Setup node with self-hosted npm registry
uses: actions/setup-node@v3
with:
node-version: "16"
registry-url: "https://registry.npmjs.org"
cache-dependency-path: "cli/cli-npm/package-lock.json"
cache: "npm"
cache: "pnpm"
- run: npm i
working-directory: cli/cli-npm
- run: pnpm -r i
- run: npm run build
working-directory: cli/cli-npm
- run: pnpm -r build
- name: Publish to NPM registry
run: npm publish --access public --tag unstable
working-directory: cli/cli-npm
aqua-api:
name: "Publish aqua-api"
runs-on: ubuntu-latest
timeout-minutes: 60
needs:
- compile
permissions:
contents: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ inputs.tag }}
- name: Download aqua-api artifact
uses: actions/download-artifact@v3
with:
name: aqua-api
- run: mv scala-*/*/main.js api/aqua-api-npm/aqua-api.js
- name: Import secrets
uses: hashicorp/vault-action@v2.5.0
with:
url: https://vault.fluence.dev
path: jwt/github
role: ci
method: jwt
jwtGithubAudience: "https://github.com/fluencelabs"
jwtTtl: 300
exportToken: false
secrets: |
kv/npmjs/fluencebot token | NODE_AUTH_TOKEN
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "16"
registry-url: "https://registry.npmjs.org"
cache-dependency-path: "api/aqua-api-npm/package-lock.json"
cache: "npm"
- run: npm i
working-directory: api/aqua-api-npm
- name: Publish to NPM registry
run: npm publish --access public --tag unstable
working-directory: api/aqua-api-npm
aqua-lsp:
name: "Publish aqua-lsp"
runs-on: ubuntu-latest
timeout-minutes: 60
needs:
- compile
permissions:
contents: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ inputs.tag }}
- name: Download aqua-lsp artifact
uses: actions/download-artifact@v3
with:
name: aqua-lsp
- run: mv scala-*/*/main.js language-server/language-server-npm/aqua-lsp-api.js
- name: Import secrets
uses: hashicorp/vault-action@v2.5.0
with:
url: https://vault.fluence.dev
path: jwt/github
role: ci
method: jwt
jwtGithubAudience: "https://github.com/fluencelabs"
jwtTtl: 300
exportToken: false
secrets: |
kv/npmjs/fluencebot token | NODE_AUTH_TOKEN
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "16"
registry-url: "https://registry.npmjs.org"
cache-dependency-path: "language-server/language-server-npm/package-lock.json"
cache: "npm"
- run: npm i
working-directory: language-server/language-server-npm
- name: Publish to NPM registry
run: npm publish --access public --tag unstable
working-directory: language-server/language-server-npm
run: pnpm publish --access public --tag unstable
aqua-native:
name: "Publish aqua-native"
@ -238,8 +103,7 @@ jobs:
arch: amd64
os: macos
static: false
needs:
- compile
uses: ./.github/workflows/binary.yml
with:
runs-on: ${{ matrix.runner.runs-on }}

View File

@ -61,18 +61,33 @@ jobs:
run: |
sed -i 's/aquaVersion =.*/aquaVersion = "${{ steps.version.outputs.version }}"/g' build.sbt
- name: Setup pnpm
uses: pnpm/action-setup@v2.2.4
with:
version: 8
- name: Setup node with self-hosted npm registry
uses: actions/setup-node@v3
with:
node-version: "16"
registry-url: "https://registry.npmjs.org"
cache: "pnpm"
- name: Set cli version
run: npm version ${{ steps.version.outputs.version }}
run: pnpm version ${{ steps.version.outputs.version }}
working-directory: cli/cli-npm
- name: Set api version
run: npm version ${{ steps.version.outputs.version }}
working-directory: api/aqua-api-npm
run: pnpm version ${{ steps.version.outputs.version }}
working-directory: api/api-npm
- name: Set lsp version
run: npm version ${{ steps.version.outputs.version }}
run: pnpm version ${{ steps.version.outputs.version }}
working-directory: language-server/language-server-npm
- name: Regenerate lock
run: pnpm -r i
- name: Commit version bump
uses: stefanzweifel/git-auto-commit-action@v4
with:

View File

@ -21,6 +21,12 @@ concurrency:
cancel-in-progress: true
jobs:
sbt-tests:
name: "aqua"
uses: ./.github/workflows/sbt-tests.yml
with:
ref: ${{ github.ref }}
tests:
name: "aqua"
uses: ./.github/workflows/tests.yml

32
.github/workflows/sbt-tests.yml vendored Normal file
View File

@ -0,0 +1,32 @@
name: Run sbt tests with workflow_call
on:
workflow_call:
inputs:
ref:
description: "git ref to checkout to"
type: string
default: "main"
jobs:
tests:
name: "Run sbt tests"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
repository: fluencelabs/aqua
ref: ${{ inputs.ref }}
- name: Cache Scala
uses: coursier/cache-action@v6
- name: Setup Scala
uses: coursier/setup-action@v1
with:
apps: sbt
- name: Run tests
run: sbt test

View File

@ -3,34 +3,32 @@ name: Publish snapshots
on:
workflow_call:
inputs:
fluence-js-version:
description: "@fluencejs/fluence version"
type: string
default: "null"
ref:
description: "git ref to checkout to"
type: string
default: "main"
outputs:
aqua-version:
description: "@fluencelabs/aqua version"
value: ${{ jobs.aqua-cli.outputs.version }}
aqua-lsp-version:
description: "@fluencelabs/aqua-language-server-api version"
value: ${{ jobs.aqua-lsp.outputs.version }}
aqua-api-version:
description: "@fluencelabs/aqua-api version"
value: ${{ jobs.aqua-api.outputs.version }}
aqua-snapshots:
description: "aqua snapshots"
value: ${{ jobs.publish.outputs.snapshots }}
env:
FORCE_COLOR: true
CI: true
jobs:
compile:
name: "Compile"
publish:
name: "Publish snapshots"
runs-on: builder
timeout-minutes: 60
permissions:
contents: read
id-token: write
outputs:
snapshots: "${{ steps.snapshot.outputs.snapshots }}"
steps:
- name: Checkout repository
uses: actions/checkout@v3
@ -50,66 +48,10 @@ jobs:
with:
apps: sbt
- name: JS CLI build
- name: scala-js build
env:
SNAPSHOT: ${{ steps.version.outputs.id }}
run: sbt cliJS/fastOptJS
- name: JS LSP build
env:
SNAPSHOT: ${{ steps.version.outputs.id }}
run: sbt language-server-apiJS/fastOptJS
- name: JS API build
env:
SNAPSHOT: ${{ steps.version.outputs.id }}
run: sbt aqua-apiJS/fastOptJS
- name: Upload aqua-cli artifact
uses: actions/upload-artifact@v3
with:
name: aqua-cli
path: cli/cli/.js/target/scala-*/cli-fastopt.js
- name: Upload aqua-api artifact
uses: actions/upload-artifact@v3
with:
name: aqua-api
path: api/aqua-api/.js/target/scala-*/aqua-api-fastopt.js
- name: Upload aqua-lsp artifact
uses: actions/upload-artifact@v3
with:
name: aqua-lsp
path: language-server/language-server-api/.js/target/scala-*/language-server-api-fastopt.js
aqua-cli:
name: "Publish aqua-cli"
runs-on: ubuntu-latest
timeout-minutes: 60
needs: compile
outputs:
version: "${{ steps.snapshot.outputs.version }}"
permissions:
contents: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
repository: fluencelabs/aqua
ref: ${{ inputs.ref }}
- name: Download aqua-cli artifact
uses: actions/download-artifact@v3
with:
name: aqua-cli
- run: mv scala-*/cli-fastopt.js cli/cli-npm/aqua.js
run: sbt ";cliJS/fastOptJS;language-server-apiJS/fastOptJS;aqua-apiJS/fastOptJS"
- name: Import secrets
uses: hashicorp/vault-action@v2.5.0
@ -124,163 +66,28 @@ jobs:
secrets: |
kv/npm-registry/basicauth/ci token | NODE_AUTH_TOKEN
- name: Setup node with self-hosted npm registry
uses: actions/setup-node@v3
- name: Setup pnpm
uses: pnpm/action-setup@v2.2.4
with:
node-version: "16"
registry-url: "https://npm.fluence.dev"
cache-dependency-path: "cli/cli-npm/package-lock.json"
cache: "npm"
- run: npm i
working-directory: cli/cli-npm
- name: Set fluence-js version from branch
if: inputs.fluence-js-version != 'null'
working-directory: cli/cli-npm
run: npm i --save -E @fluencelabs/fluence@${{ inputs.fluence-js-version }}
- run: npm run build
working-directory: cli/cli-npm
- name: Generate snapshot version
id: version
uses: fluencelabs/github-actions/generate-snapshot-id@main
- name: Publish snapshot
id: snapshot
uses: fluencelabs/github-actions/npm-publish-snapshot@main
with:
working-directory: cli/cli-npm
id: ${{ steps.version.outputs.id }}
aqua-api:
name: "Publish aqua-api"
runs-on: ubuntu-latest
timeout-minutes: 60
needs: compile
outputs:
version: "${{ steps.snapshot.outputs.version }}"
permissions:
contents: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
repository: fluencelabs/aqua
ref: ${{ inputs.ref }}
- name: Download aqua-api artifact
uses: actions/download-artifact@v3
with:
name: aqua-api
- run: mv scala-*/aqua-api-fastopt.js api/aqua-api-npm/aqua-api.js
- name: Import secrets
uses: hashicorp/vault-action@v2.5.0
with:
url: https://vault.fluence.dev
path: jwt/github
role: ci
method: jwt
jwtGithubAudience: "https://github.com/fluencelabs"
jwtTtl: 300
exportToken: false
secrets: |
kv/npm-registry/basicauth/ci token | NODE_AUTH_TOKEN
version: 8
- name: Setup node with self-hosted npm registry
uses: actions/setup-node@v3
with:
node-version: "16"
registry-url: "https://npm.fluence.dev"
cache-dependency-path: "api/aqua-api-npm/package-lock.json"
cache: "npm"
cache: "pnpm"
- run: npm i
working-directory: api/aqua-api-npm
- run: pnpm -r i
- name: Set fluence-js version from branch
if: inputs.fluence-js-version != 'null'
working-directory: cli/cli-npm
run: npm i --save-dev -E @fluencelabs/fluence@${{ inputs.fluence-js-version }}
- name: Set package version
run: node ci.cjs bump-version ${{ steps.version.outputs.id }}
- name: Generate snapshot version
id: version
uses: fluencelabs/github-actions/generate-snapshot-id@main
- run: pnpm -r build
- name: Publish snapshot
id: snapshot
uses: fluencelabs/github-actions/npm-publish-snapshot@main
uses: fluencelabs/github-actions/pnpm-publish-snapshot@main
with:
working-directory: api/aqua-api-npm
id: ${{ steps.version.outputs.id }}
aqua-lsp:
name: "Publish aqua-lsp"
runs-on: ubuntu-latest
timeout-minutes: 60
needs: compile
outputs:
version: "${{ steps.snapshot.outputs.version }}"
permissions:
contents: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
repository: fluencelabs/aqua
ref: ${{ inputs.ref }}
- name: Download aqua-lsp artifact
uses: actions/download-artifact@v3
with:
name: aqua-lsp
- run: mv scala-*/language-server-api-fastopt.js language-server/language-server-npm/aqua-lsp-api.js
- name: Import secrets
uses: hashicorp/vault-action@v2.5.0
with:
url: https://vault.fluence.dev
path: jwt/github
role: ci
method: jwt
jwtGithubAudience: "https://github.com/fluencelabs"
jwtTtl: 300
exportToken: false
secrets: |
kv/npm-registry/basicauth/ci token | NODE_AUTH_TOKEN
- name: Setup node with self-hosted npm registry
uses: actions/setup-node@v3
with:
node-version: "16"
registry-url: "https://npm.fluence.dev"
cache-dependency-path: "language-server/language-server-npm/package-lock.json"
cache: "npm"
- run: npm i
working-directory: language-server/language-server-npm
- name: Generate snapshot version
id: version
uses: fluencelabs/github-actions/generate-snapshot-id@main
- name: Publish snapshot
id: snapshot
uses: fluencelabs/github-actions/npm-publish-snapshot@main
with:
working-directory: language-server/language-server-npm
id: ${{ steps.version.outputs.id }}
set-version: false

View File

@ -6,20 +6,73 @@ on:
ref:
description: "git ref to checkout to"
type: string
default: "main"
default: "master"
fluence-env:
description: "Fluence enviroment to run tests agains"
type: string
default: "local"
rust-peer-image:
description: "rust-peer image tag"
type: string
default: "fluencelabs/rust-peer:minimal"
js-client-snapshots:
description: "js-client snapshots"
type: string
default: "null"
env:
FORCE_COLOR: true
RUST_PEER_IMAGE: "${{ inputs.rust-peer-image }}"
FLUENCE_ENV: "${{ inputs.fluence-env }}"
jobs:
tests:
name: "Run sbt tests"
aqua:
name: "Run tests"
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: read
id-token: write
steps:
- name: Checkout repository
- name: Import secrets
uses: hashicorp/vault-action@v2.6.0
with:
url: https://vault.fluence.dev
path: jwt/github
role: ci
method: jwt
jwtGithubAudience: "https://github.com/fluencelabs"
jwtTtl: 300
secrets: |
kv/docker-registry/basicauth/ci username | DOCKER_USERNAME ;
kv/docker-registry/basicauth/ci password | DOCKER_PASSWORD ;
kv/npm-registry/basicauth/ci token | NODE_AUTH_TOKEN;
kv/slack/node-alerts webhook | INCOMING_WEBHOOK_URL
- name: Login to DockerHub
uses: docker/login-action@v2
with:
registry: docker.fluence.dev
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}
- name: Checkout
uses: actions/checkout@v3
with:
repository: fluencelabs/aqua
ref: ${{ inputs.ref }}
- name: Pull rust-peer image
run: docker pull $RUST_PEER_IMAGE
- name: Run rust-peer
uses: isbang/compose-action@v1.4.1
with:
compose-file: ".github/e2e/docker-compose.yml"
down-flags: "--volumes"
- name: Cache Scala
uses: coursier/cache-action@v6
@ -28,5 +81,45 @@ jobs:
with:
apps: sbt
- name: Run tests
run: sbt test
- name: cli-js build
run: sbt "cliJS/fastOptJS"
- name: Setup pnpm
uses: pnpm/action-setup@v2.2.4
with:
version: 8
- name: Setup node with self-hosted registry
uses: actions/setup-node@v3
with:
node-version: "16"
registry-url: "https://npm.fluence.dev"
cache: "pnpm"
- run: pnpm install
working-directory: integration-tests
- name: Override dependencies
if: inputs.js-client-snapshots != 'null'
uses: fluencelabs/github-actions/pnpm-set-dependency@main
with:
dependencies: |
{
"@fluencelabs/js-client.node": "${{ fromJson(inputs.js-client-snapshots)['js-client.node'] }}",
"@fluencelabs/js-client.api": "${{ fromJson(inputs.js-client-snapshots)['js-client.api'] }}"
}
- name: Build cli
run: pnpm run build
working-directory: cli/cli-npm
- name: Compule aqua
run: pnpm run compile-aqua
working-directory: integration-tests
- run: pnpm run test
working-directory: integration-tests
- name: Dump rust-peer logs
if: always()
uses: jwalton/gh-docker-logs@v2

8
.gitignore vendored
View File

@ -9,5 +9,11 @@ project/target
.DS_Store
npm/aqua.js
cli/cli-npm/aqua.j*
language-server/language-server-npm/aqua-lsp-api.j*
api/api-npm/aqua-api.j*
integration-tests/src/compiled/*
**/dist
**/node_modules

View File

@ -28,9 +28,9 @@ Comprehensive documentation and usage examples as well as a number of videos can
## Repository Structure
- [**api**](./api) - Aqua API for JS
- [aqua-api](./api/aqua-api) - Scala sources
- [aqua-api-npm](./api/aqua-api-npm) - JS project
- [aqua-api-example](./api/aqua-api-example) - usage example
- [api](./api/api) - Scala sources
- [api-npm](./api/api-npm) - JS project
- [api-example](./api/api-example) - usage example
- [**aqua-run**](./aqua-run) - Aqua API to run functions
- [**backend**](./backend) - compilation backend interface
- [backend/air](./backend/air) - generates AIR code from the middle-end model

3
api/api-npm/README.md Normal file
View File

@ -0,0 +1,3 @@
# Aqua API
[Documentation](https://fluence.dev/docs/aqua-book/aqua-js-api)

View File

@ -8,10 +8,6 @@
"aqua-api.d.ts",
"meta-utils.js"
],
"scripts": {
"move:scalajs": "cp ../aqua-api/.js/target/scala-3.3.0/aqua-api-opt/main.js ./aqua-api.js",
"move:fast": "cp ../aqua-api/.js/target/scala-3.3.0/aqua-api-fastopt/main.js ./aqua-api.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/fluencelabs/aqua.git"

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +0,0 @@
# Aqua API
[Documentation](https://fluence.dev/docs/aqua-book/aqua-js-api)

View File

@ -72,6 +72,8 @@ lazy val cli = crossProject(JSPlatform, JVMPlatform)
lazy val cliJS = cli.js
.settings(
Compile / fastOptJS / artifactPath := baseDirectory.value / "../../cli-npm" / "aqua.js",
Compile / fullOptJS / artifactPath := baseDirectory.value / "../../cli-npm" / "aqua.js",
scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.ESModule)),
scalaJSUseMainModuleInitializer := true
)
@ -122,6 +124,8 @@ lazy val `language-server-api` = crossProject(JSPlatform, JVMPlatform)
lazy val `language-server-apiJS` = `language-server-api`.js
.settings(
Compile / fastOptJS / artifactPath := baseDirectory.value / "../../language-server-npm" / "aqua-lsp-api.js",
Compile / fullOptJS / artifactPath := baseDirectory.value / "../../language-server-npm" / "aqua-lsp-api.js",
scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.CommonJSModule)),
scalaJSUseMainModuleInitializer := true
)
@ -143,12 +147,14 @@ lazy val `js-imports` = project
lazy val `aqua-api` = crossProject(JSPlatform, JVMPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("api/aqua-api"))
.in(file("api/api"))
.settings(commons: _*)
.dependsOn(`aqua-run`, `backend-api`)
lazy val `aqua-apiJS` = `aqua-api`.js
.settings(
Compile / fastOptJS / artifactPath := baseDirectory.value / "../../api-npm" / "aqua-api.js",
Compile / fullOptJS / artifactPath := baseDirectory.value / "../../api-npm" / "aqua-api.js",
scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.CommonJSModule)),
scalaJSUseMainModuleInitializer := true,
Test / test := {}

172
ci.cjs Normal file
View File

@ -0,0 +1,172 @@
#! /usr/bin/env node
const fs = require("fs").promises;
const path = require("path");
function printUsage() {
console.log(
`Usage: "ci check-consistency" or "ci bump-version %postfix%" or "ci get-version"`
);
}
let postfix;
const mode = process.argv[2];
function validateArgs() {
switch (mode) {
case "get-version":
return true;
case "bump-version":
postfix = process.argv[3];
if (!postfix) {
printUsage();
process.exit();
}
return true;
case "":
case undefined:
case "check-consistency":
return true;
default:
return false;
}
}
const PATHS_TO_PACKAGES = [
"./cli/cli-npm",
"./api/api-npm",
"./language-server/language-server-npm",
"./integration-tests"
];
async function getPackageJsonsRecursive(currentPath) {
return (
await Promise.all(
(await fs.readdir(currentPath, { withFileTypes: true }))
.filter(
(file) =>
file.name !== "node_modules" && file.name !== "@tests" &&
(file.isDirectory() || file.name === "package.json")
)
.map((file) =>
file.isDirectory()
? getPackageJsonsRecursive(
path.join(currentPath, file.name)
)
: Promise.resolve([
path.join(process.cwd(), currentPath, file.name),
])
)
)
).flat();
}
async function getVersion(file) {
const content = await fs.readFile(file);
const json = JSON.parse(content);
return [json.name, json.version];
}
function processDep(obj, name, fn) {
if (!obj) {
return;
}
if (!obj[name]) {
return;
}
fn(obj, obj[name]);
}
async function getVersionsMap(allPackageJsons) {
return new Map(await Promise.all(allPackageJsons.map(getVersion)));
}
function getVersionForPackageOrThrow(versionsMap, packageName) {
const version = versionsMap.get(packageName);
if (!version) {
console.log("Failed to get version for package: ", packageName);
process.exit(1);
}
return version;
}
async function checkConsistency(file, versionsMap) {
console.log("Checking: ", file);
const content = await fs.readFile(file);
const json = JSON.parse(content);
for (const [name, versionInDep] of versionsMap) {
const check = (x, version) => {
if (version.includes("*")) {
return;
}
if (versionInDep !== version) {
console.log(
`Error, versions don't match: ${name}:${version} !== ${versionInDep}`,
file
);
process.exit(1);
}
};
processDep(json.dependencies, name, check);
processDep(json.devDependencies, name, check);
}
}
async function bumpVersions(file, versionsMap) {
console.log("Updating: ", file);
const content = await fs.readFile(file);
const json = JSON.parse(content);
for (const [name, version] of versionsMap) {
const update = (x) => (x[name] = `${version}-${postfix}`);
processDep(json.dependencies, name, update);
processDep(json.devDependencies, name, update);
}
const version = getVersionForPackageOrThrow(versionsMap, json.name);
json.version = `${version}-${postfix}`;
const newContent = JSON.stringify(json, undefined, 4) + "\n";
await fs.writeFile(file, newContent);
}
async function processPackageJsons(allPackageJsons, versionsMap, fn) {
await Promise.all(allPackageJsons.map((x) => fn(x, versionsMap)));
}
async function run() {
if (!validateArgs()) {
printUsage();
process.exit(0);
}
const packageJsons = (
await Promise.all(PATHS_TO_PACKAGES.map(getPackageJsonsRecursive))
).flat();
const versionsMap = await getVersionsMap(packageJsons);
if (mode === "get-version") {
const fjs = versionsMap.get("@fluencelabs/fluence");
console.log(fjs);
return;
}
console.log("Checking versions consistency...");
await processPackageJsons(packageJsons, versionsMap, checkConsistency);
console.log("Versions are consistent");
if (mode === "bump-version") {
console.log("Adding postfix: ", postfix);
await processPackageJsons(packageJsons, versionsMap, bumpVersions);
console.log("Done");
}
}
run();

View File

@ -8,7 +8,9 @@ ADDR='/dns4/kras-04.fluence.dev/tcp/19001/wss/p2p/12D3KooWFEwNWcHqi9rtsmDhsYcDbR
if [ -z "$IMPORT" ]
then
npm run from:scalajs -- run -f "$FUNC" -i "$INPUT" --data-path "$DATAPATH" --addr "$ADDR"
npm run build
npm run -- run -f "$FUNC" -i "$INPUT" --data-path "$DATAPATH" --addr "$ADDR"
else
npm run from:scalajs -- run -f "$FUNC" -i "$INPUT" --data-path "$DATAPATH" --addr "$ADDR" -m "$IMPORT"
npm run build
npm run run -- run -f "$FUNC" -i "$INPUT" --data-path "$DATAPATH" --addr "$ADDR" -m "$IMPORT"
fi

File diff suppressed because it is too large Load Diff

View File

@ -17,7 +17,6 @@
},
"scripts": {
"run": "node index.js",
"from:scalajs": "cp ../cli/.js/target/scala-3.2.2/cli-opt/main.js ./aqua.js && npm run build && npm run run -- $@",
"build": "tsc"
},
"dependencies": {
@ -25,7 +24,8 @@
"@fluencelabs/aqua-lib": "0.6.0",
"@fluencelabs/fluence": "0.28.0",
"@fluencelabs/fluence-network-environment": "1.0.14",
"ipfs-http-client": "50.1.2"
"ipfs-http-client": "50.1.2",
"multiaddr": "^10.0.1"
},
"devDependencies": {
"ts-node": "10.9.1",

View File

@ -1,5 +1,6 @@
{
"name": "aquamarine-template",
"private": true,
"version": "0.3.9",
"keywords": [
"typescript",
@ -15,7 +16,7 @@
"src/"
],
"scripts": {
"build": "tsc",
"build": "tsc & npm run compile-aqua",
"test": "NODE_OPTIONS=--experimental-vm-modules npx jest --detectOpenHandles",
"examples": "jest",
"pubsub": "node -r ts-node/register src/pubsub.ts",
@ -28,7 +29,7 @@
"do": "aqua dist deploy --addr /dns4/kras-04.fluence.dev/tcp/19001/wss/p2p/12D3KooWFEwNWcHqi9rtsmDhsYcDbRUCDXH84RC4FW6UfsFWaoHi --config-path deploy.json --service tsOracle"
},
"devDependencies": {
"@fluencelabs/aqua": "0.11.5",
"@fluencelabs/aqua": "0.11.7",
"@fluencelabs/aqua-dht": "0.2.5",
"@fluencelabs/aqua-lib": "0.6.0",
"@types/jest": "29.5.2",

View File

@ -178,7 +178,7 @@ describe('Testing examples', () => {
it('constants.aqua', async () => {
let constantCallResult = await constantsCall();
expect(constantCallResult).toEqual(['1', 'ab']);
expect(constantCallResult).toEqual(['5', 'default-str']);
});
it('PARTICLE_TTL and PARTICLE_TIMESTAMP', async () => {

View File

@ -1,4 +1,3 @@
import { Fluence } from '@fluencelabs/fluence';
import {passFunctionAsArg, reproArgsBug426} from '../compiled/examples/callArrow.js';
export async function callArrowCall(relayPeerId: string): Promise<string> {
@ -13,7 +12,6 @@ export async function callArrowCall(relayPeerId: string): Promise<string> {
}
export async function reproArgsBug426Call(): Promise<string> {
const relayPeerId = Fluence.getPeer().getStatus().relayPeerId;
return new Promise<string>((resolve, reject) => {
reproArgsBug426((a: string) => {
resolve(a);

View File

@ -1,4 +1,3 @@
import { Fluence } from '@fluencelabs/fluence';
import {
lng193Bug
} from '../compiled/examples/closureReturnRename.js';

View File

@ -1,4 +1,3 @@
import { Fluence } from '@fluencelabs/fluence';
import {
closureIn,
closureOut,

View File

@ -1,4 +1,3 @@
import { Fluence } from '@fluencelabs/fluence';
import { parFunc } from '../compiled/examples/par.js';
import { registerCoService } from '../compiled/examples/co.js';
import {relay1} from "../__test__/examples.spec.js";

View File

@ -1,4 +1,3 @@
import { Fluence } from '@fluencelabs/fluence';
import { doStuff, registerTestS } from '../compiled/examples/complex.js';
export async function complexCall(selfPeerId: string, relayPeerId: string) {

View File

@ -1,4 +1,3 @@
import { FluencePeer } from '@fluencelabs/fluence';
import { getAliasedData, registerNodeIdGetter } from '../compiled/examples/dataAlias.js';
export async function dataAliasCall() {

View File

@ -1,4 +1,3 @@
import { Fluence } from '@fluencelabs/fluence';
import {forBug499, iterateAndPrint, iterateAndPrintParallel} from '../compiled/examples/fold.js';
export async function foldCall(relayPeerId: string) {

View File

@ -1,4 +1,3 @@
import { Fluence } from '@fluencelabs/fluence';
import { getTwoResults } from '../compiled/examples/foldJoin.js';
export async function foldJoinCall(relayPeerId: string): Promise<number[]> {

View File

@ -1,4 +1,3 @@
import {Fluence} from '@fluencelabs/fluence';
import {joinIdx, joinIdxLocal, joinIdxRelay} from "../compiled/examples/join.js";
import { config } from '../config.js';

View File

@ -1,4 +1,3 @@
import { Fluence } from '@fluencelabs/fluence';
import { getPeerExternalAddresses } from '../compiled/examples/on.js';
export async function onCall(relayPeerId: string): Promise<string[]> {

View File

@ -1,4 +1,3 @@
import { Fluence } from '@fluencelabs/fluence';
import {parFunc, registerParService, testTimeout} from '../compiled/examples/par.js';
import {config} from "../config.js";

View File

@ -1,4 +1,3 @@
import { Fluence } from '@fluencelabs/fluence';
import {bugLNG60, create_client_util, registerAquaDHT} from '../compiled/examples/passArgs.js';
export async function passArgsCall() {

View File

@ -1,4 +1,3 @@
import { Fluence } from '@fluencelabs/fluence';
import { tryCatchTest } from '../compiled/examples/tryCatch.js';
export async function tryCatchCall(relayPeerId: string): Promise<string[]> {

View File

@ -1,31 +1,6 @@
#!/usr/bin/env node
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
import { krasnodar } from '@fluencelabs/fluence-network-environment';
import { helloWorld, registerStringExtra } from './compiled/examples/helloWorld.js';
const main = async () => {
// each compiled aqua function require a connected client
await Fluence.start({ connectTo: krasnodar[0] });
// example to how register a local service
// it could be used in aqua code as follows
// service StringExtra("service-id"):
// addNameToHello: string -> string
// see more in helloWorld.aqua
registerStringExtra({
addNameToHello: (arg0) => {
return `Hello, ${arg0}!`;
},
});
// call an aqua function thet presented in ../aqua/helloWorld.aqua
const result = await helloWorld('NAME');
console.log(result);
// uncomment to play with examples
// await runExamples();
process.exit(0);
};

View File

@ -1,13 +0,0 @@
{
"name": "@fluencelabs/aqua-language-server-api",
"version": "0.11.7",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@fluencelabs/aqua-language-server-api",
"version": "0.11.7",
"license": "Apache-2.0"
}
}
}

View File

@ -7,9 +7,6 @@
"aqua-lsp-api.js",
"aqua-lsp-api.d.ts"
],
"scripts": {
"move:scalajs": "cp ../language-server-api/.js/target/scala-3.2.2/language-server-api-opt/main.js ./aqua-lsp-api.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/fluencelabs/aqua.git"

7115
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

5
pnpm-workspace.yaml Normal file
View File

@ -0,0 +1,5 @@
packages:
- 'cli/cli-npm'
- 'api/api-npm'
- 'language-server/language-server-npm'
- 'integration-tests'