mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-08-19 09:30:21 +00:00
100 lines
3.0 KiB
YAML
100 lines
3.0 KiB
YAML
name: 'MCP: Tests'
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- 'master'
|
|
- 'v5.*'
|
|
pull_request:
|
|
branches:
|
|
- 'master'
|
|
- 'v5.*'
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
MCP_WORKING_DIR: ./mcp_server
|
|
|
|
permissions: {}
|
|
|
|
jobs:
|
|
mcp-tests:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
permissions:
|
|
contents: read
|
|
strategy:
|
|
matrix:
|
|
# requires-python is >=3.12 while the shipped image is 3.13; testing both
|
|
# is what keeps that floor honest.
|
|
python-version:
|
|
- '3.12'
|
|
- '3.13'
|
|
defaults:
|
|
run:
|
|
working-directory: ./mcp_server
|
|
|
|
steps:
|
|
- name: Harden Runner
|
|
uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
|
|
with:
|
|
egress-policy: block
|
|
# hub.prowler.com and raw.githubusercontent.com are deliberately absent:
|
|
# the suite mocks every outbound call, so a real one must fail the job.
|
|
# The sentry.io entry is not the test suite: the Codecov uploader sends
|
|
# its own telemetry there, so api-tests.yml and sdk-tests.yml allow it too.
|
|
allowed-endpoints: >
|
|
github.com:443
|
|
pypi.org:443
|
|
files.pythonhosted.org:443
|
|
cli.codecov.io:443
|
|
keybase.io:443
|
|
ingest.codecov.io:443
|
|
o26192.ingest.us.sentry.io:443
|
|
storage.googleapis.com:443
|
|
api.github.com:443
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
# zizmor: ignore[artipacked]
|
|
persist-credentials: true # Required by tj-actions/changed-files to fetch PR branch
|
|
|
|
- name: Check for MCP server changes
|
|
id: check-changes
|
|
uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6
|
|
with:
|
|
files: |
|
|
mcp_server/**
|
|
.github/workflows/mcp-tests.yml
|
|
codecov.yml
|
|
files_ignore: |
|
|
mcp_server/README.md
|
|
mcp_server/CHANGELOG.md
|
|
mcp_server/changelog.d/**
|
|
mcp_server/AGENTS.md
|
|
mcp_server/Dockerfile
|
|
mcp_server/.dockerignore
|
|
mcp_server/entrypoint.sh
|
|
|
|
- name: Setup Python with uv
|
|
if: steps.check-changes.outputs.any_changed == 'true'
|
|
uses: ./.github/actions/setup-python-uv
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
working-directory: ./mcp_server
|
|
|
|
- name: Run tests with pytest
|
|
if: steps.check-changes.outputs.any_changed == 'true'
|
|
run: uv run pytest --cov=./prowler_mcp_server --cov-report=xml tests
|
|
|
|
- name: Upload coverage reports to Codecov
|
|
if: steps.check-changes.outputs.any_changed == 'true'
|
|
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
|
|
env:
|
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
with:
|
|
flags: mcp
|