Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new feature caching pip cache with setup-python action #61

Merged
merged 1 commit into from
Oct 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: create requirements.txt so that pip cache with setup-python works
run: echo "pre-commit" > requirements_precommit.txt
- uses: actions/setup-python@v4
with:
python-version: "3.8"
cache: "pip"
cache-dependency-path: requirements_precommit.txt
- name: install pre-commit
run: python -m pip install pre-commit
- name: get cached pre-commit hooks
Expand All @@ -37,6 +41,14 @@ jobs:
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: create requirements.txt so that pip cache with setup-python works
run:
echo "build" > requirements_build.txt
- uses: actions/setup-python@v4
with:
python-version: "3.8"
cache: "pip"
cache-dependency-path: requirements_build.txt
- name: Install build dependencies
run: pip install -U build
- name: Update version number according to pushed tag
Expand Down Expand Up @@ -109,6 +121,8 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: pyproject.toml
- name: Download artifacts
uses: actions/download-artifact@v3
with:
Expand Down Expand Up @@ -141,18 +155,6 @@ jobs:
- name: Test minizinc install
run: |
minizinc --version
- name: Get pip cache dir
id: get-pip-cache-dir
run: |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: Restore pip cache
id: cache-pip
uses: actions/cache@v3
with:
path: ${{ steps.get-pip-cache-dir.outputs.dir }}
key: pip-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
restore-keys: |
pip-${{ runner.os }}-${{ matrix.python-version }}-
- name: Install test dependencies
run: |
python -m pip install -U pip
Expand Down