Merge pull request #13 from sagea-ai/staging #51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| env: | |
| PYTHON_VERSION: "3.12" | |
| jobs: | |
| pre-commit: | |
| name: Pre-commit | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 | |
| - name: Install uv with caching | |
| uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7 | |
| with: | |
| version: "latest" | |
| enable-cache: true | |
| cache-dependency-glob: "uv.lock" | |
| - name: Set up Python | |
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Sync dependencies | |
| run: uv sync --all-extras | |
| - name: Install pip (required by pre-commit) | |
| run: uv pip install pip | |
| - name: Add virtual environment to PATH | |
| run: echo "$(pwd)/.venv/bin" >> $GITHUB_PATH | |
| - name: Cache pre-commit | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 | |
| with: | |
| path: ~/.cache/pre-commit | |
| key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} | |
| - name: Run pre-commit | |
| run: uv run pre-commit run --all-files --show-diff-on-failure | |
| tests: | |
| name: Tests | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 | |
| - name: Install uv with caching | |
| uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7 | |
| with: | |
| version: "latest" | |
| enable-cache: true | |
| cache-dependency-glob: "uv.lock" | |
| - name: Set up Python | |
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Sync dependencies | |
| run: uv sync --all-extras | |
| - name: Verify CLI can start | |
| run: | | |
| uv run rune --help | |
| uv run rune-acp --help | |
| - name: Install ripgrep | |
| run: sudo apt-get update && sudo apt-get install -y ripgrep | |
| - name: Run tests | |
| run: uv run pytest --ignore tests/snapshots | |
| snapshot-tests: | |
| name: Snapshot Tests | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 | |
| - name: Install uv with caching | |
| uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7 | |
| with: | |
| version: "latest" | |
| enable-cache: true | |
| cache-dependency-glob: "uv.lock" | |
| - name: Set up Python | |
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Sync dependencies | |
| run: uv sync --all-extras | |
| - name: Run snapshot tests | |
| id: snapshot-tests | |
| run: uv run pytest tests/snapshots | |
| continue-on-error: true | |
| - name: Upload snapshot report | |
| if: steps.snapshot-tests.outcome == 'failure' | |
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 | |
| with: | |
| name: snapshot-report | |
| path: snapshot_report.html | |
| if-no-files-found: warn | |
| retention-days: 3 | |
| - name: Fail job if snapshot tests failed | |
| if: steps.snapshot-tests.outcome == 'failure' | |
| run: | | |
| echo "Snapshot tests failed, failing job." | |
| exit 1 |