ci: Update e2e (#378)

This commit is contained in:
Anatolios Laskaris
2022-11-16 14:49:51 +02:00
committed by GitHub
parent 9896306573
commit c33d46619d
12 changed files with 108 additions and 200 deletions

View File

@ -1,7 +1,3 @@
[http]
timeout = 30 # timeout for each HTTP request, in seconds
multiplexing = false # HTTP/2 multiplexing
[net] [net]
retry = 50 # network retries retry = 50 # network retries

View File

@ -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'

View File

@ -21,11 +21,10 @@ jobs:
- name: Setup rust toolchain - name: Setup rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1 uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo install marine - name: Install marine
uses: baptiste0928/cargo-install@v1.3.0
- name: Build Wasm binary for interpreter with:
run: marine build --features marine crate: marine
working-directory: air-interpreter
- name: Build Wasm binary for tests - name: Build Wasm binary for tests
run: ./build_test_binaries.sh run: ./build_test_binaries.sh

View File

@ -13,6 +13,8 @@ jobs:
snapshot: snapshot:
name: "aquavm" name: "aquavm"
uses: ./.github/workflows/snapshot.yml uses: ./.github/workflows/snapshot.yml
with:
ref: ${{ github.ref }}
rust-peer: rust-peer:
name: "rust-peer" name: "rust-peer"
@ -22,16 +24,19 @@ jobs:
uses: fluencelabs/rust-peer/.github/workflows/snapshot.yml@master uses: fluencelabs/rust-peer/.github/workflows/snapshot.yml@master
with: with:
image-name: "docker.fluence.dev/aquavm" image-name: "docker.fluence.dev/aquavm"
avm-server-version: | cargo-dependencies: |
{ [
"git": "https://github.com/fluencelabs/aquavm", {
"branch": "${{ github.head_ref }}" "package": "avm-server",
} "version": "=${{ needs.snapshot.outputs.cargo-version }}",
air-interpreter-wasm-version: | "registry": "fluence"
{ },
"version": "=${{ needs.snapshot.outputs.air-interpreter-wasm-version }}", {
"registry": "fluence" "package": "air-interpreter-wasm",
} "version": "=${{ needs.snapshot.outputs.cargo-version }}",
"registry": "fluence"
}
]
fluence-js-tests: fluence-js-tests:
name: "fluence-js" name: "fluence-js"
@ -83,5 +88,3 @@ jobs:
with: with:
aqua-version: "${{ needs.aqua-snapshot.outputs.aqua-version }}" aqua-version: "${{ needs.aqua-snapshot.outputs.aqua-version }}"
rust-peer-image: "${{ needs.rust-peer.outputs.rust-peer-image }}" rust-peer-image: "${{ needs.rust-peer.outputs.rust-peer-image }}"
# uncomment and change to branch name to run against
# ref: show-aqua-version

View File

@ -2,13 +2,21 @@ name: Publish snapshots
on: on:
workflow_call: workflow_call:
inputs:
ref:
description: "GitHub ref to checkout to"
type: string
default: "master"
cargo-dependencies:
description: "Cargo dependencies map"
type: string
outputs: outputs:
cargo-version:
description: "Cargo snapshot version"
value: ${{ jobs.cargo-snapshot.outputs.version }}
avm-version: avm-version:
description: "@fluencelabs/avm version" description: "@fluencelabs/avm version"
value: ${{ jobs.publish-avm.outputs.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: air-beautify-wasm-version:
description: "air-beautify-wasm version" description: "air-beautify-wasm version"
value: ${{ jobs.publish-beautify.outputs.version }} value: ${{ jobs.publish-beautify.outputs.version }}
@ -24,12 +32,15 @@ jobs:
steps: steps:
- name: Checkout AquaVM - name: Checkout AquaVM
uses: actions/checkout@v3 uses: actions/checkout@v3
with:
repository: fluencelabs/aquavm
ref: ${{ inputs.ref }}
- name: Setup Rust toolchain - name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1 uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install marine - name: Install marine
uses: baptiste0928/cargo-install@v1 uses: baptiste0928/cargo-install@v1.3.0
with: with:
crate: marine crate: marine
@ -43,8 +54,66 @@ jobs:
name: air-interpreter-wasm name: air-interpreter-wasm
path: target/wasm32-wasi/release/air_interpreter_server.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: publish-avm:
name: "Publish avm snapshot" name: "Publish @fluencelabs/avm snapshot"
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: wasm needs: wasm
@ -54,12 +123,14 @@ jobs:
permissions: permissions:
contents: read contents: read
pull-requests: write
id-token: write id-token: write
steps: steps:
- name: Checkout AquaVM - name: Checkout AquaVM
uses: actions/checkout@v3 uses: actions/checkout@v3
with:
repository: fluencelabs/aquavm
ref: ${{ inputs.ref }}
- name: Download air-interpreter-wasm binary - name: Download air-interpreter-wasm binary
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
@ -71,7 +142,7 @@ jobs:
working-directory: avm/client/dist working-directory: avm/client/dist
- name: Import secrets - name: Import secrets
uses: hashicorp/vault-action@v2.4.2 uses: hashicorp/vault-action@v2.4.3
with: with:
url: https://vault.fluence.dev url: https://vault.fluence.dev
path: jwt/github path: jwt/github
@ -103,12 +174,10 @@ jobs:
SHA=${{ github.event.pull_request.head.sha }} SHA=${{ github.event.pull_request.head.sha }}
echo "::set-output name=sha::${SHA::7}" echo "::set-output name=sha::${SHA::7}"
echo "::set-output name=branch::${GITHUB_HEAD_REF//[^a-zA-Z0-9-]/-}" 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 - name: Set package version
id: build id: build
env: env:
VERSION: ${{ steps.version.outputs.avm }}
BRANCH: ${{ steps.version.outputs.branch }} BRANCH: ${{ steps.version.outputs.branch }}
SHA: ${{ steps.version.outputs.sha }} SHA: ${{ steps.version.outputs.sha }}
RUN: ${{ github.run_number }} RUN: ${{ github.run_number }}
@ -116,149 +185,34 @@ jobs:
working-directory: avm/client working-directory: avm/client
run: | run: |
echo "::set-output name=version::$(\ echo "::set-output name=version::$(\
npm version --no-git-tag-version \ npm version prerelease \
${{ env.VERSION }}-${{ env.BRANCH }}-${{ env.SHA }}-${{ env.RUN }}-${{ env.ATTEMPT }})" --no-git-tag-version \
--preid ${{ env.BRANCH }}-${{ env.SHA }}-${{ env.RUN }}-${{ env.ATTEMPT }})"
- name: Publish to self-hosted npm repo - name: Publish to self-hosted npm repo
working-directory: avm/client working-directory: avm/client
run: npm publish --tag snapshot --registry https://npm.fluence.dev 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: publish-air-beautify:
name: "Publish air-beautify-wasm snapshot" name: "Publish air-beautify-wasm snapshot"
runs-on: ubuntu-latest runs-on: builder
outputs: outputs:
version: "${{ steps.build.outputs.version }}" version: "${{ steps.build.outputs.version }}"
permissions: permissions:
contents: read contents: read
pull-requests: write
id-token: write id-token: write
steps: steps:
- name: Checkout aquavm - name: Checkout aquavm
uses: actions/checkout@v3 uses: actions/checkout@v3
with:
repository: fluencelabs/aquavm
ref: ${{ inputs.ref }}
- name: Import secrets - name: Import secrets
uses: hashicorp/vault-action@v2.4.2 uses: hashicorp/vault-action@v2.4.3
with: with:
url: https://vault.fluence.dev url: https://vault.fluence.dev
path: jwt/github path: jwt/github
@ -270,10 +224,11 @@ jobs:
secrets: | secrets: |
kv/npm-registry/basicauth/ci token | NODE_AUTH_TOKEN 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 - name: Setup wasm-pack
uses: jetli/wasm-pack-action@v0.3.0 uses: jetli/wasm-pack-action@v0.3.0
with:
version: 'latest'
- name: Setup node with self-hosted npm registry - name: Setup node with self-hosted npm registry
uses: actions/setup-node@v3 uses: actions/setup-node@v3
@ -311,27 +266,3 @@ jobs:
- name: Publish to self-hosted npm repo - name: Publish to self-hosted npm repo
working-directory: tools/wasm/air-beautify-wasm/pkg working-directory: tools/wasm/air-beautify-wasm/pkg
run: npm publish --tag snapshot --registry https://npm.fluence.dev 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
```

View File

@ -7,7 +7,6 @@ edition = "2018"
license = "Apache-2.0" license = "Apache-2.0"
documentation = "https://docs.rs/avm-interface" documentation = "https://docs.rs/avm-interface"
repository = "https://github.com/fluencelabs/aquavm/tree/master/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"] keywords = ["fluence", "air", "webassembly", "programming-language"]
categories = ["wasm"] categories = ["wasm"]

View File

@ -7,7 +7,6 @@ edition = "2018"
license = "Apache-2.0" license = "Apache-2.0"
documentation = "https://docs.rs/avm-server" documentation = "https://docs.rs/avm-server"
repository = "https://github.com/fluencelabs/aquavm/tree/master/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"] keywords = ["fluence", "air", "webassembly", "programming-language"]
categories = ["wasm"] categories = ["wasm"]

View File

@ -7,7 +7,6 @@ edition = "2018"
license = "Apache-2.0" license = "Apache-2.0"
documentation = "https://docs.rs/air-interpreter-interface" documentation = "https://docs.rs/air-interpreter-interface"
repository = "https://github.com/fluencelabs/aquavm/tree/master/crates/air-lib/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"] keywords = ["fluence", "air", "webassembly", "programming-language"]
categories = ["wasm"] categories = ["wasm"]

View File

@ -7,7 +7,6 @@ edition = "2018"
license = "Apache-2.0" license = "Apache-2.0"
documentation = "https://docs.rs/polyplets" documentation = "https://docs.rs/polyplets"
repository = "https://github.com/fluencelabs/aquavm/tree/master/crates/air-lib/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"] keywords = ["fluence", "air", "webassembly", "security", "authorization"]
categories = ["authentication"] categories = ["authentication"]

View File

@ -5,7 +5,6 @@ description = "AIR helper funcitions and macros"
authors = ["Fluence Labs"] authors = ["Fluence Labs"]
edition = "2018" edition = "2018"
license = "Apache-2.0" 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"] keywords = ["fluence", "air", "webassembly", "programming-language"]
categories = ["wasm"] categories = ["wasm"]

View File

@ -7,7 +7,6 @@ edition = "2018"
license = "Apache-2.0" license = "Apache-2.0"
documentation = "https://docs.rs/avm-data-store" documentation = "https://docs.rs/avm-data-store"
repository = "https://github.com/fluencelabs/aquavm/tree/master/crates/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"] keywords = ["fluence", "air", "webassembly", "programming-language"]
categories = ["wasm"] categories = ["wasm"]

View File

@ -12,7 +12,6 @@ include = [
] ]
documentation = "https://docs.rs/air-interpreter-wasm" documentation = "https://docs.rs/air-interpreter-wasm"
repository = "https://github.com/fluencelabs/aquavm/tree/master/crates/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"] keywords = ["fluence", "air", "webassembly", "programming-language"]
categories = ["wasm"] categories = ["wasm"]