fluence-js/.github/workflows/tests.yml
2024-02-23 17:09:25 +07:00

114 lines
2.8 KiB
YAML

name: Run tests with worflow_call
on:
workflow_call:
inputs:
nox-image:
description: "nox image tag"
type: string
default: "fluencelabs/nox:0.4.2"
avm-version:
description: "@fluencelabs/avm version"
type: string
default: "null"
marine-js-version:
description: "@fluencelabs/marine-js version"
type: string
default: "null"
ref:
description: "git ref to checkout to"
type: string
default: "main"
env:
NOX_IMAGE: "${{ inputs.nox-image }}"
FORCE_COLOR: true
CI: true
jobs:
js-client:
name: "Run tests"
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
env:
LATEST_NODE_VERSION: 20.x
strategy:
matrix:
node-version:
- 18.x
- 20.x
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: Login to DockerHub
uses: docker/login-action@v2
with:
registry: docker.fluence.dev
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}
- name: Checkout
uses: actions/checkout@v3
with:
repository: fluencelabs/fluence-js
ref: ${{ inputs.ref }}
- name: Pull nox image
run: docker pull $NOX_IMAGE
- name: Run nox network
uses: isbang/compose-action@v1.4.1
with:
compose-file: ".github/e2e/docker-compose.yml"
down-flags: "--volumes"
- name: Setup pnpm
uses: pnpm/action-setup@v2.2.4
with:
version: 8
- name: Setup node ${{ matrix.node-version }} with self-hosted registry
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: "https://npm.fluence.dev"
cache: "pnpm"
- name: Override dependencies
uses: fluencelabs/github-actions/pnpm-set-dependency@main
with:
dependencies: |
{
"@fluencelabs/avm": "${{ inputs.avm-version }}",
"@fluencelabs/marine-js": "${{ inputs.marine-js-version }}"
}
- run: pnpm -r --no-frozen-lockfile i
- run: pnpm -r build
- name: Lint code
run: pnpm lint-check
- run: pnpm -r test
- name: Dump container logs
if: always()
uses: jwalton/gh-docker-logs@v2