chore: Update CI (#446)

* Update CI

* Trigger

* Fix

* Fix

* Ignore changed in docs
This commit is contained in:
Anatolios Laskaris 2023-05-08 16:52:28 +03:00 committed by GitHub
parent cfe9d5f741
commit 8fea53cbb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 130 additions and 347 deletions

View File

@ -1,7 +0,0 @@
service Op("op"):
noop()
func check_connection() -> string:
on HOST_PEER_ID:
Op.noop()
<- "ok"

8
.github/deploy.aqua vendored
View File

@ -1,8 +0,0 @@
service CallParameters:
call_parameters() -> string
func call(service_id: string) -> string:
on HOST_PEER_ID:
CallParameters service_id
r <- CallParameters.call_parameters()
<- r

View File

@ -1,6 +0,0 @@
#!/bin/bash
set -o pipefail -o errexit -o nounset
set -x
MARINE_RELEASE="https://github.com/fluencelabs/marine/releases/download/marine-v0.12.6/marine"
curl -sS -L $MARINE_RELEASE -o /usr/local/bin/marine && chmod +x /usr/local/bin/marine

View File

@ -1,84 +0,0 @@
name: "check-connection"
on:
push:
# branches:
# - "master"
jobs:
check-deployment:
runs-on: ubuntu-latest
strategy:
matrix:
node: [
'/dns4/kras-00.fluence.dev/tcp/19990/wss/p2p/12D3KooWSD5PToNiLQwKDXsu8JSysCwUt8BVUJEqCHcDe7P5h45e',
'/dns4/kras-00.fluence.dev/tcp/19001/wss/p2p/12D3KooWR4cv1a8tv7pps4HH6wePNaK6gf1Hww5wcCMzeWxyNw51',
'/dns4/kras-01.fluence.dev/tcp/19001/wss/p2p/12D3KooWKnEqMfYo9zvfHmqTLpLdiHXPe4SVqUWcWHDJdFGrSmcA',
'/dns4/kras-02.fluence.dev/tcp/19001/wss/p2p/12D3KooWHLxVhUQyAuZe6AHMB29P7wkvTNMn7eDMcsqimJYLKREf',
'/dns4/kras-03.fluence.dev/tcp/19001/wss/p2p/12D3KooWJd3HaMJ1rpLY1kQvcjRPEvnDwcXrH8mJvk7ypcZXqXGE',
'/dns4/kras-04.fluence.dev/tcp/19001/wss/p2p/12D3KooWFEwNWcHqi9rtsmDhsYcDbRUCDXH84RC4FW6UfsFWaoHi',
'/dns4/kras-05.fluence.dev/tcp/19001/wss/p2p/12D3KooWCMr9mU894i8JXAFqpgoFtx6qnV1LFPSfVc3Y34N4h4LS',
'/dns4/kras-06.fluence.dev/tcp/19001/wss/p2p/12D3KooWDUszU2NeWyUVjCXhGEt1MoZrhvdmaQQwtZUriuGN1jTr',
'/dns4/kras-07.fluence.dev/tcp/19001/wss/p2p/12D3KooWEFFCZnar1cUJQ3rMWjvPQg6yMV2aXWs2DkJNSRbduBWn',
'/dns4/kras-08.fluence.dev/tcp/19001/wss/p2p/12D3KooWFtf3rfCDAfWwt6oLZYZbDfn9Vn7bv7g6QjjQxUUEFVBt',
'/dns4/kras-09.fluence.dev/tcp/19001/wss/p2p/12D3KooWD7CvsYcpF9HE9CCV9aY3SJ317tkXVykjtZnht2EbzDPm'
]
fail-fast: false
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-16-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-v1-node-16
- name: Setup Node.js 16
uses: actions/setup-node@v1
with:
node-version: 16
- run: npm install -g @fluencelabs/aqua@latest
- name: "Check connection to network"
run: |
set -x
NODE=${{ matrix.node }}
INPUT=$GITHUB_WORKSPACE/.github/check_connection.aqua
RESULT=$(aqua run --addr $NODE --sk qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqo= -f 'check_connection()' --input $INPUT)
RESULT=$(echo $RESULT | sed -e 's/Your peerId: [a-zA-Z0-9]*//g' | xargs)
if [ "$RESULT" != "ok" ]; then
echo "Failed to connect to $NODE"
exit 1
fi
working-directory: marine-examples/call_parameters

View File

@ -1,87 +0,0 @@
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" --name fluence -p 5001:5001 -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-16-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-v1-node-16
- name: Setup Node.js 16
uses: actions/setup-node@v1
with:
node-version: 16
- run: npm install -g @fluencelabs/aqua@0.7.4-320
- name: "Wait for aqua-ipfs service to start"
run: |
set -o errexit -o nounset -o pipefail
set -x
while true; do
STATUS=$(docker logs fluence |& grep -q 'Fluence has been successfully started.' && echo "OK" || echo "FAIL")
if [ $STATUS == "OK" ]; then
break;
else
sleep 0.5
echo "Waiting for all builtin services to start"
fi
done
- name: "Check call_parameters deployment"
run: |
set -o errexit -o nounset -o pipefail
NODE="/ip4/127.0.0.1/tcp/4310/ws/p2p/12D3KooWKEprYXUXqoV5xSBeyqrWLpQLLH4PXfvVkDJtmcqmh5V3"
SERVICE_ID=`./deploy.sh $NODE`
INPUT=$GITHUB_WORKSPACE/.github/deploy.aqua
RESULT=$(aqua run --addr $NODE --sk qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqo= -f 'call(service_id)' -d '{"service_id": "'$SERVICE_ID'"}' --input $INPUT | jq -r)
EXPECTED_PEER_ID=$(echo -e "$RESULT" | sed -n '1p')
RESULT_PEER_ID=$(echo -e "$RESULT" | sed -n '3p')
if [ "$EXPECTED_PEER_ID" != "$RESULT_PEER_ID" ]; then
echo "Expected $EXPECTED_PEER_ID, got $RESULT_PEER_ID"
exit 1
fi
RESULT_SERVICE_ID=$(echo -e "$RESULT" | sed -n '2p')
if [ "$SERVICE_ID" != "$RESULT_SERVICE_ID" ]; then
echo "Expected $SERVICE_ID, got $RESULT_SERVICE_ID"
exit 1
fi
working-directory: marine-examples/call_parameters

17
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,17 @@
name: ci
on:
pull_request:
branches:
- "main"
paths:
- "!**.md"
concurrency:
group: "gitops-${{ github.ref }}"
cancel-in-progress: true
jobs:
js:
name: "JS projects"
uses: ./.github/workflows/js-projects.yml

92
.github/workflows/js-projects.yml vendored Normal file
View File

@ -0,0 +1,92 @@
name: Run tests in JS projects
on:
workflow_call:
env:
CI: true
FORCE_COLOR: true
jobs:
matrix:
runs-on: ubuntu-latest
outputs:
matrix: "${{ steps.changed.outputs.all_changed_files }}"
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Get changed files
id: changed
uses: tj-actions/changed-files@v35
with:
files: |
quickstart/1-browser-to-browser
quickstart/3-browser-to-service
js-client-examples/hello-world
js-client-examples/browser-example
js-client-examples/node-example
aqua-examples/echo-greeter/client-peer
aqua-examples/price-oracle/client-peer
aqua-examples/price-oracle/web
aqua-examples/aqua-ipfs-integration
dir_names: true
json: true
json_raw_format: true
- name: Print matrix
run: |
echo '${{ steps.changed.outputs.all_changed_files }}' | jq
test:
runs-on: ubuntu-latest
needs: matrix
strategy:
fail-fast: false
matrix:
dir: ${{ fromJSON(needs.matrix.outputs.matrix) }}
defaults:
run:
working-directory: ${{ matrix.dir }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly-2022-06-27
target: wasm32-wasi
- name: Setup marine
uses: fluencelabs/setup-marine@v1
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "16"
registry-url: "https://registry.npmjs.org"
cache-dependency-path: "${{ matrix.dir }}/package-lock.json"
- run: npm i
- run: npm run build
- name: Run tests
if: matrix.dir != 'aqua-examples/aqua-ipfs-integration'
run: npm run test
- name: Run aqua-ipfs-integration tests for web
if: matrix.dir == 'aqua-examples/aqua-ipfs-integration'
run: npm run test -w web
- name: Run aqua-ipfs-integration tests for nodejs
if: matrix.dir == 'aqua-examples/aqua-ipfs-integration'
run: npm run test -w nodejs

View File

@ -1,66 +0,0 @@
name: Run tests for "aqua ipfs integration" project
on:
push:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
project: [web, nodejs]
fail-fast: false
steps:
- uses: actions/checkout@v2
### Prepare cargo & toolchains
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
~/.cargo/bin
target
key: ${{ runner.os }}-cargo-v2-${{ hashFiles('**/Cargo.lock') }}
- name: Install Rust toolchain with wasm32-unknown-unknown
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2022-06-27
target: wasm32-unknown-unknown
profile: minimal
override: true
- name: Install wasm32-wasi
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2022-06-27
target: wasm32-wasi
profile: minimal
- name: Install marine
run: cargo install marine || true
- uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-v1-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-v1-node-${{ matrix.node-version }}
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
### === Rust tests ===
- name: run tests
working-directory:
./aqua-examples/aqua-ipfs-integration
env:
CI: true
run: |
npm i
CI=false npm run build
npm run test -w ${{ matrix.project }}

View File

@ -1,74 +0,0 @@
name: Run tests for js-based projects
on:
push:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
working-directory: [
"./quickstart/1-browser-to-browser",
"./quickstart/3-browser-to-service",
"./js-client-examples/hello-world",
"./js-client-examples/browser-example",
"./js-client-examples/node-example",
"./aqua-examples/echo-greeter/client-peer",
"./aqua-examples/price-oracle/client-peer",
"./aqua-examples/price-oracle/web"
]
fail-fast: false
steps:
- uses: actions/checkout@v2
### Prepare cargo & toolchains
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
~/.cargo/bin
target
key: ${{ runner.os }}-cargo-v2-${{ hashFiles('**/Cargo.lock') }}
- name: Install Rust toolchain with wasm32-unknown-unknown
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2022-06-27
target: wasm32-unknown-unknown
profile: minimal
override: true
- name: Install wasm32-wasi
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2022-06-27
target: wasm32-wasi
profile: minimal
- name: Install marine
run: cargo install marine || true
- uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-v1-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-v1-node-${{ matrix.node-version }}
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
### === Rust tests ===
- name: run tests
working-directory: ${{ matrix.working-directory }}
env:
CI: true
run: |
npm i
CI=false npm run build
npm run test

View File

@ -1,11 +1,15 @@
# IPFS code execution example
> The build and deploy instructions as well as some of the Aqua code are outdated and the deployed services are no longer available. An updated version will be available soon.
> The build and deploy instructions as well as some of the Aqua code are
> outdated and the deployed services are no longer available. An updated version
> will be available soon.
This example showcases 2 things:
1. how it's possible to store .wasm modules on IPFS, then deploy them to Fluence as a service
2. ability to process IPFS files via a Fluence service. In this example, we get a size of a file
1. how it's possible to store .wasm modules on IPFS, then deploy them to Fluence
as a service
2. ability to process IPFS files via a Fluence service. In this example, we get
a size of a file
## Learn about AquaIPFS
@ -19,23 +23,24 @@ You need npm v7 or later to run the examples
1. Run it
```bash
npm i
npm run build -w aqua
npm start -w web
```
```bash
npm i
npm run build -w aqua
npm start -w web
```
2. Press "deploy"
3. Copy WASM service CID and press "get_size"
### NodeJS example
```bash
npm i
npm run build -w aqua
npm start -w nodejs
```
```bash
npm i
npm run build -w aqua
npm start -w nodejs
```
## Aqua implementation
The business logic is implemented in Aqua in [process.aqua](aqua/aqua/process.aqua)
The business logic is implemented in Aqua in
[process.aqua](aqua/aqua/process.aqua)

View File

@ -18,4 +18,5 @@ npm start
## Learn more
To learn more, refer to the [documentation page](https://fluence.dev//docs/build/js-client/js-client)
To learn more, refer to the
[documentation page](https://fluence.dev//docs/build/js-client/js-client)