CI: update aqua-ipfs version in Builtin Services (#22)

BREAKING CHANGE: IPFS builtin service id changed from 'ipfs-adapter' to 'aqua-ipfs'
This commit is contained in:
folex 2021-08-23 18:24:52 +03:00 committed by GitHub
parent 78a53e1bdd
commit 25a493ab2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 81 additions and 28 deletions

View File

@ -16,7 +16,7 @@ jobs:
sudo bash .github/download_marine.sh sudo bash .github/download_marine.sh
- restore_cache: - restore_cache:
keys: keys:
- ipfs-adapter00-{{ checksum "./service/pure/Cargo.lock" }}-{{ checksum "./service/effector/Cargo.lock" }} - aqua-ipfs00-{{ checksum "./service/pure/Cargo.lock" }}-{{ checksum "./service/effector/Cargo.lock" }}
- run: | - run: |
rustup toolchain install nightly-2021-04-24-x86_64-unknown-linux-gnu rustup toolchain install nightly-2021-04-24-x86_64-unknown-linux-gnu
rustup default nightly-2021-04-24-x86_64-unknown-linux-gnu rustup default nightly-2021-04-24-x86_64-unknown-linux-gnu
@ -28,7 +28,7 @@ jobs:
paths: paths:
- ~/.cargo - ~/.cargo
- ~/.rustup - ~/.rustup
key: ipfs-adapter00-{{ checksum "./service/pure/Cargo.lock" }}-{{ checksum "./service/effector/Cargo.lock" }} key: aqua-ipfs00-{{ checksum "./service/pure/Cargo.lock" }}-{{ checksum "./service/effector/Cargo.lock" }}
workflows: workflows:

View File

@ -66,15 +66,15 @@ jobs:
rustup target add wasm32-wasi --toolchain nightly-2021-04-24-x86_64-unknown-linux-gnu rustup target add wasm32-wasi --toolchain nightly-2021-04-24-x86_64-unknown-linux-gnu
### Build ### Build
- name: Build ipfs-adapter - name: Build aqua-ipfs
working-directory: ./service working-directory: ./service
run: ./build.sh run: ./build.sh
- name: Create distribution package - name: Create distribution package
working-directory: ./service working-directory: ./service
run: | run: |
mv artifacts ipfs-adapter mv artifacts aqua-ipfs
tar -zcvf ipfs-adapter.tar.gz ipfs-adapter tar -zcvf aqua-ipfs.tar.gz aqua-ipfs
- name: Compile Aqua to TypeScript - name: Compile Aqua to TypeScript
working-directory: ./aqua working-directory: ./aqua
@ -98,12 +98,13 @@ jobs:
### Publish ### Publish
- name: Release to GitHub - name: Release to GitHub
id: release
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
with: with:
name: aqua-ipfs ${{ env.RELEASE_VERSION }} name: aqua-ipfs ${{ env.RELEASE_VERSION }}
tag_name: ${{ env.RELEASE_VERSION }} tag_name: ${{ env.RELEASE_VERSION }}
files: | files: |
./service/ipfs-adapter.tar.gz ./service/aqua-ipfs.tar.gz
body: ${{steps.github_release.outputs.changelog}} body: ${{steps.github_release.outputs.changelog}}
draft: false draft: false
prerelease: false prerelease: false
@ -136,3 +137,55 @@ jobs:
env: env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
working-directory: ./aqua/target/typescript working-directory: ./aqua/target/typescript
## Update Builtin Services repo
- name: Get tar.gz URL
id: package-url
uses: actions/github-script@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
result-encoding: string
script: |
try {
let assets = await github.repos.listReleaseAssets({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: "${{ steps.release.outputs.id }}",
});
console.dir(assets);
let package = assets.data.find((a) => a.name === 'aqua-ipfs.tar.gz');
let url = package.browser_download_url;
console.log("URL: " + url);
return url;
} catch (e) {
console.log("Err: " + e);
throw e;
}
- name: Calculate SHA256
run: |
du -hs ./service/aqua-ipfs.tar.gz
echo $(sha256sum ./service/aqua-ipfs.tar.gz)
echo "SHA256=$(sha256sum ./service/aqua-ipfs.tar.gz | awk '{ print $1 }')" >> $GITHUB_ENV
- name: Update version in builtins repo
uses: benc-uk/workflow-dispatch@v1
with:
workflow: update_service
repo: fluencelabs/builtin-services
ref: 'main'
token: ${{ secrets.PERSONAL_TOKEN }}
inputs: '{
"name": "aqua-ipfs",
"version": "${{ env.RELEASE_VERSION }}",
"url": "${{ steps.package-url.outputs.result }}",
"sha256": "${{ env.SHA256 }}"
}'
- name: Log notice
uses: actions/github-script@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
console.dir(core);
core.info("aqua-ipfs was updated to ${{ env.RELEASE_VERSION }} in Builtin Services Repo");

View File

