Anatolios Laskaris be6ca2e4b4
chore: Fail if fluence-cli artifact is no found (#338)
Fail if fluence-cli artifact is no found
2024-01-25 16:28:27 +00:00

180 lines
4.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"
fcli-version:
description: "@fluencelabs/cli version"
type: string
default: "main"
if-no-artifacts-found:
description: "What to do when no artifacts found in setup-* actions"
type: string
default: "error"
cargo-dependencies:
description: "Cargo dependencies map"
type: string
ref:
description: "git ref to checkout to"
type: string
default: "main"
env:
CI: true
FORCE_COLOR: true
NOX_IMAGE: "${{ inputs.nox-image }}"
FLUENCE_ENV: "${{ inputs.fluence-env }}"
jobs:
aqua:
name: "Run aqua tests"
runs-on: builder
timeout-minutes: 60
permissions:
contents: read
id-token: write
steps:
- name: Import secrets
uses: hashicorp/vault-action@v2.7.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;
- name: Checkout registry
uses: actions/checkout@v4
with:
repository: fluencelabs/registry
ref: ${{ inputs.ref }}
- 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: "**/package-lock.json"
- name: Run npm install in aqua
run: npm install
working-directory: aqua
- name: Run npm install in aqua-tests
run: npm install
working-directory: aqua-tests
- name: Setup fcli
uses: fluencelabs/setup-fluence@v1
with:
artifact: fcli
version: ${{ inputs.fcli-version }}
if-no-artifact-found: ${{ inputs.if-no-artifacts-found }}
- name: Setup Rust toolchain
uses: dsherret/rust-toolchain-file@v1
- name: Setup marine
uses: fluencelabs/setup-marine@v1
with:
artifact-name: marine
- name: Set dependencies
if: inputs.cargo-dependencies != ''
uses: fluencelabs/github-actions/cargo-set-dependency@main
with:
dependencies: ${{ inputs.cargo-dependencies }}
path: service/
- name: Build service
env:
FLUENCE_USER_DIR: "${{ github.workspace }}/tmp/.fluence"
run: ./build.sh
working-directory: service
- name: Build distro
env:
FLUENCE_USER_DIR: "${{ github.workspace }}/tmp/.fluence"
run: ./build.sh
- name: Login to DockerHub
uses: docker/login-action@v3
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 fcli dependencies
env:
FLUENCE_USER_DIR: "${{ github.workspace }}/tmp/.fluence"
run: fluence dep i --no-input
working-directory: aqua-tests
- name: Print fcli version
run: pytest -s test_fluence_cli_version.py
working-directory: aqua-tests
- name: Run aqua tests
env:
FLUENCE_USER_DIR: "${{ github.workspace }}/tmp/.fluence"
NPM_CONFIG_REGISTRY: "https://npm.fluence.dev"
run: pytest 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
\`\`\`
$(fluence dep v)
\`\`\`
SNAPSHOT
- name: Dump container logs
if: always()
uses: jwalton/gh-docker-logs@v2
- name: Cleanup
if: always()
run: |
rm -rf tmp ~/.fluence
sudo rm -rf registry