Skip to content

Persistent feedback option, more robust conversation management, some UI, bug fixes... #179

Persistent feedback option, more robust conversation management, some UI, bug fixes...

Persistent feedback option, more robust conversation management, some UI, bug fixes... #179

Workflow file for this run

name: PR Preview
on:
pull_request:
types: [opened, synchronize, reopened]
concurrency:
group: pr-preview-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
# formatting:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Set up Python
# uses: actions/setup-python@v5
# with:
# python-version: "3.11"
# - name: Install formatting tools
# run: |
# python -m pip install --upgrade pip
# pip install black==24.10.0
# - name: Check formatting with Black
# run: black --check .
build-base-images:
runs-on: ubuntu-latest
permissions:
contents: read
env:
A2RCHI_DIR: /home/runner/work/a2rchi-local
HOME: /home/runner
outputs:
changed: ${{ steps.detect.outputs.changed }}
tag: ${{ steps.detect.outputs.tag }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Detect base image changes
id: detect
env:
BASE_REF: ${{ github.event.pull_request.base.ref }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
set -euo pipefail
git fetch --no-tags origin "$BASE_REF"
FILES="$(git diff --name-only "origin/${BASE_REF}" HEAD || true)"
TAG="pr-${PR_NUMBER}"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
PATTERN='^(requirements/(?:cpu|gpu)-requirementsHEADER\.txt|requirements/requirements-base\.txt|src/cli/templates/dockerfiles/base-[^/]+/Dockerfile)'
if [[ -z "$FILES" ]]; then
echo "changed=false" >> "$GITHUB_OUTPUT"
exit 0
fi
if echo "$FILES" | grep -E "$PATTERN" >/dev/null; then
echo "Base image inputs changed:"
echo "$FILES" | grep -E "$PATTERN"
echo "changed=true" >> "$GITHUB_OUTPUT"
else
echo "changed=false" >> "$GITHUB_OUTPUT"
fi
- name: Set up Python
if: steps.detect.outputs.changed == 'true'
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install a2rchi CLI
if: steps.detect.outputs.changed == 'true'
run: |
python -m pip install --upgrade pip
pip install ".[all]" || pip install .
- name: Ensure build scripts are executable
if: steps.detect.outputs.changed == 'true'
run: chmod +x scripts/dev/*.sh
- name: Build updated base images
if: steps.detect.outputs.changed == 'true'
run: scripts/dev/build_docker_images.sh "${{ steps.detect.outputs.tag }}"
- name: Push updated base images
if: steps.detect.outputs.changed == 'true'
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
PUSH_LATEST: "false"
run: scripts/dev/push_docker_images.sh "${{ steps.detect.outputs.tag }}"
preview:
runs-on: ubuntu-latest
needs: build-base-images
permissions:
contents: read
pull-requests: write
env:
A2RCHI_DIR: /home/runner/work/a2rchi-local
HOME: /home/runner
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install a2rchi CLI
run: |
python -m pip install --upgrade pip
pip install ".[all]" || pip install .
- name: Prepare base image references
if: needs.build-base-images.outputs.changed == 'true'
run: python scripts/dev/update_service_base_images.py --tag "${{ needs.build-base-images.outputs.tag }}" --switch-source dockerhub
- name: Verify MkDocs build
run: mkdocs build --config-file docs/mkdocs.yml --strict
- name: Clean up MkDocs build artifacts
run: rm -rf site
- name: Run smoke deployment
uses: ./.github/actions/run-smoke
with:
deployment-name: manual-${{ github.run_id }}
config-path: tests/pr_preview_config/pr_preview_config.yaml
config-destination: configs/ci/ci_config.yaml
env-file: .env
services: chatbot
hostmode: "true"
wait-url: http://localhost:7861/api/health
base-url: http://localhost:7861
extra-env: A2RCHI_COMPOSE_UP_FLAGS=--build --pull always
- name: Delete PR preview Docker tags
if: ${{ always() && needs.build-base-images.outputs.changed == 'true' }}
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
TAG: ${{ needs.build-base-images.outputs.tag }}
run: |
set -euo pipefail
python scripts/dev/manage_docker_tags.py delete-tag --tag "${TAG}"