Skip to content

Pr 1355 main merge #620

Pr 1355 main merge

Pr 1355 main merge #620

Workflow file for this run

name: Develop Branch Action
on:
pull_request_target:
types:
- opened
- synchronize
- reopened
branches:
- dev
paths:
- 'unoplat-code-confluence-commons/**'
- 'unoplat-code-confluence-ingestion/**'
- 'unoplat-code-confluence-query-engine/**'
concurrency:
group: develop-branch-action-${{ github.event.pull_request.head.repo.full_name || github.repository }}-${{ github.event.pull_request.head.ref || github.ref }}
cancel-in-progress: true
jobs:
detect-changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
commons: ${{ steps.filter.outputs.commons }}
flow-bridge: ${{ steps.filter.outputs.flow-bridge }}
query-engine: ${{ steps.filter.outputs.query-engine }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 100
- name: Detect changed files
uses: dorny/paths-filter@v3
id: filter
with:
filters: |
commons:
- 'unoplat-code-confluence-commons/**'
flow-bridge:
- 'unoplat-code-confluence-ingestion/code-confluence-flow-bridge/**'
query-engine:
- 'unoplat-code-confluence-query-engine/**'
refresh-release-pr-lockfiles:
needs: detect-changes
if: ${{ (needs.detect-changes.outputs.flow-bridge == 'true' || needs.detect-changes.outputs.query-engine == 'true') && github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout PR branch
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ secrets.PAT }}
persist-credentials: true
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Refresh flow-bridge lockfile
if: needs.detect-changes.outputs.flow-bridge == 'true'
working-directory: unoplat-code-confluence-ingestion/code-confluence-flow-bridge
env:
GITHUB_PAT_TOKEN: ${{ secrets.PAT }}
run: uv lock
- name: Refresh query-engine lockfile
if: needs.detect-changes.outputs.query-engine == 'true'
working-directory: unoplat-code-confluence-query-engine
env:
GITHUB_PAT_TOKEN: ${{ secrets.PAT }}
run: uv lock
- name: Commit refreshed lockfiles
shell: bash
run: |
git add -- \
unoplat-code-confluence-ingestion/code-confluence-flow-bridge/uv.lock \
unoplat-code-confluence-query-engine/uv.lock
if git diff --cached --quiet; then
echo "No lockfile changes to commit."
exit 0
fi
git -c user.name="github-actions[bot]" -c user.email="41898282+github-actions[bot]@users.noreply.github.com" \
commit -m "fix(ci): refresh package uv lockfiles before python lock checks run"
git push origin "HEAD:${{ github.event.pull_request.head.ref }}"
build-commons:
needs: detect-changes
if: ${{ needs.detect-changes.outputs.commons == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.sha }}
- name: Install python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Install dependencies
working-directory: unoplat-code-confluence-commons
run: uv sync
- name: Build package
working-directory: unoplat-code-confluence-commons
run: uv build
test-flow-bridge:
needs:
- detect-changes
- refresh-release-pr-lockfiles
if: ${{ (needs.detect-changes.outputs.flow-bridge == 'true' || needs.detect-changes.outputs.commons == 'true') && (needs.refresh-release-pr-lockfiles.result == 'success' || needs.refresh-release-pr-lockfiles.result == 'skipped') }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install uv
uses: astral-sh/setup-uv@v5
# 1) Always ensure the Compose v2 plugin is present
- name: Set up Docker Compose (v2)
uses: docker/setup-compose-action@v1
# pin a version if you need repeatability:
# with:
# version: '2.37.0'
# 2) Drop in a shim so legacy tools that expect `docker-compose`
# still work (but use v2 under the hood)
- name: Provide docker-compose wrapper for compatibility
shell: bash
run: |
if ! command -v docker-compose >/dev/null; then
echo 'Creating docker-compose wrapper ➜ docker compose "$@"'
sudo install -d /usr/local/bin
printf '#!/usr/bin/env bash\nexec docker compose "$@"\n' | \
sudo tee /usr/local/bin/docker-compose >/dev/null
sudo chmod +x /usr/local/bin/docker-compose
fi
docker compose version
docker-compose version # should output the same version
- name: Install Ruff
run: curl -LsSf https://astral.sh/ruff/install.sh | sh
- name: Install ripgrep
run: |
sudo apt-get update
sudo apt-get install -y ripgrep
- name: Get package name for coverage
working-directory: unoplat-code-confluence-ingestion/code-confluence-flow-bridge
id: package
run: |
# Extract project name from pyproject.toml and convert hyphens to underscores
PACKAGE_NAME=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['name'].replace('-', '_'))")
echo "name=$PACKAGE_NAME" >> $GITHUB_OUTPUT
- name: Check lockfile freshness
working-directory: unoplat-code-confluence-ingestion/code-confluence-flow-bridge
run: uv lock --check
- name: Install dependencies and run tests
working-directory: unoplat-code-confluence-ingestion/code-confluence-flow-bridge
env:
GITHUB_PAT_TOKEN: ${{ github.token }}
run: |
uv sync --group test
uv run --group test pytest --cov=src/${{ steps.package.outputs.name }} --cov-report=html:coverage_reports --cov-report=xml:coverage.xml --cov-report=term-missing tests/ -v
- name: Upload coverage reports
uses: actions/upload-artifact@v4
with:
name: coverage-reports-flow-bridge
path: |
unoplat-code-confluence-ingestion/code-confluence-flow-bridge/coverage_reports/
retention-days: 7
test-query-engine:
needs:
- detect-changes
- refresh-release-pr-lockfiles
if: ${{ (needs.detect-changes.outputs.query-engine == 'true' || needs.detect-changes.outputs.commons == 'true') && (needs.refresh-release-pr-lockfiles.result == 'success' || needs.refresh-release-pr-lockfiles.result == 'skipped') }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install uv
uses: astral-sh/setup-uv@v5
# 1) Always ensure the Compose v2 plugin is present
- name: Set up Docker Compose (v2)
uses: docker/setup-compose-action@v1
# pin a version if you need repeatability:
# with:
# version: '2.37.0'
# 2) Drop in a shim so legacy tools that expect `docker-compose`
# still work (but use v2 under the hood)
- name: Provide docker-compose wrapper for compatibility
shell: bash
run: |
if ! command -v docker-compose >/dev/null; then
echo 'Creating docker-compose wrapper ➜ docker compose "$@"'
sudo install -d /usr/local/bin
printf '#!/usr/bin/env bash\nexec docker compose "$@"\n' | \
sudo tee /usr/local/bin/docker-compose >/dev/null
sudo chmod +x /usr/local/bin/docker-compose
fi
docker compose version
docker-compose version # should output the same version
- name: Install Ruff
run: curl -LsSf https://astral.sh/ruff/install.sh | sh
- name: Install ripgrep
run: |
sudo apt-get update
sudo apt-get install -y ripgrep
- name: Get package name for coverage
working-directory: unoplat-code-confluence-query-engine
id: package
run: |
# Extract project name from pyproject.toml and convert hyphens to underscores
PACKAGE_NAME=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['name'].replace('-', '_'))")
echo "name=$PACKAGE_NAME" >> $GITHUB_OUTPUT
- name: Check lockfile freshness
working-directory: unoplat-code-confluence-query-engine
run: uv lock --check
- name: Install dependencies and run tests
working-directory: unoplat-code-confluence-query-engine
env:
GITHUB_PAT_TOKEN: ${{ github.token }}
run: |
uv sync --group test
uv run --group test pytest --cov=src/${{ steps.package.outputs.name }} --cov-report=html:coverage_reports --cov-report=xml:coverage.xml --cov-report=term-missing tests/ -v
- name: Upload coverage reports
uses: actions/upload-artifact@v4
with:
name: coverage-reports-query-engine
path: |
unoplat-code-confluence-query-engine/coverage_reports/
retention-days: 7