Skip to content

Commit

Permalink
Test CI
Browse files Browse the repository at this point in the history
  • Loading branch information
nahsi committed Oct 30, 2023
1 parent b91be82 commit 8d8eeaa
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 11 deletions.
99 changes: 93 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,113 @@ on:
description: "git ref to checkout to"
type: string
default: "main"
nox-image:
description: "nox image tag"
type: string
default: "null"
fcli-version:
description: "fcli version to use"
type: string
default: "unstable"
js-client-version:
description: "@fluencelabs/js-client version"
type: string
default: "null"
fluence-env:
description: "env to run tests against"
type: string
default: "local"

jobs:
tests:
name: "build"
name: "Run tests"
runs-on: ubuntu-latest

env:
FLUENCE_USER_DIR: "${{ github.workspace }}/tmp/.fluence"

permissions:
contents: read
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
repository: fluencelabs/frpc
ref: ${{ inputs.ref }}

- name: Import secrets
uses: hashicorp/vault-action@v2.5.0
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 ;
kv/npm-registry/basicauth/ci token | NODE_AUTH_TOKEN;
- name: Login to DockerHub
uses: docker/login-action@v2
with:
registry: docker.fluence.dev
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}

- name: Setup fcli
uses: fluencelabs/setup-fluence@v1
with:
version: unstable
artifact: fcli
version: ${{ inputs.fcli-version }}

- name: Init local env with fcli
run: fluence local init --no-input

- name: Replace nox image in docker-compose
if: inputs.nox-image != 'null'
working-directory: .fluence
run: |
sed -i'' -e '/nox-/!b;n;s|image: fluencelabs/nox:.*$|image: ${{ inputs.nox-image }}|' docker-compose.yaml
- name: Run local env
env:
FLUENCE_CHAIN_PRIVATE_KEY: ${{ secrets.FLUENCE_CHAIN_PRIVATE_KEY }}
RPC_PROVIDERS: ${{ secrets.RPC_PROVIDERS }}
run: fluence local up

- name: Setup node with self-hosted registry
uses: actions/setup-node@v3
with:
node-version: "18"
registry-url: "https://npm.fluence.dev"
cache: "npm"

- name: Run npm i
run: npm i

- name: Run npm i in gateway
working-directory: gateway
run: npm i

- name: Set js-client version
if: inputs.js-client-version != 'null'
uses: fluencelabs/github-actions/npm-set-dependency@main
with:
package: "@fluencelabs/js-client"
version: "${{ inputs.js-client-version }}"
working-directory: gateway

- name: Check if main.aqua compiles
run: fluence aqua --dry
- name: Run tests
env:
FLUENCE_ENV: ${{ inputs.fluence-env }}
run: npm run test

- name: Check if services builds
run: fluence build
- name: Cleanup
if: always()
run: |
fluence local down
rm -rf tmp ${{ env.FLUENCE_USER_DIR }}
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ src/js/src/aqua
aqua-compiled

# recommended by Fluence Labs:
/.fluence/project-secrets.yaml
/.fluence/schemas
/.fluence/tmp
.fluence/**

# to avoid accidental publish of RPC URLs
gateway/configs/quickstart_config.json
7 changes: 5 additions & 2 deletions fluence.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,19 @@

# Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/fluence.md

version: 2
version: 4

aquaInputPath: src/aqua/main.aqua

workers:
defaultWorker:
services: [ eth_rpc ]

deals:
defaultWorker:
minWorkers: 3
targetWorkers: 3
relays: stage

services:
eth_rpc:
get: wasm-modules

0 comments on commit 8d8eeaa

Please sign in to comment.