1
0
mirror of https://github.com/fluencelabs/aqua-playground synced 2025-03-17 00:30:56 +00:00
2022-10-10 21:02:53 +03:00

129 lines
3.9 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
aqua-version:
description: "@fluencejs/aqua version"
type: string
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
permissions:
contents: read
id-token: write
steps:
- name: Import secrets
uses: hashicorp/vault-action@v2.4.1
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: Setup docker-compose
uses: KengoTODA/actions-setup-docker-compose@v1.0.9
with:
version: 'v2.10.0'
- name: Pull rust-peer image
run: docker pull $RUST_PEER_IMAGE
- name: Run rust-peer
uses: isbang/compose-action@v1.1.0
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 from branch
if: inputs.fluence-js-version != ''
run: npm i --save -E @fluencelabs/fluence@${{ inputs.fluence-js-version }}
- name: Set aqua version from branch
if: inputs.aqua-version != ''
run: npm i --save -E @fluencelabs/aqua@${{ 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 build
- run: npm run test
- name: Report failure to slack
if: inputs.fluence-env != 'local' && failure()
uses: tokorom/action-slack-incoming-webhook@v1.1.4
with:
text: aqua-playground healthcheck failed
attachments: |
[
{
"color": "danger",
"author_name": "github[1h]",
"author_icon": "https://github.githubassets.com/images/modules/logos_page/Octocat.png",
"fields": [
{
"title": "Fluence environment",
"value": "${{ inputs.fluence-env }}"
},
{
"title": "GitHub Actions URL",
"value": "https://github.com/fluencelabs/aqua-playground/actions/runs/${{ github.run_id }}"
},
]
}
]
- name: Dump rust-peer logs on failure
if: failure() || cancelled()
uses: jwalton/gh-docker-logs@v1