@ -27,7 +27,7 @@ cid === localCID // true
``` ```
## Directory structure ## Directory structure
- `aqua` Aqua API of IPFS-adapter, go to its [README](/aqua/README.md) - `aqua` Aqua API of AquaIPFS. See [aqua/README](/aqua/README.md)
- `service` contains Rust service that implements all the IPFS calls by using `ipfs` cli mounted binary - `service` contains Rust service that implements all the IPFS calls by using `ipfs` cli mounted binary
- `example` A simple example of how to use ipfs adapter from TypeScript - `example` A simple example of how to use ipfs adapter from TypeScript
- `local-network` contains Docker Compose YAML config to run a local Fluence network of 3 nodes - `local-network` contains Docker Compose YAML config to run a local Fluence network of 3 nodes
@ -35,4 +35,4 @@ cid === localCID // true
# Contribution # Contribution
Contributions are welcome! Contributions are welcome!
`ipfs-adapter` integrates with IPFS by using `ipfs` CLI, so it's possible to expose virtually any IPFS API to Aqua. Feel free to open an issue or contribute APIs and patterns you find useful. `aqua-ipfs` integrates with IPFS by using `ipfs` CLI, so it's possible to expose virtually any IPFS API to Aqua. Feel free to open an issue or contribute APIs and patterns you find useful.

View File

