Check deployment of call_parameters (#6)

This commit is contained in:
folex 2021-06-13 23:26:30 +03:00 committed by GitHub
parent 3a6be62bde
commit 62faa2fe45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 100 additions and 2 deletions

14
.github/download_marine.sh vendored Executable file
View 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'

62
.github/workflows/check-deploy.yml vendored Normal file
View File

@ -0,0 +1,62 @@
name: "check-deploy"
on:
push:
# branches:
# - "master"
jobs:
check-deployment:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout repository
uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
~/.cargo/bin
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- run: docker run -d --rm -e RUST_LOG="info" -p 1210:1210 -p 4310:4310 fluencelabs/fluence -t 1210 -w 4310 -k gKdiCSUr1TFGFEgu2t8Ch1XEUsrN5A2UfBLjSZvfci9SPR3NvZpACfcpPGC3eY4zma1pk7UvYv5zb1VjvPHwCjj --local
- name: Download marine
run: sudo bash $GITHUB_WORKSPACE/.github/download_marine.sh
- name: Install Rust
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 target add wasm32-wasi --toolchain nightly-2021-04-24-x86_64-unknown-linux-gnu
- uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-v1-node-14-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-v1-node-14
- name: Setup Node.js 14
uses: actions/setup-node@v1
with:
node-version: 14
- run: npm install -g @fluencelabs/fldist
- name: "Check call parameters deployment"
run: |
set -x
export NODE="/ip4/127.0.0.1/tcp/4310/ws/p2p/12D3KooWKEprYXUXqoV5xSBeyqrWLpQLLH4PXfvVkDJtmcqmh5V3"
SERVICE_ID=`./deploy.sh`
fldist --node-addr $NODE run_air -d '{"service_id": "'$SERVICE_ID'"}' -p <(echo '
(seq
(call relay (service_id "call_parameters") [] result)
(call %init_peer_id% (returnService "run") [result])
)
')
working-directory: call_parameters

View File

@ -0,0 +1,3 @@
{
"name": "call_parameters"
}

19
call_parameters/deploy.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash
set -o errexit -o nounset -o pipefail
if [[ -z "${NODE:-}" ]]; then
NODE_ADDR=""
else
NODE_ADDR="--node-addr $NODE"
fi
./build.sh
# check it .wasm was built
WASM="artifacts/call_parameters.wasm"
test -f "$WASM" || echo >&2 "Couldn't find $WASM"
# create a service from that .wasm
CONFIG="config.json"
SERVICE_ID=$(fldist new_service $NODE_ADDR --modules "$WASM:$CONFIG" --name call_parameters | head -n1 | sed -e 's/service id: //')
echo $SERVICE_ID

View File

@ -2,13 +2,13 @@
set -euo pipefail
# check `fcli` and `fldist` tools are installed or install them
(command -v fce || cargo install fcli) >/dev/null
(command -v marine || cargo install marine) >/dev/null
(command -v fldist || npm install -g @fluencelabs/fldist) >/dev/null
# build .wasm
(
cd backend
fce build --release
marine build --release
)
# check it .wasm was built