From 4d677fa761281e31996464ed077b8848c8574caf Mon Sep 17 00:00:00 2001 From: phi Date: Sun, 25 Feb 2024 01:58:52 +0900 Subject: [PATCH] chore: update actions --- .github/workflows/check.yaml | 36 +++++++++++++++++++++++----------- .github/workflows/docs.yaml | 26 ++++++++++++++---------- .github/workflows/publish.yaml | 15 +++++++------- 3 files changed, 49 insertions(+), 28 deletions(-) diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 8839a39..dfb1265 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -2,7 +2,7 @@ name: lint & test on: push: - branches: [dev, main] + branches: [dev] pull_request: branches: [dev, main] @@ -16,23 +16,37 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Install poetry - run: | - pipx install poetry - poetry config installer.modern-installation false - poetry config virtualenvs.in-project true - - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - cache: poetry - cache-dependency-path: | - **/poetry.lock + + - name: Install Poetry + uses: snok/install-poetry@v1 + with: + virtualenvs-create: true + virtualenvs-in-project: true + installer-parallel: true + + - name: Load cached venv + id: cached-poetry-dependencies + uses: actions/cache@v4 + with: + path: .venv + key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }} - name: Install dependencies + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' run: | - poetry install --all-extras --with=dev + poetry config installer.max-workers 10 + poetry install --no-interaction --all-extras --with=dev + + - name: Load cached pre-commit + id: cached-pre-commit-dependencies + uses: actions/cache@v4 + with: + path: ~/.cache/pre-commit + key: precommit-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }} - name: Code checks run: | diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index c13d51e..5e0bffc 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -16,26 +16,32 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Install poetry - run: | - pipx install poetry - poetry config installer.modern-installation false - poetry config virtualenvs.in-project true - - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - cache: poetry - cache-dependency-path: | - **/poetry.lock + + - name: Install Poetry + uses: snok/install-poetry@v1 + with: + virtualenvs-create: true + virtualenvs-in-project: true + installer-parallel: true + + - name: Load cached venv + id: cached-poetry-dependencies + uses: actions/cache@v4 + with: + path: .venv + key: venv-doc-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }} - name: Install dependencies + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' run: | pip install dunamai VERSION=$(dunamai from any --no-metadata --style pep440) poetry version $VERSION - poetry install --with=docs + poetry install --no-interaction --with=docs - name: Create docs run: | diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index f60e5ff..01343a3 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -19,17 +19,18 @@ jobs: token: "${{ secrets.GITHUB_TOKEN }}" fetch-depth: 0 - - name: Install poetry - run: | - pipx install poetry - poetry config installer.modern-installation false - poetry config virtualenvs.in-project true - - - name: Setup Python Env ${{ matrix.python-version }} + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + - name: Install Poetry + uses: snok/install-poetry@v1 + with: + virtualenvs-create: true + virtualenvs-in-project: true + installer-parallel: true + - name: Install dependencies run: pip install dunamai