@ -1,4 +1,4 @@
# Aqua API of IPFS-adapter # Aqua API of AquaIPFS
## Documentation ## Documentation
See [Aqua Book](https://fluence.dev/aqua-book/libraries/aqua-ipfs). See [Aqua Book](https://fluence.dev/aqua-book/libraries/aqua-ipfs).
@ -6,7 +6,7 @@ See [Aqua Book](https://fluence.dev/aqua-book/libraries/aqua-ipfs).
## API ## API
Public API is defined in [ipfs-api.aqua](/aqua/ipfs-api.aqua). Public API is defined in [ipfs-api.aqua](/aqua/ipfs-api.aqua).
ipfs-adapter service API is defined in [ipfs.aqua](/aqua/ipfs.aqua). aqua-ipfs service API is defined in [ipfs.aqua](/aqua/ipfs.aqua).
## How to use Aqua API in TypeScript ## How to use Aqua API in TypeScript
There's a simple example in [example](/example/index.ts) There's a simple example in [example](/example/index.ts)

View File

@ -46,7 +46,7 @@ func get_and_cache(
<- localCid <- localCid
-- Upload file `path` to IPFS node running on `node` -- Upload file `path` to IPFS node running on `node`
-- path should exist & be available to `ipfs-adapter` -- path should exist & be available to `aqua-ipfs`
func put(node: PeerId, path: string) -> IpfsPutResult: func put(node: PeerId, path: string) -> IpfsPutResult:
on node: on node:
result <- Ipfs.put(path) result <- Ipfs.put(path)
@ -58,7 +58,7 @@ func get_from(node: PeerId, cid: CID, from: Multiaddr) -> IpfsGetResult:
result <- Ipfs.get_from(cid, from) result <- Ipfs.get_from(cid, from)
<- result <- result
-- Set timeout for IPFS calls in `ipfs-adapter` -- Set timeout for IPFS calls in `aqua-ipfs`
func set_timeout(node: PeerId, timeout_sec: u64): func set_timeout(node: PeerId, timeout_sec: u64):
on node: on node:
Ipfs.set_timeout(timeout_sec) Ipfs.set_timeout(timeout_sec)

View File

@ -17,7 +17,7 @@ data IpfsResult:
success: bool success: bool
error: string error: string
service Ipfs("ipfs-adapter"): service Ipfs("aqua-ipfs"):
connect(multiaddr: string) -> IpfsResult connect(multiaddr: string) -> IpfsResult
get(hash: string) -> IpfsGetResult get(hash: string) -> IpfsGetResult
get_external_api_multiaddr() -> IpfsMultiaddrResult get_external_api_multiaddr() -> IpfsMultiaddrResult

View File

@ -32,7 +32,7 @@ export async function set_timeout(client: FluenceClient, node: string, timeout_s
(call -relay- ("op" "noop") []) (call -relay- ("op" "noop") [])
) )
(xor (xor
(call node ("ipfs-adapter" "set_timeout") [timeout_sec]) (call node ("aqua-ipfs" "set_timeout") [timeout_sec])
(seq (seq
(call -relay- ("op" "noop") []) (call -relay- ("op" "noop") [])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
@ -101,12 +101,12 @@ export async function get_and_cache(client: FluenceClient, node: string, cid: st
) )
(xor (xor
(seq (seq
(call node ("ipfs-adapter" "get_from") [cid from] get) (call node ("aqua-ipfs" "get_from") [cid from] get)
(xor (xor
(match get.$.success! true (match get.$.success! true
(xor (xor
(seq (seq
(call node ("ipfs-adapter" "put") [get.$.path!] put) (call node ("aqua-ipfs" "put") [get.$.path!] put)
(xor (xor
(match put.$.success! true (match put.$.success! true
(xor (xor
@ -228,7 +228,7 @@ export async function get_from(client: FluenceClient, node: string, cid: string,
(call -relay- ("op" "noop") []) (call -relay- ("op" "noop") [])
) )
(xor (xor
(call node ("ipfs-adapter" "get_from") [cid from] result) (call node ("aqua-ipfs" "get_from") [cid from] result)
(seq (seq
(call -relay- ("op" "noop") []) (call -relay- ("op" "noop") [])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
@ -299,7 +299,7 @@ export async function get_local_api_multiaddr(client: FluenceClient, node: strin
(call -relay- ("op" "noop") []) (call -relay- ("op" "noop") [])
) )
(xor (xor
(call node ("ipfs-adapter" "get_local_api_multiaddr") [] result) (call node ("aqua-ipfs" "get_local_api_multiaddr") [] result)
(seq (seq
(call -relay- ("op" "noop") []) (call -relay- ("op" "noop") [])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
@ -368,7 +368,7 @@ export async function get_external_swarm_multiaddr(client: FluenceClient, node:
(call -relay- ("op" "noop") []) (call -relay- ("op" "noop") [])
) )
(xor (xor
(call node ("ipfs-adapter" "get_external_swarm_multiaddr") [] result) (call node ("aqua-ipfs" "get_external_swarm_multiaddr") [] result)
(seq (seq
(call -relay- ("op" "noop") []) (call -relay- ("op" "noop") [])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
@ -440,7 +440,7 @@ export async function put(client: FluenceClient, node: string, path: string, con
(call -relay- ("op" "noop") []) (call -relay- ("op" "noop") [])
) )
(xor (xor
(call node ("ipfs-adapter" "put") [path] result) (call node ("aqua-ipfs" "put") [path] result)
(seq (seq
(call -relay- ("op" "noop") []) (call -relay- ("op" "noop") [])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
@ -510,7 +510,7 @@ export async function get_external_api_multiaddr(client: FluenceClient, node: st
(call -relay- ("op" "noop") []) (call -relay- ("op" "noop") [])
) )
(xor (xor
(call node ("ipfs-adapter" "get_external_api_multiaddr") [] result) (call node ("aqua-ipfs" "get_external_api_multiaddr") [] result)
(seq (seq
(call -relay- ("op" "noop") []) (call -relay- ("op" "noop") [])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])

View File

@ -1,7 +1,7 @@
(seq (seq
(seq (seq
(seq (seq
(call relay ("ipfs-adapter" "set_local_api_multiaddr") [local_api_multiaddr] local_api_res) (call relay ("aqua-ipfs" "set_local_api_multiaddr") [local_api_multiaddr] local_api_res)
(xor (xor
(match local_api_res.$.success! true (match local_api_res.$.success! true
(null) (null)
@ -10,7 +10,7 @@
) )
) )
(seq (seq
(call relay ("ipfs-adapter" "set_external_api_multiaddr") [external_api_multiaddr] external_api_res) (call relay ("aqua-ipfs" "set_external_api_multiaddr") [external_api_multiaddr] external_api_res)
(xor (xor
(match external_api_res.$.success! true (match external_api_res.$.success! true
(null) (null)
@ -20,7 +20,7 @@
) )
) )
(seq (seq
(call relay ("ipfs-adapter" "set_external_swarm_multiaddr") [external_swarm_multiaddr] external_swarm_res) (call relay ("aqua-ipfs" "set_external_swarm_multiaddr") [external_swarm_multiaddr] external_swarm_res)
(xor (xor
(match external_swarm_res.$.success! true (match external_swarm_res.$.success! true
(call %init_peer_id% ("op" "return") [true]) (call %init_peer_id% ("op" "return") [true])

View File

@ -1,5 +1,5 @@
{ {
"external_swarm_multiaddr": "$FLUENCE_ENV_IPFS_ADAPTER_EXTERNAL_SWARM_MULTIADDR", "external_swarm_multiaddr": "$FLUENCE_ENV_AQUA_IPFS_EXTERNAL_SWARM_MULTIADDR",
"local_api_multiaddr": "$FLUENCE_ENV_IPFS_ADAPTER_LOCAL_API_MULTIADDR", "local_api_multiaddr": "$FLUENCE_ENV_AQUA_IPFS_LOCAL_API_MULTIADDR",
"external_api_multiaddr": "$FLUENCE_ENV_IPFS_ADAPTER_EXTERNAL_API_MULTIADDR" "external_api_multiaddr": "$FLUENCE_ENV_AQUA_IPFS_EXTERNAL_API_MULTIADDR"
} }

View File

@ -18,4 +18,4 @@ mkdir -p artifacts
rm -f artifacts/*.wasm rm -f artifacts/*.wasm
cp target/wasm32-wasi/release/ipfs_effector.wasm artifacts/ cp target/wasm32-wasi/release/ipfs_effector.wasm artifacts/
cp target/wasm32-wasi/release/ipfs_pure.wasm artifacts/ cp target/wasm32-wasi/release/ipfs_pure.wasm artifacts/
marine aqua artifacts/ipfs_pure.wasm -s Ipfs -i ipfs-adapter >../aqua/ipfs.aqua marine aqua artifacts/ipfs_pure.wasm -s Ipfs -i aqua-ipfs >../aqua/ipfs.aqua