Skip to content

Commit

Permalink
Avoiding cache if pyproject is not modified (#2607)
Browse files Browse the repository at this point in the history
* Avoiding cache if pyproject is not modified

* fixing missing letter

* downgrade jupyter_sphinx

* fixing if and applying to rest of the workflows.
  • Loading branch information
germa89 authored Jan 5, 2024
1 parent 2abc2c4 commit 4c2779a
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 11 deletions.
78 changes: 68 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,27 @@ jobs:
- name: "Install Git and checkout project"
uses: actions/checkout@v4

- name: "Setup Python"
- name: "Getting files change filters"
uses: dorny/paths-filter@v2
id: changes
with:
filters: |
workflows:
- '.github/workflows/**'
- name: "Setup Python with cache"
uses: actions/setup-python@v5
if: steps.changes.outputs.workflows != 'true'
with:
cache: 'pip'
python-version: ${{ env.MAIN_PYTHON_VERSION }}

- name: "Setup Python without cache"
uses: actions/setup-python@v5
if: steps.changes.outputs.workflows == 'true'
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}

- name: "Install OS packages"
run: |
sudo apt update
Expand Down Expand Up @@ -160,6 +175,7 @@ jobs:
- name: "Cache examples"
uses: actions/cache@v3
if: steps.changes.outputs.workflows != 'true'
with:
path: doc/source/examples
key: Examples-v${{ env.RESET_EXAMPLES_CACHE }}-${{ steps.version.outputs.PYMAPDL_VERSION }}-${{ github.sha }}
Expand All @@ -168,6 +184,7 @@ jobs:
- name: "Cache docs build directory"
uses: actions/cache@v3
if: steps.changes.outputs.workflows != 'true'
with:
path: doc/_build
key: doc-build-v${{ env.RESET_DOC_BUILD_CACHE }}-${{ steps.version.outputs.PYMAPDL_VERSION }}-${{ github.sha }}
Expand All @@ -176,6 +193,7 @@ jobs:
- name: "Cache autosummary"
uses: actions/cache@v3
if: steps.changes.outputs.workflows != 'true'
with:
path: doc/source/**/_autosummary/*.rst
key: autosummary-v${{ env.RESET_AUTOSUMMARY_CACHE }}-${{ steps.version.outputs.PYMAPDL_VERSION }}-${{ github.sha }}
Expand Down Expand Up @@ -306,11 +324,25 @@ jobs:
- name: "Install Git and checkout project"
uses: actions/checkout@v4

- name: "Setup Python"
- name: "Getting files change filters"
uses: dorny/paths-filter@v2
id: changes
with:
filters: |
workflows:
- '.github/workflows/**'
- name: "Setup Python with cache"
uses: actions/setup-python@v5
if: steps.changes.outputs.workflows != 'true'
with:
cache: 'pip'
cache-dependency-path: pyproject.toml
python-version: ${{ env.MAIN_PYTHON_VERSION }}

- name: "Setup Python without cache"
uses: actions/setup-python@v5
if: steps.changes.outputs.workflows == 'true'
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}

- name: "Install os packages"
Expand Down Expand Up @@ -505,9 +537,24 @@ jobs:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}

- name: "Getting files change filters"
uses: dorny/paths-filter@v2
id: changes
with:
filters: |
workflows:
- '.github/workflows/**'
- name: "Setup Python with cache"
uses: actions/setup-python@v5
if: steps.changes.outputs.workflows != 'true'
with:
cache: 'pip'
python-version: ${{ env.MAIN_PYTHON_VERSION }}

- name: "Setup Python"
- name: "Setup Python without cache"
uses: actions/setup-python@v5
if: steps.changes.outputs.workflows == 'true'
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}

Expand Down Expand Up @@ -539,11 +586,6 @@ jobs:
run: |
python -m pip install .[tests]
# - name: DPF Server Activation
# run: |
# docker pull ghcr.io/ansys/dpf-core:22.2dev
# docker run -d --name dpfserver -p ${{ env.DPF_PORT }}:50052 ghcr.io/ansys/dpf-core:22.2dev && echo "DPF Server active on port ${{ env.DPF_PORT }}."

- name: "Unit testing"
run: |
unset PYMAPDL_PORT
Expand Down Expand Up @@ -638,8 +680,24 @@ jobs:
sudo apt-get update
sudo apt-get install -y libgomp1
- name: "Setup Python"
- name: "Getting files change filters"
uses: dorny/paths-filter@v2
id: changes
with:
filters: |
workflows:
- '.github/workflows/**'
- name: "Setup Python with cache"
uses: actions/setup-python@v5
if: steps.changes.outputs.workflows != 'true'
with:
cache: 'pip'
python-version: ${{ env.MAIN_PYTHON_VERSION }}

- name: "Setup Python without cache"
uses: actions/setup-python@v5
if: steps.changes.outputs.workflows == 'true'
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ doc = [
"grpcio==1.60.0",
"imageio-ffmpeg==0.4.9",
"imageio==2.33.1",
"jupyter_sphinx==0.5.3",
"jupyter_sphinx==0.4.0",
"jupyterlab>=3.2.8",
"matplotlib==3.8.2",
"numpydoc==1.6.0",
Expand Down

0 comments on commit 4c2779a

Please sign in to comment.