diff --git a/.cargo/config.toml b/.cargo/config.toml index 71674d6e..2ba5a399 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,7 +1,3 @@ -[http] -timeout = 30 # timeout for each HTTP request, in seconds -multiplexing = false # HTTP/2 multiplexing - [net] retry = 50 # network retries diff --git a/.github/download_marine.sh b/.github/download_marine.sh deleted file mode 100755 index bec1bf5b..00000000 --- a/.github/download_marine.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/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 -sS -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' diff --git a/.github/workflows/aquavm.yml b/.github/workflows/aquavm.yml index 0ad3345d..c535a185 100644 --- a/.github/workflows/aquavm.yml +++ b/.github/workflows/aquavm.yml @@ -21,11 +21,10 @@ jobs: - name: Setup rust toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 - - run: cargo install marine - - - name: Build Wasm binary for interpreter - run: marine build --features marine - working-directory: air-interpreter + - name: Install marine + uses: baptiste0928/cargo-install@v1.3.0 + with: + crate: marine - name: Build Wasm binary for tests run: ./build_test_binaries.sh diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 617d3b50..fd6e696f 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -13,6 +13,8 @@ jobs: snapshot: name: "aquavm" uses: ./.github/workflows/snapshot.yml + with: + ref: ${{ github.ref }} rust-peer: name: "rust-peer" @@ -22,16 +24,19 @@ jobs: uses: fluencelabs/rust-peer/.github/workflows/snapshot.yml@master with: image-name: "docker.fluence.dev/aquavm" - avm-server-version: | - { - "git": "https://github.com/fluencelabs/aquavm", - "branch": "${{ github.head_ref }}" - } - air-interpreter-wasm-version: | - { - "version": "=${{ needs.snapshot.outputs.air-interpreter-wasm-version }}", - "registry": "fluence" - } + cargo-dependencies: | + [ + { + "package": "avm-server", + "version": "=${{ needs.snapshot.outputs.cargo-version }}", + "registry": "fluence" + }, + { + "package": "air-interpreter-wasm", + "version": "=${{ needs.snapshot.outputs.cargo-version }}", + "registry": "fluence" + } + ] fluence-js-tests: name: "fluence-js" @@ -83,5 +88,3 @@ jobs: with: aqua-version: "${{ needs.aqua-snapshot.outputs.aqua-version }}" rust-peer-image: "${{ needs.rust-peer.outputs.rust-peer-image }}" - # uncomment and change to branch name to run against - # ref: show-aqua-version diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index fe846645..1e157045 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -2,13 +2,21 @@ name: Publish snapshots on: workflow_call: + inputs: + ref: + description: "GitHub ref to checkout to" + type: string + default: "master" + cargo-dependencies: + description: "Cargo dependencies map" + type: string outputs: + cargo-version: + description: "Cargo snapshot version" + value: ${{ jobs.cargo-snapshot.outputs.version }} avm-version: description: "@fluencelabs/avm version" value: ${{ jobs.publish-avm.outputs.version }} - air-interpreter-wasm-version: - description: "air-interpreter-wasm version" - value: ${{ jobs.publish-interpreter.outputs.version }} air-beautify-wasm-version: description: "air-beautify-wasm version" value: ${{ jobs.publish-beautify.outputs.version }} @@ -24,12 +32,15 @@ jobs: steps: - name: Checkout AquaVM uses: actions/checkout@v3 + with: + repository: fluencelabs/aquavm + ref: ${{ inputs.ref }} - name: Setup Rust toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 - name: Install marine - uses: baptiste0928/cargo-install@v1 + uses: baptiste0928/cargo-install@v1.3.0 with: crate: marine @@ -43,8 +54,66 @@ jobs: name: air-interpreter-wasm path: target/wasm32-wasi/release/air_interpreter_server.wasm + cargo-snapshot: + name: "Publish cargo snapshots" + runs-on: ubuntu-latest + + needs: wasm + + outputs: + version: "${{ steps.snapshot.outputs.version }}" + + permissions: + contents: read + id-token: write + + steps: + - name: Checkout AquaVM + uses: actions/checkout@v3 + with: + repository: fluencelabs/aquavm + ref: ${{ inputs.ref }} + + - name: Import secrets + uses: hashicorp/vault-action@v2.4.3 + with: + url: https://vault.fluence.dev + path: jwt/github + role: ci + method: jwt + jwtGithubAudience: "https://github.com/fluencelabs" + jwtTtl: 300 + exportToken: false + secrets: | + kv/cargo-registry/users/ci token | CARGO_REGISTRIES_FLUENCE_TOKEN + + - name: Setup Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + + - name: Set dependencies + if: inputs.cargo-dependencies != '' + uses: fluencelabs/github-actions/cargo-set-dependency@main + with: + dependencies: ${{ inputs.cargo-dependencies }} + + - name: Download air-interpreter-wasm binary + uses: actions/download-artifact@v3 + with: + name: air-interpreter-wasm + + - name: Move air_interpreter_server.wasm + run: mv air_interpreter_server.wasm crates/interpreter-wasm/ + + - name: Add air-interpreter-wasm to workspace + run: | + sed -i '/members/a "crates/interpreter-wasm",' Cargo.toml + + - name: Publish crate snapshots + id: snapshot + uses: fluencelabs/github-actions/cargo-publish-snapshot@main + publish-avm: - name: "Publish avm snapshot" + name: "Publish @fluencelabs/avm snapshot" runs-on: ubuntu-latest needs: wasm @@ -54,12 +123,14 @@ jobs: permissions: contents: read - pull-requests: write id-token: write steps: - name: Checkout AquaVM uses: actions/checkout@v3 + with: + repository: fluencelabs/aquavm + ref: ${{ inputs.ref }} - name: Download air-interpreter-wasm binary uses: actions/download-artifact@v3 @@ -71,7 +142,7 @@ jobs: working-directory: avm/client/dist - name: Import secrets - uses: hashicorp/vault-action@v2.4.2 + uses: hashicorp/vault-action@v2.4.3 with: url: https://vault.fluence.dev path: jwt/github @@ -103,12 +174,10 @@ jobs: SHA=${{ github.event.pull_request.head.sha }} echo "::set-output name=sha::${SHA::7}" echo "::set-output name=branch::${GITHUB_HEAD_REF//[^a-zA-Z0-9-]/-}" - echo "::set-output name=avm::$(cargo read-manifest --manifest-path air-interpreter/Cargo.toml | jq -r .version)" - name: Set package version id: build env: - VERSION: ${{ steps.version.outputs.avm }} BRANCH: ${{ steps.version.outputs.branch }} SHA: ${{ steps.version.outputs.sha }} RUN: ${{ github.run_number }} @@ -116,149 +185,34 @@ jobs: working-directory: avm/client run: | echo "::set-output name=version::$(\ - npm version --no-git-tag-version \ - ${{ env.VERSION }}-${{ env.BRANCH }}-${{ env.SHA }}-${{ env.RUN }}-${{ env.ATTEMPT }})" + npm version prerelease \ + --no-git-tag-version \ + --preid ${{ env.BRANCH }}-${{ env.SHA }}-${{ env.RUN }}-${{ env.ATTEMPT }})" - name: Publish to self-hosted npm repo working-directory: avm/client run: npm publish --tag snapshot --registry https://npm.fluence.dev - - name: Find comment in PR - uses: peter-evans/find-comment@v1 - id: comment - with: - issue-number: "${{ github.event.pull_request.number }}" - comment-author: github-actions[bot] - body-includes: "## AVM version is" - - - name: Update comment in PR - uses: peter-evans/create-or-update-comment@v1 - env: - AVM_VERSION: ${{ steps.build.outputs.version }} - with: - comment-id: "${{ steps.comment.outputs.comment-id }}" - issue-number: "${{ github.event.pull_request.number }}" - edit-mode: replace - body: | - ## AVM version is [${{ env.AVM_VERSION }}](https://npm.fluence.dev/-/web/detail/@fluencelabs/avm/v/${{ env.AVM_VERSION }}) - To install it run: - ```shell - npm login --registry https://npm.fluence.dev - npm i @fluencelabs/avm@${{ env.AVM_VERSION }} --registry=https://npm.fluence.dev - ``` - - publish-interpreter: - name: "Publish air-interpreter-wasm snapshot" - runs-on: ubuntu-latest - - needs: wasm - - outputs: - version: "${{ steps.build.outputs.version }}" - - permissions: - contents: read - pull-requests: write - id-token: write - - steps: - - name: Checkout AquaVM - uses: actions/checkout@v3 - - - name: Download air-interpreter-wasm binary - uses: actions/download-artifact@v3 - with: - name: air-interpreter-wasm - - - run: mv air_interpreter_server.wasm crates/interpreter-wasm/ - - - name: Import secrets - uses: hashicorp/vault-action@v2.4.2 - with: - url: https://vault.fluence.dev - path: jwt/github - role: ci - method: jwt - jwtGithubAudience: "https://github.com/fluencelabs" - jwtTtl: 300 - exportToken: false - secrets: | - kv/cargo-registry/users/ci token | CARGO_REGISTRIES_FLUENCE_TOKEN - - - name: Setup Rust toolchain - uses: actions-rust-lang/setup-rust-toolchain@v1 - - - name: Install cargo-edit - uses: baptiste0928/cargo-install@v1 - with: - crate: cargo-edit - - - name: Generate package version - id: version - run: | - SHA=${{ github.event.pull_request.head.sha }} - echo "::set-output name=sha::${SHA::7}" - echo "::set-output name=branch::${GITHUB_HEAD_REF//[^a-zA-Z0-9-]/-}" - - - name: Set package version - id: build - env: - BRANCH: ${{ steps.version.outputs.branch }} - SHA: ${{ steps.version.outputs.sha }} - RUN: ${{ github.run_number }} - ATTEMPT: ${{ github.run_attempt }} - working-directory: crates/interpreter-wasm - run: | - cargo set-version --bump alpha - cargo set-version "$(cargo read-manifest | jq -r .version)-${{ env.BRANCH }}-${{ env.SHA }}-${{ env.RUN }}-${{ env.ATTEMPT }}" - - echo "::set-output name=version::$(cargo read-manifest | jq -r .version)" - - - name: Publish to self-hosted cargo registry - working-directory: crates/interpreter-wasm - run: cargo publish --registry fluence --allow-dirty - - - name: Find comment in PR - uses: peter-evans/find-comment@v1 - id: comment - with: - issue-number: "${{ github.event.pull_request.number }}" - comment-author: github-actions[bot] - body-includes: "## air-interpreter-wasm version is" - - - name: Update comment in PR - uses: peter-evans/create-or-update-comment@v1 - env: - VERSION: ${{ steps.build.outputs.version }} - with: - comment-id: "${{ steps.comment.outputs.comment-id }}" - issue-number: "${{ github.event.pull_request.number }}" - edit-mode: replace - body: | - ## air-interpreter-wasm version is [${{ env.VERSION }}](https://crates.fluence.dev/#/crate?name=air-interpreter-wasm&version=${{ env.VERSION }}) - To install it run: - ```shell - cargo add air-interpreter-wasm@${{ env.VERSION }} --registry fluence - ``` - publish-air-beautify: name: "Publish air-beautify-wasm snapshot" - runs-on: ubuntu-latest + runs-on: builder outputs: version: "${{ steps.build.outputs.version }}" permissions: contents: read - pull-requests: write id-token: write steps: - name: Checkout aquavm uses: actions/checkout@v3 + with: + repository: fluencelabs/aquavm + ref: ${{ inputs.ref }} - name: Import secrets - uses: hashicorp/vault-action@v2.4.2 + uses: hashicorp/vault-action@v2.4.3 with: url: https://vault.fluence.dev path: jwt/github @@ -270,10 +224,11 @@ jobs: secrets: | kv/npm-registry/basicauth/ci token | NODE_AUTH_TOKEN + - name: Setup Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + - name: Setup wasm-pack uses: jetli/wasm-pack-action@v0.3.0 - with: - version: 'latest' - name: Setup node with self-hosted npm registry uses: actions/setup-node@v3 @@ -311,27 +266,3 @@ jobs: - name: Publish to self-hosted npm repo working-directory: tools/wasm/air-beautify-wasm/pkg run: npm publish --tag snapshot --registry https://npm.fluence.dev - - - name: Find comment in PR - uses: peter-evans/find-comment@v1 - id: comment - with: - issue-number: "${{ github.event.pull_request.number }}" - comment-author: github-actions[bot] - body-includes: "## air-beautify-wasm version is" - - - name: Update comment in PR - uses: peter-evans/create-or-update-comment@v1 - env: - AIR_BEAUTIFY_VERSION: ${{ steps.build.outputs.version }} - with: - comment-id: "${{ steps.comment.outputs.comment-id }}" - issue-number: "${{ github.event.pull_request.number }}" - edit-mode: replace - body: | - ## air-beautify-wasm version is [${{ env.AIR_BEAUTIFY_VERSION }}](https://npm.fluence.dev/-/web/detail/@fluencelabs/air_beautify/v/${{ env.AIR_BEAUTIFY_VERSION }}) - To install it run: - ```shell - npm login --registry https://npm.fluence.dev - npm i @fluencelabs/air-beautify-wasm@${{ env.AIR_BEAUTIFY_VERSION }} --registry=https://npm.fluence.dev - ``` diff --git a/avm/interface/Cargo.toml b/avm/interface/Cargo.toml index 5be652a3..bc3c3602 100644 --- a/avm/interface/Cargo.toml +++ b/avm/interface/Cargo.toml @@ -7,7 +7,6 @@ edition = "2018" license = "Apache-2.0" documentation = "https://docs.rs/avm-interface" repository = "https://github.com/fluencelabs/aquavm/tree/master/avm/interface" -publish = true # this crate is used by the node keywords = ["fluence", "air", "webassembly", "programming-language"] categories = ["wasm"] diff --git a/avm/server/Cargo.toml b/avm/server/Cargo.toml index 87766c4b..b03ec4b2 100644 --- a/avm/server/Cargo.toml +++ b/avm/server/Cargo.toml @@ -7,7 +7,6 @@ edition = "2018" license = "Apache-2.0" documentation = "https://docs.rs/avm-server" repository = "https://github.com/fluencelabs/aquavm/tree/master/avm/server" -publish = true # this crate is used by the node keywords = ["fluence", "air", "webassembly", "programming-language"] categories = ["wasm"] diff --git a/crates/air-lib/interpreter-interface/Cargo.toml b/crates/air-lib/interpreter-interface/Cargo.toml index 77c781cc..aa2b67b0 100644 --- a/crates/air-lib/interpreter-interface/Cargo.toml +++ b/crates/air-lib/interpreter-interface/Cargo.toml @@ -7,7 +7,6 @@ edition = "2018" license = "Apache-2.0" documentation = "https://docs.rs/air-interpreter-interface" repository = "https://github.com/fluencelabs/aquavm/tree/master/crates/air-lib/interpreter-interface" -publish = true # this crate is used by avm server that in its turn is used by the node keywords = ["fluence", "air", "webassembly", "programming-language"] categories = ["wasm"] diff --git a/crates/air-lib/polyplets/Cargo.toml b/crates/air-lib/polyplets/Cargo.toml index d7485733..18aa65be 100644 --- a/crates/air-lib/polyplets/Cargo.toml +++ b/crates/air-lib/polyplets/Cargo.toml @@ -7,7 +7,6 @@ edition = "2018" license = "Apache-2.0" documentation = "https://docs.rs/polyplets" repository = "https://github.com/fluencelabs/aquavm/tree/master/crates/air-lib/polyplets" -publish = true # this crate is used by the avm server that in its turn is used by the node keywords = ["fluence", "air", "webassembly", "security", "authorization"] categories = ["authentication"] diff --git a/crates/air-lib/utils/Cargo.toml b/crates/air-lib/utils/Cargo.toml index b172dbd7..106954f7 100644 --- a/crates/air-lib/utils/Cargo.toml +++ b/crates/air-lib/utils/Cargo.toml @@ -5,7 +5,6 @@ description = "AIR helper funcitions and macros" authors = ["Fluence Labs"] edition = "2018" license = "Apache-2.0" -publish = true # this crate is used by avm server that in its turn is used by the node keywords = ["fluence", "air", "webassembly", "programming-language"] categories = ["wasm"] diff --git a/crates/data-store/Cargo.toml b/crates/data-store/Cargo.toml index 20a0d31a..59406c75 100644 --- a/crates/data-store/Cargo.toml +++ b/crates/data-store/Cargo.toml @@ -7,7 +7,6 @@ edition = "2018" license = "Apache-2.0" documentation = "https://docs.rs/avm-data-store" repository = "https://github.com/fluencelabs/aquavm/tree/master/crates/data-store" -publish = true # this crate is used by avm server that in its turn is used by the node keywords = ["fluence", "air", "webassembly", "programming-language"] categories = ["wasm"] diff --git a/crates/interpreter-wasm/Cargo.toml b/crates/interpreter-wasm/Cargo.toml index f1ff0958..d163c64c 100644 --- a/crates/interpreter-wasm/Cargo.toml +++ b/crates/interpreter-wasm/Cargo.toml @@ -12,7 +12,6 @@ include = [ ] documentation = "https://docs.rs/air-interpreter-wasm" repository = "https://github.com/fluencelabs/aquavm/tree/master/crates/interpreter-wasm" -publish = true # this crate is used by the node keywords = ["fluence", "air", "webassembly", "programming-language"] categories = ["wasm"]