Skip to content

Commit 000b6f4

Browse files
committed
Refactor GitHub Actions workflow to improve dependency caching and job structure
1 parent 5340e9d commit 000b6f4

File tree

1 file changed

+25
-10
lines changed

1 file changed

+25
-10
lines changed

.github/workflows/pr.yml

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ on:
1717
- ".github/workflows/**"
1818

1919
jobs:
20-
ruff:
20+
setup:
2121
runs-on: ubuntu-latest
2222
steps:
2323
- name: Check Out Repo
@@ -31,23 +31,38 @@ jobs:
3131
run: pip install poetry
3232
- name: Install Dependencies
3333
run: poetry install --with dev
34+
- name: Cache Poetry dependencies
35+
uses: actions/cache@v3
36+
with:
37+
path: .venv
38+
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
39+
40+
ruff:
41+
needs: setup
42+
runs-on: ubuntu-latest
43+
steps:
44+
- uses: actions/checkout@v4
45+
- uses: actions/setup-python@v5
46+
with:
47+
python-version: '3.9'
48+
- uses: actions/cache@v3
49+
with:
50+
path: .venv
51+
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
3452
- name: Run ruff
3553
run: poetry run ruff check
3654

3755
test:
3856
needs: ruff
3957
runs-on: ubuntu-latest
4058
steps:
41-
- name: Check Out Repo
42-
uses: actions/checkout@v4
43-
- name: Set up Python
44-
uses: actions/setup-python@v5
59+
- uses: actions/checkout@v4
60+
- uses: actions/setup-python@v5
4561
with:
4662
python-version: '3.9'
47-
cache: 'pip'
48-
- name: Install Poetry
49-
run: pip install poetry
50-
- name: Install Dependencies
51-
run: poetry install --with dev
63+
- uses: actions/cache@v3
64+
with:
65+
path: .venv
66+
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
5267
- name: Run Tests
5368
run: poetry run pytest tests

0 commit comments

Comments
 (0)