Skip to content

Commit e0b9c70

Browse files
committed
Lets have a reusable (composite) action
1 parent 10c55b0 commit e0b9c70

File tree

2 files changed

+21
-14
lines changed

2 files changed

+21
-14
lines changed

.github/workflows/django.yml

+3-14
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,6 @@ jobs:
1414
- name: Run tests
1515
run: docker compose run django py.test
1616

17-
install_dependencies:
18-
runs-on: ubuntu-latest
19-
steps:
20-
- uses: actions/checkout@v4
21-
- uses: actions/setup-python@v5
22-
with:
23-
python-version: 3.12.4
24-
cache: "pip"
25-
cache-dependency-path: |
26-
requirements/local.txt
27-
requirements/base.txt
28-
- name: Install dependencies
29-
run: pip install -r requirements/local.txt
30-
3117
build:
3218
runs-on: ubuntu-latest
3319
needs: install_dependencies
@@ -45,6 +31,9 @@ jobs:
4531
steps:
4632
- uses: actions/checkout@v4
4733
- name: Run ruff
34+
- uses: ./.github/workflows/python_and_pip.yml"
35+
with:
36+
python-version: 3.12.4
4837
run: ruff check .
4938
- name: Type check
5039
run: mypy --config mypy.ini styleguide_example/

.github/workflows/python_and_pip.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: "Install & Cache Python dependencies"
2+
description: "Reusable step (aka 'composite action') for doing pip installs, with cache included."
3+
inputs:
4+
python-version:
5+
description: "The version of Python to install"
6+
required: true
7+
run:
8+
using: "composite"
9+
steps:
10+
- uses: actions/setup-python@v5
11+
with:
12+
python-version: ${{ inputs.python-version }}
13+
cache: "pip"
14+
cache-dependency-path: |
15+
requirements/local.txt
16+
requirements/base.txt
17+
- name: Install dependencies
18+
run: pip install -r requirements/local.txt

0 commit comments

Comments
 (0)