Skip to content

Commit 698dc8a

Browse files
Refactor CI workflow for improved caching and dependency installation (#19)
* Refactor CI workflow to restore global UV cache and streamline dependency installation * Remove myst-parser from documentation dependencies in uv.lock * Add caching for UV dependencies in CI workflow * Use 'uv' command to run tests in CI workflow
1 parent 955f239 commit 698dc8a

File tree

1 file changed

+29
-33
lines changed

1 file changed

+29
-33
lines changed

.github/workflows/ci.yml

Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,31 @@ jobs:
2626
steps:
2727
- uses: actions/checkout@v4
2828

29-
- name: Set up Python ${{ matrix.python-version }}
30-
uses: actions/setup-python@v4
29+
- name: Restore global uv cache
30+
id: cache-restore
31+
uses: actions/cache/restore@v4
32+
with:
33+
path: |
34+
~/.cache/uv
35+
~/.local/share/uv
36+
.venv
37+
key: uv-main-${{ hashFiles('uv.lock') }}
38+
restore-keys: |
39+
uv-main-
40+
41+
- name: Install uv
42+
uses: astral-sh/setup-uv@v6
3143
with:
32-
python-version: ${{ matrix.python-version }}
44+
version: "0.8.4"
45+
python-version: "3.13"
46+
enable-cache: false
3347

3448
- name: Install dependencies
35-
run: |
36-
python -m pip install --upgrade pip
37-
pip install -e ".[dev,test]"
49+
run: uv sync --group dev --group test
3850

3951
- name: Run tests
4052
run: |
41-
python -m pytest eopf_geozarr/tests/ -v --tb=short -m "not network" --cov=eopf_geozarr --cov-report=xml --cov-report=term-missing
53+
uv run pytest eopf_geozarr/tests/ -v --tb=short -m "not network" --cov=eopf_geozarr --cov-report=xml --cov-report=term-missing
4254
4355
- name: Upload coverage to Codecov
4456
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
@@ -48,6 +60,16 @@ jobs:
4860
flags: unittests
4961
name: codecov-umbrella
5062

63+
- name: Save uv caches
64+
if: steps.cache-restore.outputs.cache-hit != 'true'
65+
uses: actions/cache/save@v4
66+
with:
67+
path: |
68+
~/.cache/uv
69+
~/.local/share/uv
70+
.venv
71+
key: uv-main-${{ hashFiles('uv.lock') }}
72+
5173
test-network:
5274
runs-on: ubuntu-latest
5375
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
@@ -68,32 +90,6 @@ jobs:
6890
run: |
6991
python -m pytest eopf_geozarr/tests/ -v --tb=short -m "network"
7092
71-
docs:
72-
runs-on: ubuntu-latest
73-
steps:
74-
- uses: actions/checkout@v4
75-
76-
- name: Set up Python
77-
uses: actions/setup-python@v4
78-
with:
79-
python-version: '3.11'
80-
81-
- name: Install dependencies
82-
run: |
83-
python -m pip install --upgrade pip
84-
pip install -e ".[docs]"
85-
86-
- name: Build documentation
87-
run: |
88-
cd docs
89-
make html
90-
91-
- name: Upload docs artifact
92-
uses: actions/upload-artifact@v4
93-
with:
94-
name: documentation
95-
path: docs/_build/html/
96-
9793
security:
9894
runs-on: ubuntu-latest
9995
steps:

0 commit comments

Comments
 (0)