Skip to content

feat(grafana): MySQL 7362 and PostgreSQL 9628/14114 curated packs #690

feat(grafana): MySQL 7362 and PostgreSQL 9628/14114 curated packs

feat(grafana): MySQL 7362 and PostgreSQL 9628/14114 curated packs #690

Workflow file for this run

# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one or more contributor license agreements.
# SPDX-License-Identifier: Elastic-2.0
name: Quality
on:
push:
branches: [main]
pull_request:
branches: [main]
types: [opened, synchronize, reopened, ready_for_review]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
ruff:
name: Ruff
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up uv
uses: astral-sh/setup-uv@v5
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Sync locked Python dependency environment
run: |
UV_PROJECT_ENVIRONMENT=.venv-ruff \
uv sync --locked --python 3.11 --all-extras
- name: Check source license headers
run: .venv-ruff/bin/python scripts/check_source_headers.py
- name: Run ruff
run: .venv-ruff/bin/python -m ruff check .
mypy:
name: Mypy (targeted)
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up uv
uses: astral-sh/setup-uv@v5
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Sync locked Python dependency environment
run: |
UV_PROJECT_ENVIRONMENT=.venv-mypy \
uv sync --locked --python 3.11 --all-extras
- name: Run targeted mypy
run: .venv-mypy/bin/python -m mypy
cli-smoke:
name: CLI smoke
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up uv
uses: astral-sh/setup-uv@v5
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Sync locked Python dependency environment
run: |
UV_PROJECT_ENVIRONMENT=.venv-cli \
uv sync --locked --python 3.11 --all-extras
- name: Run CLI smoke commands
run: |
.venv-cli/bin/obs-migrate --help >/dev/null
.venv-cli/bin/obs-migrate migrate --help >/dev/null
pytest:
name: Pytest (${{ matrix.python-version }})
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13"]
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up uv
uses: astral-sh/setup-uv@v5
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: "${{ matrix.python-version }}"
- name: Sync locked Python dependency environment
run: |
UV_PROJECT_ENVIRONMENT=.venv-tests \
uv sync --locked --python "${{ matrix.python-version }}" --all-extras
- name: Run pytest (3.12, 3.13)
if: matrix.python-version != '3.11'
run: .venv-tests/bin/python -m pytest tests/ --ignore=tests/e2e/ -x -q
- name: Run pytest with coverage (3.11)
if: matrix.python-version == '3.11'
run: |
.venv-tests/bin/python -m pytest tests/ --ignore=tests/e2e/ -x -q \
--cov=observability_migration \
--cov-report=xml \
--cov-report=term-missing \
--cov-fail-under=75
- name: Upload coverage report
if: matrix.python-version == '3.11' && (success() || failure())
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage.xml
if-no-files-found: error
retention-days: 30
pytest-e2e:
name: E2E pytest suite
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up uv
uses: astral-sh/setup-uv@v5
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Sync locked Python dependency environment
run: |
UV_PROJECT_ENVIRONMENT=.venv-e2e \
uv sync --locked --python 3.11 --all-extras
- name: Run e2e pytest suite
run: .venv-e2e/bin/python -m pytest tests/e2e/ -x -q
build-and-smoke:
name: Build and packaging smoke
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up uv
uses: astral-sh/setup-uv@v5
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Build wheel and sdist
run: uv build
- name: Install wheel in isolated environment and smoke test
run: |
uv venv .venv-wheel --python 3.11
uv pip install --python .venv-wheel dist/*.whl
# Neutral cwd avoids repo-root shadowing of site-packages.
cd /tmp
"${{ github.workspace }}/.venv-wheel/bin/python" -c "
import observability_migration as m
assert 'site-packages' in m.__file__, m.__file__
print(m.__version__, m.__file__)
"
"${{ github.workspace }}/.venv-wheel/bin/obs-migrate" --help >/dev/null
"${{ github.workspace }}/.venv-wheel/bin/obs-migrate" migrate --help >/dev/null
"${{ github.workspace }}/.venv-wheel/bin/obs-migrate" doctor
- name: Upload dist artifacts
uses: actions/upload-artifact@v4
with:
name: dist-packages
path: dist/
if-no-files-found: error
retention-days: 30
package-smoke:
name: Clean-install package smoke (${{ matrix.python-version }})
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
python-version: ["3.12", "3.11"]
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: "${{ matrix.python-version }}"
- name: Set up uv
uses: astral-sh/setup-uv@v5
- name: Build wheel
run: |
python -m pip install --upgrade build
python -m build --wheel --outdir dist
- name: Install wheel into a clean venv
run: |
python -m venv /tmp/cleanenv
if [ "${{ matrix.python-version }}" = "3.12" ]; then
/tmp/cleanenv/bin/pip install "$(ls dist/*.whl)[all]"
else
# 3.11: exercise the source extras without [kibana] (its kb-dashboard
# pins are 3.12+, and no command needs them any more).
/tmp/cleanenv/bin/pip install "$(ls dist/*.whl)[grafana,datadog]"
fi
# Prove the venv resolves the installed wheel, not the checkout tree
# (running from the repo root would shadow site-packages via cwd).
cd /tmp
/tmp/cleanenv/bin/python -c "
import observability_migration as m
assert 'site-packages' in m.__file__, m.__file__
print('installed', m.__version__, m.__file__)
"
/tmp/cleanenv/bin/obs-migrate doctor
- name: Grafana end-to-end (offline) produces native + IR artifacts
working-directory: /tmp
run: |
mkdir -p /tmp/gin && cp "${{ github.workspace }}/infra/grafana/dashboards/home.json" /tmp/gin/
/tmp/cleanenv/bin/grafana-migrate --source files --input-dir /tmp/gin \
--output-dir /tmp/gout --assets dashboards
# A migration writes only native/ (the upload payload) + ir/ (review).
test -f "$(find /tmp/gout -path '*/native/*.native.json' | head -1)"
test -f "$(find /tmp/gout -path '*/native/index.json' | head -1)"
test -f "$(find /tmp/gout -path '*/ir/*.ir.json' | head -1)"
- name: Datadog end-to-end (offline) produces native + IR artifacts
working-directory: /tmp
run: |
mkdir -p /tmp/ddin && cp "${{ github.workspace }}/infra/datadog/dashboards/sample_dashboard.json" /tmp/ddin/
/tmp/cleanenv/bin/datadog-migrate --input-dir /tmp/ddin \
--output-dir /tmp/ddout
test -f "$(find /tmp/ddout -path '*/native/*.native.json' | head -1)"
test -f "$(find /tmp/ddout -path '*/native/index.json' | head -1)"
test -f "$(find /tmp/ddout -path '*/ir/*.ir.json' | head -1)"