Skip to content

publish_event api accessible from anywhere in the framework #623

publish_event api accessible from anywhere in the framework

publish_event api accessible from anywhere in the framework #623

Workflow file for this run

name: PR Tests
on:
pull_request:
branches:
- main
permissions:
contents: read
pull-requests: read
env:
PYTHON_VERSION: "3.10"
jobs:
ruff-lint:
name: Check Code Formatting and Linting with Ruff
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "${{ env.PYTHON_VERSION }}" # Specify the Python version you are using
- name: Install Ruff
run: pip install ruff
- name: Run Ruff Lint Check
run: ruff check . --no-fix
- name: Run Ruff Format Check
run: ruff format --check .
check-licenses:
name: Check Licenses
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "${{ env.PYTHON_VERSION }}"
- name: Ensure assets directory exists
run: |
mkdir -p packages/railtracks
- name: Use root README for PyPI (railtracks)
run: |
cp README.md packages/railtracks/README.md
echo "Copied root README.md into packages/railtracks/"
- name: Run License Check
run: |
chmod +x scripts/check_licenses.sh
./scripts/check_licenses.sh
- name: License Check Analysis
if: always()
run: |
if [ -f core-licenses-summary.md ]; then
cat core-licenses-summary.md >> $GITHUB_STEP_SUMMARY
echo "### 📦 Licenses Found" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
cat core-licenses.md >> $GITHUB_STEP_SUMMARY
fi
changes:
name: Detect Changed Areas
runs-on: ubuntu-latest
outputs:
core: ${{ steps.filter.outputs.core }}
retrieval: ${{ steps.filter.outputs.retrieval }}
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Filter changed paths
uses: dorny/paths-filter@v3
id: filter
with:
filters: |
core:
- 'packages/railtracks/src/railtracks/**'
- '!packages/railtracks/src/railtracks/retrieval/**'
- 'packages/railtracks/tests/unit_tests/**'
- '!packages/railtracks/tests/unit_tests/retrieval/**'
- 'packages/railtracks/tests/integration_tests/**'
- 'packages/railtracks/pyproject.toml'
- '.github/workflows/pr_tests.yaml'
- '.github/actions/install-deps/**'
retrieval:
- 'packages/railtracks/src/railtracks/retrieval/**'
- 'packages/railtracks/tests/unit_tests/retrieval/**'
- 'packages/railtracks/pyproject.toml'
- '.github/workflows/pr_tests.yaml'
- '.github/actions/install-deps/**'
unit_tests:
name: Unit Tests
runs-on: ubuntu-latest
needs:
- ruff-lint
- check-licenses
- changes
if: needs.changes.outputs.core == 'true'
steps:
- name: Print System Architecture
run: uname -m
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "${{ env.PYTHON_VERSION }}"
- name: Install dependencies
uses: ./.github/actions/install-deps
with:
python-version: "${{ env.PYTHON_VERSION }}"
extras: "all"
- name: Check pyproject.toml dependency order
run: |
python scripts/check_dependencies_sorted.py
- name: Run tests
shell: bash
run: |
pytest -s -v --junit-xml=unit-test-results.xml \
--ignore=packages/railtracks/tests/unit_tests/retrieval \
packages/railtracks/tests/unit_tests/ packages/railtracks/tests/integration_tests/
retrieval_tests:
name: Retrieval Tests
runs-on: ubuntu-latest
needs:
- ruff-lint
- check-licenses
- changes
if: needs.changes.outputs.retrieval == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "${{ env.PYTHON_VERSION }}"
- name: Install Tesseract OCR binary
run: |
sudo apt-get update
sudo apt-get install -y tesseract-ocr
- name: Install dependencies
uses: ./.github/actions/install-deps
with:
python-version: "${{ env.PYTHON_VERSION }}"
extras: "all,retrieval"
- name: Run retrieval tests
shell: bash
run: |
pytest -s -v --junit-xml=retrieval-test-results.xml \
packages/railtracks/tests/unit_tests/retrieval/
documentation_validation:
name: Documentation Validation
runs-on: ubuntu-latest
needs:
- ruff-lint
- check-licenses
steps:
- name: Print System Architecture
run: uname -m
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "${{ env.PYTHON_VERSION }}"
- name: Install dependencies
uses: ./.github/actions/install-deps
with:
python-version: "${{ env.PYTHON_VERSION }}"
extras: "all,retrieval"
- name: Validate documentation
run: |
./scripts/docs_validation.sh
pyproject_dependency_order:
name: Validate pyproject.toml Dependency Order
runs-on: ubuntu-latest
needs:
- ruff-lint
- check-licenses
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "${{ env.PYTHON_VERSION }}"
- name: Install dependencies
uses: ./.github/actions/install-deps
with:
python-version: "${{ env.PYTHON_VERSION }}"
- name: Check pyproject.toml dependency order
run: |
python scripts/check_dependencies_sorted.py