2024-02-21 18:06:38 +00:00

150 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"
nox-image:
description: "nox image tag"
type: string
default: "fluencelabs/nox:unstable_minimal"
ref:
description: "GitHub ref to checkout to"
type: string
default: "main"
flox-version:
description: "@fluencelabs/flox version"
type: string
default: "null"
env:
CI: true
FORCE_COLOR: true
NOX_IMAGE: "${{ inputs.nox-image }}"
FLUENCE_ENV: "${{ inputs.fluence-env }}"
jobs:
aqua-ipfs:
name: "Run tests"
runs-on: builder
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
- name: Checkout aqua-ipfs
uses: actions/checkout@v3
with:
repository: fluencelabs/aqua-ipfs
ref: ${{ inputs.ref }}
- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Setup marine
uses: fluencelabs/setup-marine@v1
with:
artifact-name: marine
- name: Build aqua-ipfs
working-directory: ./service
run: ./build.sh
- name: Setup node with self-hosted registry
uses: actions/setup-node@v3
with:
node-version: "18"
registry-url: "https://npm.fluence.dev"
cache: "npm"
cache-dependency-path: "aqua-tests/package-lock.json"
- run: npm install
working-directory: aqua-tests
- name: Set flox version
if: inputs.flox-version != 'null'
uses: fluencelabs/github-actions/npm-set-dependency@main
with:
package: "@fluencelabs/cli"
version: ${{ inputs.flox-version }}
working-directory: aqua-tests
flags: "--save-dev"
- name: Login to DockerHub
uses: docker/login-action@v2
with:
registry: docker.fluence.dev
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}
- 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 python
uses: actions/setup-python@v4
with:
python-version: "3.9"
cache: "pip"
cache-dependency-path: aqua-tests/requirements.txt
- name: Install python requirements
run: pip install -r requirements.txt
working-directory: aqua-tests
- name: Install fluence deps
env:
FLUENCE_USER_DIR: "${{ github.workspace }}/tmp/.fluence"
run: npx fluence dep install
working-directory: aqua-tests
- name: Install ipfs
uses: nahsi/setup-ipfs@v1
- name: Run aqua tests
env:
FLUENCE_USER_DIR: "${{ github.workspace }}/tmp/.fluence"
run: pytest -n auto test_aqua.py
working-directory: aqua-tests
- name: Print versions to check summary
if: always()
working-directory: aqua-tests
run: |
cat <<SNAPSHOT >> $GITHUB_STEP_SUMMARY
## Used versions
\`\`\`
$(npx fluence dep v)
\`\`\`
SNAPSHOT
- name: Dump nox logs
if: always()
uses: jwalton/gh-docker-logs@v2
- name: Remove tmp directory
if: always()
run: sudo rm -rf tmp