Skip to content

Commit

Permalink
Devops: Update setup-python dependency in CI/CD to v4
Browse files Browse the repository at this point in the history
This now comes with built-in support for caching of Python dependencies
allowing the workflows to be simplified by getting rid of the `cache`
action.
  • Loading branch information
sphuber authored Nov 1, 2023
1 parent 6bc435b commit 3788672
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 44 deletions.
36 changes: 12 additions & 24 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
- name: Checkout source
uses: actions/checkout@v2

- name: Set up Python 3.10
uses: actions/setup-python@v2
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

Expand All @@ -32,18 +32,12 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Cache Python dependencies
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: pip-pre-commit-${{ hashFiles('**/setup.json') }}
restore-keys:
pip-pre-commit-

- name: Set up Python
uses: actions/setup-python@v2
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
cache-dependency-path: pyproject.toml

- name: Install Python dependencies
run: pip install -e .[dev]
Expand All @@ -69,18 +63,12 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Cache Python dependencies
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: pip-${{ matrix.python-version }}-tests-${{ hashFiles('**/setup.json') }}
restore-keys:
pip-${{ matrix.python-version }}-tests

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- name: Install Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: pyproject.toml

- name: Install system dependencies
run: sudo apt update && sudo apt install postgresql
Expand All @@ -101,8 +89,8 @@ jobs:
- name: Checkout source
uses: actions/checkout@v2

- name: Set up Python 3.10
uses: actions/setup-python@v2
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

Expand Down
26 changes: 6 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,12 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Cache Python dependencies
id: cache-pip
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: pip-pre-commit-${{ hashFiles('**/setup.json') }}
restore-keys:
pip-pre-commit-

- name: Install Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
cache-dependency-path: pyproject.toml

- name: Install Python package and dependencies
run: pip install -e .[dev]
Expand All @@ -49,19 +42,12 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Cache Python dependencies
id: cache-pip
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: pip-${{ matrix.python-version }}-tests-${{ hashFiles('**/setup.json') }}
restore-keys:
pip-${{ matrix.python-version }}-tests

- name: Install Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: pyproject.toml

- name: Install system dependencies
run: sudo apt update && sudo apt install postgresql
Expand Down

0 comments on commit 3788672

Please sign in to comment.