Repository navigation
Mermaid validation: PythonMonkey on main thread, then system Node, never mermaid.ink #49
Workflow file for this run
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: | |
| pull_request: | |
| branches: [main] | |
| push: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| cache: pip | |
| - name: Install dependencies | |
| run: | | |
| pip install -r requirements.txt | |
| pip install pytest pytest-asyncio pytest-cov ruff | |
| pip install -e . --no-deps | |
| - name: Run tests | |
| run: pytest -p no:cacheprovider -o addopts="" tests/ -q | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install ruff | |
| run: pip install ruff | |
| - name: Collect changed Python files | |
| env: | |
| PR_BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| PUSH_BASE_SHA: ${{ github.event.before }} | |
| run: | | |
| if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then | |
| diff_range="${PR_BASE_SHA}...${PR_HEAD_SHA}" | |
| else | |
| diff_range="${PUSH_BASE_SHA}..${GITHUB_SHA}" | |
| # After a force-push the old head is no longer reachable, so the | |
| # clone lacks it (it is all zeros for a new branch). Try fetching | |
| # it; otherwise lint the files changed by the pushed head commit. | |
| if ! git cat-file -e "${PUSH_BASE_SHA}^{commit}" 2>/dev/null; then | |
| git fetch --quiet --depth=1 origin "$PUSH_BASE_SHA" 2>/dev/null || true | |
| fi | |
| if ! git cat-file -e "${PUSH_BASE_SHA}^{commit}" 2>/dev/null; then | |
| echo "::warning::Push base ${PUSH_BASE_SHA} is not available; linting files changed by ${GITHUB_SHA} only." | |
| diff_range="${GITHUB_SHA}~1..${GITHUB_SHA}" | |
| fi | |
| fi | |
| git diff --name-only --diff-filter=ACMR -z "$diff_range" -- '*.py' \ | |
| > "$RUNNER_TEMP/changed-python-files" | |
| - name: Ruff check changed files | |
| run: | | |
| xargs -0 -r ruff check --output-format=github \ | |
| < "$RUNNER_TEMP/changed-python-files" | |
| - name: Ruff format check changed files | |
| run: | | |
| xargs -0 -r ruff format --check \ | |
| < "$RUNNER_TEMP/changed-python-files" |