diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f2d9a2a..c22370d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,12 +7,35 @@ 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 @@ -20,13 +43,77 @@ jobs: 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 }} diff --git a/.gitignore b/.gitignore index 2c76f1d..7529cc8 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/fluence.yaml b/fluence.yaml index 724af0f..3b06853 100644 --- a/fluence.yaml +++ b/fluence.yaml @@ -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