Skip to content

Commit

Permalink
Merge pull request #487 from py-mine/switch-setup-poetry-action
Browse files Browse the repository at this point in the history
Use faster ItsDrike/setup-poetry in favor of HassanAbouelela/actions/setup-python
  • Loading branch information
kevinkjt2000 authored Feb 20, 2023
2 parents 70cfb19 + ad769d9 commit 8b90a58
Show file tree
Hide file tree
Showing 4 changed files with 657 additions and 13 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/tox-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install Python Dependencies
uses: HassanAbouelela/actions/setup-python@setup-python_v1.4.0
id: setup_python
- name: Setup poetry
id: poetry_setup
uses: ItsDrike/setup-poetry@v1
with:
install_args: "--with workflow-tox --without lint"
python_version: "${{ matrix.python-version }}"
install-args: "--with workflow-tox --without lint"
python-version: "${{ matrix.python-version }}"

- name: Test with tox
shell: bash
run: poetry run tox
env:
PIP_USER: 0 # We want tox to use it's environments, not user installs
Expand Down
21 changes: 18 additions & 3 deletions .github/workflows/validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
PRE_COMMIT_HOME: "/home/runner/.cache/pre-commit"

jobs:
lint:
runs-on: ubuntu-latest
Expand All @@ -18,10 +21,22 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install Python Dependencies
uses: HassanAbouelela/actions/setup-python@setup-python_v1.4.0
- name: Setup poetry
id: poetry_setup
uses: ItsDrike/setup-poetry@v1
with:
python-version: 3.11

- name: Pre-commit Environment Caching
uses: actions/cache@v3
with:
python_version: "3.11"
path: ${{ env.PRE_COMMIT_HOME }}
key: "precommit-${{ runner.os }}-${{ steps.poetry_setup.outputs.python-version }}-\
${{ hashFiles('./.pre-commit-config.yaml') }}"
# Restore keys allows us to perform a cache restore even if the full cache key wasn't matched.
# That way we still end up saving new cache, but we can still make use of the cache from previous
# version.
restore-keys: "precommit-${{ runner.os }}-${{ steps.poetry_setup.outputs-python-version}}-"

- name: Run pre-commit hooks
run: SKIP=black,isort,flake8,pyright pre-commit run --all-files
Expand Down
Loading

0 comments on commit 8b90a58

Please sign in to comment.