|
| 1 | +name: Style and Typing checks |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [opened, synchronize, reopened] |
| 6 | + |
| 7 | +permissions: |
| 8 | + contents: read |
| 9 | + statuses: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + |
| 13 | + style: |
| 14 | + runs-on: ubuntu-22.04 |
| 15 | + env: |
| 16 | + GH_TOKEN: ${{ github.token }} |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v4 |
| 19 | + with: |
| 20 | + fetch-depth: 0 |
| 21 | + - uses: actions/setup-python@v5 |
| 22 | + with: |
| 23 | + python-version: '3.11' |
| 24 | + - name: Install dependencies |
| 25 | + run: pip install ruff |
| 26 | + - name: Ruff output to file |
| 27 | + run: ruff check -ne -o ruff.log --output-format concise |
| 28 | + - name: Ruff output as annotations |
| 29 | + run: echo "$(ruff check -e --output-format github)" |
| 30 | + - name: Process Ruff output |
| 31 | + run: python devops/style_assistant.py ${{ github.run_id }} ${{ github.job }} ${{ github.event.pull_request.head.sha }} |
| 32 | + - name: Report status |
| 33 | + run: gh api ${{ env.DEVOPS_ASST_API_ARGS }} |
| 34 | + |
| 35 | + |
| 36 | + typing: |
| 37 | + runs-on: ubuntu-22.04 |
| 38 | + env: |
| 39 | + GH_TOKEN: ${{ github.token }} |
| 40 | + steps: |
| 41 | + - uses: actions/setup-python@v5 |
| 42 | + with: |
| 43 | + python-version: '3.11' |
| 44 | + - name: Python Version |
| 45 | + run: python --version |
| 46 | + - name: Update Pip |
| 47 | + run: python -m pip install --upgrade pip |
| 48 | + - name: Install dependencies |
| 49 | + run: pip install build setuptools pandas-stubs types-tqdm pyright |
| 50 | + - uses: actions/checkout@v4 |
| 51 | + with: |
| 52 | + ref: main |
| 53 | + fetch-depth: 0 |
| 54 | + - name: Build package |
| 55 | + run: python -m build --sdist |
| 56 | + - name: Install rsatoolbox |
| 57 | + run: pip install dist/* |
| 58 | + - name: Pyright (on main) |
| 59 | + continue-on-error: true |
| 60 | + run: pyright > pyright_main.log |
| 61 | + - name: Uninstall rsatoolbox |
| 62 | + run: pip uninstall -y rsatoolbox |
| 63 | + - name: Remove builds |
| 64 | + run: rm dist/* |
| 65 | + - uses: actions/checkout@v4 |
| 66 | + with: |
| 67 | + clean: false |
| 68 | + fetch-depth: 0 |
| 69 | + - name: Build package |
| 70 | + run: python -m build --sdist |
| 71 | + - name: Install rsatoolbox |
| 72 | + run: pip install dist/* |
| 73 | + - name: Pyright (on PR) |
| 74 | + continue-on-error: true |
| 75 | + run: pyright > pyright_pr.log |
| 76 | + - name: Process Pyright output |
| 77 | + run: python devops/typing_assistant.py ${{ github.run_id }} ${{ github.job }} ${{ github.event.pull_request.head.sha }} |
| 78 | + - name: Report status |
| 79 | + run: gh api ${{ env.DEVOPS_ASST_API_ARGS }} |
0 commit comments