Skip to content

NuvlaEdge Local Integration Testing #282

NuvlaEdge Local Integration Testing

NuvlaEdge Local Integration Testing #282

name: "NuvlaEdge Local Integration Testing"
on:
workflow_run:
workflows: ["NuvlaEdge Installer Build"]
branches: [main]
types:
- completed
workflow_dispatch:
env:
NUVLA_DEV_APIKEY: ${{ secrets.NUVLA_DEV_APIKEY }}
NUVLA_DEV_APISECRET: ${{ secrets.NUVLA_DEV_APISECRET }}
SNYK_SIXSQCI_API_TOKEN: ${{ secrets.SNYK_SIXSQCI_API_TOKEN }}
defaults:
run:
shell: bash
working-directory: tests/integration_tests
jobs:
tester:
name: "Run NuvlaEdge Integration Tests"
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version: [3.8]
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Setup local environment
run: |
python --version
pip --version
sudo npm install -g snyk
snyk version
sudo apt-get install -y python3-pytest
pip install -r requirements.txt
pip install pytest-timeout
docker swarm init
- name: Test vulnerabilities
if: ${{ success() }}
id: ImageScan
run: |
python -m pytest -vv -x --html=nuvlaedge.vulnerabilities-scan.output.html --self-contained-html vulnerability-scan.py
- name: Create Test NuvlaEdge in Nuvla.io
if: ${{ success() }}
id: NewNuvlaEdge
uses: nuvla/nuvla-create-nuvlabox-action@v2
with:
api-key: ${{ secrets.NUVLA_DEV_APIKEY }}
api-secret: ${{ secrets.NUVLA_DEV_APISECRET }}
name: "(local) Test NuvlaEdge"
description: NuvlaEdge for integration testing - commit ${{ github.sha }}, on branch ${{ github.ref }}, by ${{ github.actor }}
- name: Run integration tests locally
if: ${{ success() }}
env:
NUVLAEDGE_ID: ${{ steps.NewNuvlaEdge.outputs.NUVLABOX_UUID }}
run: |
python -m pytest --timeout=300 -vv -x --html=nuvlaedge.test-local.output.html --self-contained-html test-local.py
- if: always()
name: Keep test results
uses: actions/upload-artifact@v4
with:
name: integration-tests-report
path: tests/integration_tests/nuvlaedge.*.output.html
- if: always()
name: Cleanup Nuvla resources
env:
NUVLAEDGE_IDS: ${{ steps.NewNuvlaEdge.outputs.NUVLABOX_UUID }}
run: cd .. && python cleanup.py
notify:
if: always()
name: Post Workflow Status To Slack
needs: tester
runs-on: ubuntu-latest
steps:
- name: Slack Workflow Notification
uses: Gamesight/slack-workflow-status@master
with:
# Required Input
repo_token: ${{ secrets.GITHUB_TOKEN }}
slack_webhook_url: ${{ secrets.SLACK_NBE_CICD_WEBHOOK }}
include_jobs: true