[QA] Vizro AI dashboard tests improvements #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: e2e dashboard tests for VizroAI | |
defaults: | |
run: | |
working-directory: vizro-ai | |
on: | |
schedule: | |
- cron: "30 10 * * 1" # run every Monday at 10:30 UTC | |
workflow_dispatch: | |
#temporary for development | |
pull_request: | |
branches: | |
- main | |
env: | |
PYTHONUNBUFFERED: 1 | |
FORCE_COLOR: 1 | |
jobs: | |
test-e2e-dashboard-vizro-ai-fork: | |
if: ${{ github.event.pull_request.head.repo.fork }} | |
name: test-e2e-dashboard-vizro-ai on Py${{ matrix.config.python-version }} ${{ matrix.config.label }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- python-version: "3.12" | |
hatch-env: all.py3.12 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Passed fork step | |
run: echo "Success!" | |
test-e2e-dashboard-vizro-ai: | |
if: ${{ ! github.event.pull_request.head.repo.fork }} | |
name: test-e2e-dashboard-vizro-ai on Py${{ matrix.config.python-version }} ${{ matrix.config.label }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- python-version: "3.12" | |
hatch-env: all.py3.12 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.config.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.config.python-version }} | |
- name: Install Hatch | |
run: pip install hatch | |
- name: Show dependency tree | |
run: hatch run ${{ matrix.config.hatch-env }}:pip tree | |
- name: Run vizro-ai e2e dashboard tests with PyPI vizro | |
run: hatch run ${{ matrix.config.hatch-env }}:test-e2e-dashboard | |
env: | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
OPENAI_API_BASE: ${{ secrets.OPENAI_API_BASE }} | |
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
ANTHROPIC_BASE_URL: ${{ secrets.ANTHROPIC_BASE_URL }} | |
VIZRO_TYPE: pypi | |
BRANCH: ${{ github.head_ref }} | |
PYTHON_VERSION: ${{ matrix.config.python-version }} | |
- name: Run vizro-ai e2e dashboard tests with local vizro | |
run: | | |
hatch run ${{ matrix.config.hatch-env }}:pip install ../vizro-core | |
hatch run ${{ matrix.config.hatch-env }}:test-e2e-dashboard | |
env: | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
OPENAI_API_BASE: ${{ secrets.OPENAI_API_BASE }} | |
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
ANTHROPIC_BASE_URL: ${{ secrets.ANTHROPIC_BASE_URL }} | |
VIZRO_TYPE: local | |
BRANCH: ${{ github.head_ref }} | |
PYTHON_VERSION: ${{ matrix.config.python-version }} | |
- name: Send custom JSON data to Slack | |
id: slack | |
uses: slackapi/[email protected] | |
if: failure() | |
with: | |
payload: | | |
{ | |
"text": "Vizro-ai ${{ matrix.config.hatch-env }} e2e dashboard tests build result: ${{ job.status }}\nBranch: ${{ github.head_ref }}\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | |
- name: Report artifacts | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: Report-${{ matrix.config.python-version }}-${{ matrix.config.label }} | |
path: | | |
/home/runner/work/vizro/vizro/vizro-ai/tests/e2e/reports/report*.csv | |
test-e2e-dashboard-vizro-ai-report: | |
needs: test-e2e-dashboard-vizro-ai | |
runs-on: ubuntu-latest | |
if: always() | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download All Artifacts | |
uses: actions/download-artifact@v4 | |
- name: Set current date as env variable | |
id: date | |
run: | | |
echo "::set-output name=date::$(date +'%Y-%m-%dT%H-%M-%S')" | |
echo "TIME_NOW=$(date +'%Y-%m-%dT%H-%M-%S')" >> $GITHUB_ENV | |
- name: Create one csv report | |
run: | | |
cd /home/runner/work/vizro/vizro/ | |
ls */*.csv | head -n1 | xargs head -n1 > report-aggregated-${{ steps.date.outputs.date }}.csv && tail -n+2 -q */*.csv >> report-aggregated-${{ steps.date.outputs.date }}.csv | |
# replace all timestamps in aggregated report to current date | |
gawk -F, -i inplace 'FNR>1 {$1="${{ steps.date.outputs.date }}"} {print}' OFS=, report-aggregated-${{ steps.date.outputs.date }}.csv | |
- name: Report artifacts | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: Report-aggregated-${{ steps.date.outputs.date }} | |
path: | | |
/home/runner/work/vizro/vizro/report-aggregated-${{ steps.date.outputs.date }}.csv | |
- name: Upload reports to artifactory | |
run: | | |
cd /home/runner/work/vizro/vizro/ | |
curl -fL https://getcli.jfrog.io | sh | |
./jfrog config add vizro --artifactory-url ${{ secrets.ARTIFACTORY_URL}} --user ${{ secrets.ARTIFACTORY_USER}} --apikey ${{ secrets.ARTIFACTORY_PASS}} --interactive=false | |
./jfrog rt u --flat=false "report-aggregated-${{ steps.date.outputs.date }}.csv" vizx-generic-local/vizro-ai-reports/ |