128 lines
4.1 KiB
YAML

name: Run tests with workflow_call
on:
workflow_call:
inputs:
fluence-env:
description: "Fluence enviroment to run tests agains"
type: string
default: "local"
rust-peer-image:
description: "rust-peer image tag"
type: string
default: "fluencelabs/fluence:minimal"
fluence-js-version:
description: "@fluencejs/fluence version"
type: string
default: "null"
aqua-version:
description: "@fluencejs/aqua version"
type: string
default: "null"
env:
FORCE_COLOR: true
RUST_PEER_IMAGE: "${{ inputs.rust-peer-image }}"
FLUENCE_ENV: "${{ inputs.fluence-env }}"
jobs:
aqua-playground:
name: "Run tests"
runs-on: ubuntu-latest
timeout-minutes: 60
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 ;
kv/npm-registry/basicauth/ci token | NODE_AUTH_TOKEN;
kv/slack/node-alerts webhook | INCOMING_WEBHOOK_URL
- 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/aqua-playground
- name: Pull rust-peer image
run: docker pull $RUST_PEER_IMAGE
- name: Run rust-peer
uses: isbang/compose-action@v1.4.1
with:
compose-file: ".github/e2e/docker-compose.yml"
down-flags: "--volumes"
- name: Setup node with self-hosted registry
uses: actions/setup-node@v3
with:
node-version: "16"
registry-url: "https://npm.fluence.dev"
cache: "npm"
- run: npm install
- name: Set fluence-js version
if: inputs.fluence-js-version != 'null'
uses: fluencelabs/github-actions/npm-set-dependency@main
with:
package: "@fluencelabs/fluence"
version: ${{ inputs.fluence-js-version }}
- name: Set aqua version
if: inputs.aqua-version != 'null'
uses: fluencelabs/github-actions/npm-set-dependency@main
with:
package: "@fluencelabs/aqua"
version: ${{ inputs.aqua-version }}
- name: Remove compiled examples
if: inputs.aqua-version != ''
run: rm -rf aqua-playground/src/compiled/examples/*
- run: npm run compile-aqua -- -c "UNIQUE_CONST = 1" -c "ANOTHER_CONST = \"ab\""
- run: npm run test
- name: Setup dasel
if: always()
uses: allejo/setup-dasel@v1
with:
version: 1.27.3
- name: Print versions to check summary
if: always()
run: |
cat <<SNAPSHOT >> $GITHUB_STEP_SUMMARY
## Used versions
| name | version |
| ---------- | -------------------------------------------------------------------- |
| rust-peer | $(docker run --rm --entrypoint=fluence ${RUST_PEER_IMAGE} --version) |
| avm | $(dasel -f package-lock.json -p json -m --plain 'packages.(?:-=node_modules/@fluencelabs/avm).version') |
| marine-js | $(dasel -f package-lock.json -p json -m --plain 'packages.(?:-=node_modules/@fluencelabs/marine-js).version') |
| aqua | $(npx aqua --version) |
| fluence-js | $(dasel -f package-lock.json -p json -m --plain 'packages.(?:-=node_modules/@fluencelabs/fluence).version') |
SNAPSHOT
- name: Dump rust-peer logs
if: always()
uses: jwalton/gh-docker-logs@v2