Skip to content

Commit

Permalink
Devops: Update the setup-python action for CI and CD (#66)
Browse files Browse the repository at this point in the history
The `setup-python@v2` action was outdated and is updated to
`setup-python@v4`. This also now comes with in-built caching
functionality for the requirements which allows to replace the separate
action that was providing this funcitonality.
  • Loading branch information
sphuber authored Sep 27, 2023
1 parent 3accb27 commit e77d6dd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 44 deletions.
34 changes: 11 additions & 23 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.9
uses: actions/setup-python@v2
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.9'

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.9'
cache: 'pip'
cache-dependency-path: pyproject.toml

- name: Install Python dependencies
run: pip install -e .[dev]
Expand All @@ -63,18 +57,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
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: pyproject.toml

- name: Install Python dependencies
run: pip install -e .[dev]
Expand All @@ -93,7 +81,7 @@ jobs:
uses: actions/checkout@v2

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

Expand Down
28 changes: 7 additions & 21 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.9'
cache: 'pip'
cache-dependency-path: pyproject.toml

- name: Install Python package and dependencies
run: pip install -e .[dev]
Expand All @@ -42,19 +35,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
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: pyproject.toml

- name: Install Python package and dependencies
run: pip install -e .[dev]
Expand Down

0 comments on commit e77d6dd

Please sign in to comment.