ci(ui): TS types in CI #21
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: python-services | |
| on: [push, pull_request] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| services: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Detect Python dir | |
| shell: bash | |
| run: | | |
| set -e | |
| PY_DIR="PATH/TO/YOUR-SERVICE" | |
| for C in services backend api server apps/* packages/* .; do | |
| if [ -f "$C/requirements.txt" ] || [ -f "$C/scripts/run_demo.py" ] || [ -f "$C/scripts/check_feedback.py" ]; then PY_DIR="$C"; break; fi | |
| done | |
| echo "py_dir=$PY_DIR" >> $GITHUB_ENV | |
| echo "Detected Python dir: '${PY_DIR:-<none>}'" | |
| if [ -z "$PY_DIR" ]; then mkdir -p artifacts && echo "## python-services\nNo Python dir found." > artifacts/summary.md; fi | |
| - name: Install requirements (guarded) | |
| if: env.py_dir != '' | |
| working-directory: ${{ env.py_dir }} | |
| run: | | |
| python -m pip install -U pip | |
| if [ -f requirements.txt ]; then pip install -r requirements.txt; else echo "No requirements.txt; skip."; fi | |
| - name: Lint/Test/Demo (with fallbacks) | |
| if: env.py_dir != '' | |
| working-directory: ${{ env.py_dir }} | |
| run: | | |
| set -e | |
| if [ -f Makefile ] && grep -qE '(^|\n)ci:' Makefile; then | |
| make ci | |
| elif [ -f scripts/run_demo.py ] && [ -f seeds/prompts.jsonl ]; then | |
| mkdir -p artifacts | |
| python -m scripts.run_demo --seed seeds/prompts.jsonl --outdir artifacts | |
| elif [ -f scripts/check_feedback.py ]; then | |
| mkdir -p artifacts | |
| python -m scripts.check_feedback --outdir artifacts || python scripts/check_feedback.py | |
| else | |
| mkdir -p artifacts | |
| echo "## python-services" > artifacts/summary.md | |
| echo "No entrypoint found. Add Makefile:ci or scripts/run_demo.py." >> artifacts/summary.md | |
| fi | |
| - name: Upload artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: python-services-artifacts | |
| path: | | |
| ${{ env.py_dir }}/artifacts/* | |
| artifacts/* | |
| if-no-files-found: warn |