Python Glacier2/session typing fixes (#649) #1613
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 | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| # The branches below must be a subset of the branches above | |
| branches: ["main"] | |
| jobs: | |
| ruff: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install Ruff | |
| run: pip install ruff | |
| - name: Ruff check | |
| run: ruff check . | |
| - name: Ruff format | |
| run: ruff format . --check --diff | |
| pyright: | |
| runs-on: macos-26 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install pyright | |
| run: npm install -g pyright | |
| - name: Run pyright on each demo | |
| run: | | |
| set -euo pipefail | |
| any_failed=0 | |
| while read -r reqfile; do | |
| demo_dir=$(dirname "$reqfile") | |
| echo "===> Processing $demo_dir" | |
| pushd "$demo_dir" > /dev/null | |
| # Create and activate virtualenv | |
| python3 -m venv venv | |
| source venv/bin/activate | |
| # Install requirements | |
| pip install --upgrade pip | |
| pip install -r requirements.txt | |
| # Run slice2py if ../slice exists | |
| if [ -d ../slice ]; then | |
| echo "===> Running slice2py in $demo_dir" | |
| slice2py ../slice/*.ice | |
| fi | |
| # Run pyright | |
| echo "===> Running pyright in $demo_dir" | |
| if ! pyright .; then | |
| echo "❌ pyright failed in $demo_dir" | |
| any_failed=1 | |
| else | |
| echo "✅ pyright passed in $demo_dir" | |
| fi | |
| deactivate | |
| popd > /dev/null | |
| done < <(find . -name requirements.txt) | |
| if [ "$any_failed" -eq 1 ]; then | |
| echo "One or more pyright checks failed." | |
| exit 1 | |
| fi |