Skip to content

Fix/lazy loaded database health status #671

Fix/lazy loaded database health status

Fix/lazy loaded database health status #671

Workflow file for this run

name: CI/CD with Auto Release
on:
push:
branches: [ master, main, develop ]
pull_request:
branches: [ master, main ]
permissions:
contents: write # Allow creating tags and releases
actions: read # Allow reading workflow runs
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python3 -m pip install -e ".[dev]" --break-system-packages
- name: Run parity tests
run: |
python3 -m pytest tests/integration/parity/ -v --tb=short
- name: Generate parity matrix
if: always()
run: |
python3 scripts/generate_parity_matrix.py || echo "Parity matrix generation failed (script may not exist yet)"
- name: Upload parity matrix
if: always()
uses: actions/upload-artifact@v4
with:
name: parity-matrix
path: docs/mcp-rest-parity-matrix.md
if-no-files-found: ignore
check-version:
runs-on: ubuntu-latest
outputs:
version_changed: ${{ steps.check_version.outputs.version_changed }}
current_version: ${{ steps.check_version.outputs.current_version }}
previous_version: ${{ steps.check_version.outputs.previous_version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get current version
id: get_version
run: |
echo "current_version=$(python3 -c "import sys; sys.path.insert(0, 'src'); from code_indexer import __version__; print(__version__)")" >> $GITHUB_OUTPUT
- name: Check if version file changed
run: |
if git diff --name-only HEAD~1 HEAD | grep -q "src/code_indexer/__init__.py"; then
echo "version_file_changed=true" >> $GITHUB_ENV
else
echo "version_file_changed=false" >> $GITHUB_ENV
fi
- name: Get previous version
if: env.version_file_changed == 'true'
run: |
echo "previous_version=$(git show HEAD~1:src/code_indexer/__init__.py | grep '__version__' | cut -d'\"' -f2)" >> $GITHUB_ENV
- name: Check if version changed
id: check_version
run: |
current_version="${{ steps.get_version.outputs.current_version }}"
echo "current_version=$current_version" >> $GITHUB_OUTPUT
if [ "${{ env.version_file_changed }}" = "true" ]; then
previous_version="${{ env.previous_version }}"
echo "previous_version=$previous_version" >> $GITHUB_OUTPUT
if [ "$current_version" != "$previous_version" ]; then
echo "version_changed=true" >> $GITHUB_OUTPUT
echo "Version changed from $previous_version to $current_version"
else
echo "version_changed=false" >> $GITHUB_OUTPUT
echo "Version file modified but version unchanged: $current_version"
fi
else
echo "version_changed=false" >> $GITHUB_OUTPUT
echo "Version file not modified: $current_version"
fi
build-and-release:
runs-on: ubuntu-latest
needs: [check-version]
if: needs.check-version.outputs.version_changed == 'true'
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
python3 -m pip install build twine --break-system-packages
- name: Build package
run: |
python3 -m build
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Extract version
VERSION="${{ needs.check-version.outputs.current_version }}"
# Create git tag
git config user.name github-actions
git config user.email github-actions@github.com
git tag "v$VERSION" -m "Release version $VERSION"
git push origin "v$VERSION"
# Create GitHub release with auto-generated notes
gh release create "v$VERSION" \
--title "Release v$VERSION" \
--generate-notes \
--draft=false \
--prerelease=false \
dist/*