1
Fork 0
mirror of https://github.com/allthingslinux/tux.git synced 2024-10-02 16:43:12 +00:00

refactor(pyright.yml): simplify GitHub Actions workflow for better readability and maintenance

feat(pyright.yml): add cache to Python setup for faster workflow execution
style(pyright.yml): improve naming conventions for better understanding
feat(pyright.yml): add environment debug print for easier troubleshooting
This commit is contained in:
kzndotsh 2024-08-31 17:00:27 +00:00
parent 5c6edacd9d
commit 4af00c1300

View file

@ -7,67 +7,42 @@ jobs:
runs-on: ubuntu-latest
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v4
- name: Set up python
- name: Set up Python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'poetry'
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
virtualenvs-path: .venv
installer-parallel: true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
#----------------------------------------------
# install your root project, if required
#----------------------------------------------
- name: Install project
run: poetry install --no-interaction
#----------------------------------------------
# activate virtual environment
#----------------------------------------------
- name: Activate virtual environment
run: echo "${{ github.workspace }}/.venv/bin" >> $GITHUB_PATH
#----------------------------------------------
# add poetry bin to PATH
#----------------------------------------------
- name: Add poetry bin to PATH
run: export PATH="${HOME}/.local/bin:${PATH}"
- name: Add Poetry binary to PATH
run: echo "${HOME}/.local/bin" >> $GITHUB_PATH
- name: Print environment for debug
run: |
echo "Python location: $(which python)"
echo "Poetry location: $(which poetry)"
poetry --version
which pyright
#----------------------------------------------
# run Pyright for type checking
#----------------------------------------------
- name: Run Pyright
uses: jakebailey/pyright-action@v2
with: