|
1 | 1 | --- |
2 | 2 | name: Code Checks |
3 | 3 |
|
4 | | -on: |
| 4 | +on: # yamllint disable-line rule:truthy |
5 | 5 | pull_request: |
6 | | - branches: [main] |
7 | 6 | push: |
8 | 7 | branches: [main] |
9 | 8 |
|
10 | 9 | jobs: |
11 | | - code-checks: |
| 10 | + pre-commit: |
12 | 11 | runs-on: ubuntu-latest |
13 | 12 | steps: |
14 | 13 | - uses: actions/checkout@v3 |
15 | | - - run: pipx install poetry |
| 14 | + - name: Setup Poetry |
| 15 | + run: | |
| 16 | + pipx install poetry |
| 17 | + poetry config virtualenvs.in-project true |
16 | 18 | - uses: actions/setup-python@v4 |
17 | 19 | with: |
18 | | - python-version: "3.11" |
| 20 | + python-version: '3.11' |
19 | 21 | cache: 'poetry' |
| 22 | + - run: poetry install --only dev |
| 23 | + # Hack to make pre-commit/action to use virtual env pre-commit. |
| 24 | + # pre-commit/action installs pre-commit using following command: |
| 25 | + # `python -m pip install pre-commit` |
| 26 | + # But `python` doesn't run virtual env interpreter when PATH is default. |
| 27 | + # Override PATH to use virtual env interpreter. |
| 28 | + # This change force run the virtual env pre-commit. |
| 29 | + - name: Set Poetry virtual env path to PATH |
| 30 | + run: echo ${{ github.workspace }}/.venv/bin >> $GITHUB_PATH |
20 | 31 | - uses: pre-commit/[email protected] |
21 | 32 | - uses: pre-commit-ci/[email protected] |
22 | 33 | if: always() |
| 34 | + |
| 35 | + pyright: |
| 36 | + runs-on: ubuntu-latest |
| 37 | + steps: |
| 38 | + - uses: actions/checkout@v3 |
| 39 | + - name: Setup Poetry |
| 40 | + run: | |
| 41 | + pipx install poetry |
| 42 | + poetry config virtualenvs.in-project true |
| 43 | + - uses: actions/setup-python@v4 |
| 44 | + with: |
| 45 | + python-version: '3.11' |
| 46 | + cache: 'poetry' |
23 | 47 | - name: Install dependencies for pyright |
24 | 48 | run: | |
25 | 49 | poetry install --only main,test |
26 | 50 | poetry run pip install PyQt6 |
| 51 | + - run: poetry run pip list |
| 52 | + # Pyright uses dependencies of the interpreter run with the `python`. |
| 53 | + # But `python` doesn't run virtual env interpreter when PATH is default. |
| 54 | + # Override PATH to use virtual env interpreter. |
| 55 | + # This change makes pyright use dependencies of virtual env interpreter. |
| 56 | + - name: Set Poetry virtual env path to PATH |
| 57 | + run: echo ${{ github.workspace }}/.venv/bin >> $GITHUB_PATH |
27 | 58 | - uses: jakebailey/pyright-action@v1 |
0 commit comments