ci: Update CI (#43)

* Update CI

* Cleanup

* Update docker-compose

* Better name for a job

* Use different image

* Do not start rust-peer for now
This commit is contained in:
Anatolios Laskaris 2022-11-17 09:42:55 +02:00 committed by GitHub
parent de81b49877
commit 5fbc6fc8fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 145 additions and 76 deletions

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=~/.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'

25
.github/e2e/docker-compose.yml vendored Normal file
View File

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

6
.github/e2e/ipfs.sh vendored Normal file
View File

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

42
.github/workflows/run-tests.yml vendored Normal file
View File

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

View File

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

72
.github/workflows/tests.yml vendored Normal file
View File

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