diff --git a/.github/download_marine.sh b/.github/download_marine.sh deleted file mode 100755 index c383f4f..0000000 --- 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=~/.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' diff --git a/.github/e2e/docker-compose.yml b/.github/e2e/docker-compose.yml new file mode 100644 index 0000000..ebfe7b7 --- /dev/null +++ b/.github/e2e/docker-compose.yml @@ -0,0 +1,25 @@ +services: + rust-peer: + image: ${RUST_PEER_IMAGE:-fluencelabs/fluence:minimal} + ports: + - 7771:7771 + - 9991:9991 + environment: + - FLUENCE_ENV_AQUA_IPFS_EXTERNAL_API_MULTIADDR=/dns4/ipfs/tcp/5001 + - FLUENCE_ENV_AQUA_IPFS_LOCAL_API_MULTIADDR=/dns4/ipfs/tcp/5001 + command: + - --aqua-pool-size=2 + - -t=7771 + - -w=9991 + - --local + # 12D3KooWBM3SdXWqGaawQDGQ6JprtwswEg3FWGvGhmgmMez1vRbR + - -k=hK62afickoeP2uZbmSkAYXxxqP8ozq16VRN7qfTP719EHC5V5tjrtW57BSjUr8GvsEXmJRbtejUWyPZ2rZMyQdq + volumes: + - ../../aqua-ipfs:/.fluence/v1/builtins/aqua-ipfs + + ipfs: + image: ipfs/kubo:latest + ports: + - 5001:5001 + volumes: + - ./ipfs.sh:/container-init.d/01-ipfs.sh diff --git a/.github/e2e/ipfs.sh b/.github/e2e/ipfs.sh new file mode 100644 index 0000000..a279fb7 --- /dev/null +++ b/.github/e2e/ipfs.sh @@ -0,0 +1,6 @@ +#! /usr/bin/env sh + +ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]' +ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "POST"]' +ipfs config --json Addresses.API '"/ip4/0.0.0.0/tcp/5001"' +ipfs bootstrap rm --all diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 0000000..544d7ad --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,42 @@ +name: Run tests + +on: + pull_request: + paths-ignore: + - "**.md" + + push: + branches: + - "master" + +concurrency: + group: "${{ github.workflow }}-${{ github.ref }}" + cancel-in-progress: true + +jobs: + aqua-ipfs: + uses: ./.github/workflows/tests.yml + + lints: + name: Lints + runs-on: ubuntu-latest + + steps: + - name: Checkout sources + uses: actions/checkout@v3 + + - name: Setup rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + + - name: Run cargo fmt + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all --manifest-path service/Cargo.toml -- --check + + - name: Run cargo clippy + uses: actions-rs/cargo@v1 + with: + command: clippy + args: -Z unstable-options --all --manifest-path service/Cargo.toml + continue-on-error: true # do not fail for now diff --git a/.github/workflows/rust_ci.yml b/.github/workflows/rust_ci.yml deleted file mode 100644 index 4e5081c..0000000 --- a/.github/workflows/rust_ci.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: Rust CI -on: - push: - workflow_dispatch: - -concurrency: - group: "${{ github.workflow }}-${{ github.ref }}" - cancel-in-progress: true - -jobs: - check: - name: cargo nextest - runs-on: builder - - steps: - - name: Checkout sources - uses: actions/checkout@v3 - - - name: Setup rust toolchain - uses: actions-rust-lang/setup-rust-toolchain@v1 - - - name: Install marine - uses: baptiste0928/cargo-install@v1.3.0 - with: - crate: marine - - - name: Build - working-directory: ./service - run: ./build.sh - - - name: Install cargo-nextest - uses: baptiste0928/cargo-install@v1.3.0 - with: - crate: cargo-nextest - version: 0.9.22 - - - run: cargo nextest run --release --all-features --no-fail-fast --retries 10 --test-threads 10 - working-directory: ./service - - lints: - name: Lints - runs-on: ubuntu-latest - - steps: - - name: Checkout sources - uses: actions/checkout@v3 - - - name: Setup rust toolchain - uses: actions-rust-lang/setup-rust-toolchain@v1 - - - name: Run cargo fmt - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all --manifest-path service/Cargo.toml -- --check - - - name: Run cargo clippy - uses: actions-rs/cargo@v1 - with: - command: clippy - args: -Z unstable-options --all --manifest-path service/Cargo.toml - continue-on-error: true # do not fail for now diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..c3371b6 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,72 @@ +name: Run tests with workflow_call + +on: + workflow_call: + inputs: + rust-peer-image: + description: "rust-peer image tag" + type: string + default: "fluencelabs/fluence:minimal" + +env: + RUST_PEER_IMAGE: "${{ inputs.rust-peer-image }}" + +jobs: + aqua-ipfs: + name: "Run tests" + runs-on: builder + + permissions: + contents: read + id-token: write + + steps: + - 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 + secrets: | + kv/docker-registry/basicauth/ci username | DOCKER_USERNAME ; + kv/docker-registry/basicauth/ci password | DOCKER_PASSWORD + + - name: Checkout aqua-ipfs + uses: actions/checkout@v3 + + - name: Setup Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + + - name: Install marine + uses: baptiste0928/cargo-install@v1.3.0 + with: + crate: marine + + - name: Build aqua-ipfs + working-directory: ./service + run: ./build.sh + + - name: Install cargo-nextest + uses: baptiste0928/cargo-install@v1.3.0 + with: + crate: cargo-nextest + version: 0.9.22 + + - name: Run cargo nextest + working-directory: ./service + env: + NEXTEST_RETRIES: 10 + NEXTEST_TEST_THREADS: 10 + run: cargo nextest run --release --all-features --no-fail-fast + + - name: Create distribution package + run: ./builtin-package/package.sh + + - name: Upload aqua-ipfs + uses: actions/upload-artifact@v3 + with: + name: aqua-ipfs + path: aqua-ipfs.tar.gz