diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a2fbc22..a6abe09 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,6 +6,10 @@ on: pull_request: branches: [main] +env: + PYTHON_VERSION: "3.10" + POETRY_VERSION: "1.3.2" + jobs: main: name: Test and release @@ -16,29 +20,30 @@ jobs: uses: actions/checkout@v3 with: fetch-depth: 0 - - name: Set up Python 3.10 + - name: Set up Python uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: ${{ env.PYTHON_VERSION }} - name: Cache poetry id: cache-poetry uses: actions/cache@v3 with: path: ~/.local - key: poetry-${{ runner.os }} + key: poetry-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ env.POETRY_VERSION }} - name: Install poetry if: steps.cache-poetry.outputs.cache-hit != 'true' uses: snok/install-poetry@v1 with: + version: ${{ env.POETRY_VERSION }} virtualenvs-in-project: true - name: Cache venv id: cache-venv uses: actions/cache@v3 with: path: .venv - key: venv-${{ runner.os }}-${{ hashFiles('poetry.lock') }} + key: venv-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ env.POETRY_VERSION }}-${{ hashFiles('poetry.lock') }} restore-keys: | - venv-${{ runner.os }}- + venv-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ env.POETRY_VERSION }}- - name: Install dependencies if: steps.cache-venv.outputs.cache-hit != 'true' run: poetry install