Skip to content

Commit 01be26c

Browse files
chore: add build-cache, update jobs, remove redundant security check
- Build and cache uv dependencies; update type-checker, tests, and linter to use cache - Remove separate security-checker - Add explicit workflow permissions for compliance - Remove pull_request trigger from build-cache workflow
1 parent c3ad588 commit 01be26c

File tree

5 files changed

+129
-55
lines changed

5 files changed

+129
-55
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Build uv cache
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "uv.lock"
9+
- "pyproject.toml"
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
build-cache:
17+
runs-on: ubuntu-latest
18+
strategy:
19+
matrix:
20+
python-version: ["3.10", "3.11", "3.12", "3.13"]
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
26+
- name: Install uv
27+
uses: astral-sh/setup-uv@v6
28+
with:
29+
version: "0.8.4"
30+
python-version: ${{ matrix.python-version }}
31+
enable-cache: false
32+
33+
- name: Install dependencies and populate cache
34+
run: |
35+
echo "Building global UV cache for Python ${{ matrix.python-version }}..."
36+
uv sync --all-groups --all-extras --no-install-project
37+
echo "Cache populated successfully"
38+
39+
- name: Save uv caches
40+
uses: actions/cache/save@v4
41+
with:
42+
path: |
43+
~/.cache/uv
44+
~/.local/share/uv
45+
.venv
46+
key: uv-main-py${{ matrix.python-version }}-${{ hashFiles('uv.lock') }}

.github/workflows/linter.yml

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ name: Lint
22

33
on: [pull_request]
44

5+
permissions:
6+
contents: read
7+
58
jobs:
69
lint:
710
runs-on: ubuntu-latest
@@ -15,19 +18,27 @@ jobs:
1518
- name: Fetch Target Branch
1619
run: git fetch origin $TARGET_BRANCH --depth=1
1720

21+
- name: Restore global uv cache
22+
id: cache-restore
23+
uses: actions/cache/restore@v4
24+
with:
25+
path: |
26+
~/.cache/uv
27+
~/.local/share/uv
28+
.venv
29+
key: uv-main-py3.11-${{ hashFiles('uv.lock') }}
30+
restore-keys: |
31+
uv-main-py3.11-
32+
1833
- name: Install uv
1934
uses: astral-sh/setup-uv@v6
2035
with:
21-
enable-cache: true
22-
cache-dependency-glob: |
23-
**/pyproject.toml
24-
**/uv.lock
25-
26-
- name: Set up Python
27-
run: uv python install 3.11
36+
version: "0.8.4"
37+
python-version: "3.11"
38+
enable-cache: false
2839

2940
- name: Install dependencies
30-
run: uv sync --dev --no-install-project
41+
run: uv sync --all-groups --all-extras --no-install-project
3142

3243
- name: Get Changed Python Files
3344
id: changed-files
@@ -45,3 +56,13 @@ jobs:
4556
| tr ' ' '\n' \
4657
| grep -v 'src/crewai/cli/templates/' \
4758
| xargs -I{} uv run ruff check "{}"
59+
60+
- name: Save uv caches
61+
if: steps.cache-restore.outputs.cache-hit != 'true'
62+
uses: actions/cache/save@v4
63+
with:
64+
path: |
65+
~/.cache/uv
66+
~/.local/share/uv
67+
.venv
68+
key: uv-main-py3.11-${{ hashFiles('uv.lock') }}

.github/workflows/security-checker.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/tests.yml

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Run Tests
33
on: [pull_request]
44

55
permissions:
6-
contents: write
6+
contents: read
77

88
env:
99
OPENAI_API_KEY: fake-api-key
@@ -23,19 +23,27 @@ jobs:
2323
- name: Checkout code
2424
uses: actions/checkout@v4
2525

26+
- name: Restore global uv cache
27+
id: cache-restore
28+
uses: actions/cache/restore@v4
29+
with:
30+
path: |
31+
~/.cache/uv
32+
~/.local/share/uv
33+
.venv
34+
key: uv-main-py${{ matrix.python-version }}-${{ hashFiles('uv.lock') }}
35+
restore-keys: |
36+
uv-main-py${{ matrix.python-version }}-
37+
2638
- name: Install uv
2739
uses: astral-sh/setup-uv@v6
2840
with:
29-
enable-cache: true
30-
cache-dependency-glob: |
31-
**/pyproject.toml
32-
**/uv.lock
33-
34-
- name: Set up Python ${{ matrix.python-version }}
35-
run: uv python install ${{ matrix.python-version }}
41+
version: "0.8.4"
42+
python-version: ${{ matrix.python-version }}
43+
enable-cache: false
3644

3745
- name: Install the project
38-
run: uv sync --dev --all-extras
46+
run: uv sync --all-groups --all-extras
3947

4048
- name: Run tests (group ${{ matrix.group }} of 8)
4149
run: |
@@ -48,3 +56,13 @@ jobs:
4856
--durations=10 \
4957
-n auto \
5058
--maxfail=3
59+
60+
- name: Save uv caches
61+
if: steps.cache-restore.outputs.cache-hit != 'true'
62+
uses: actions/cache/save@v4
63+
with:
64+
path: |
65+
~/.cache/uv
66+
~/.local/share/uv
67+
.venv
68+
key: uv-main-py${{ matrix.python-version }}-${{ hashFiles('uv.lock') }}

.github/workflows/type-checker.yml

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Run Type Checks
33
on: [pull_request]
44

55
permissions:
6-
contents: write
6+
contents: read
77

88
jobs:
99
type-checker-matrix:
@@ -20,19 +20,27 @@ jobs:
2020
with:
2121
fetch-depth: 0 # Fetch all history for proper diff
2222

23+
- name: Restore global uv cache
24+
id: cache-restore
25+
uses: actions/cache/restore@v4
26+
with:
27+
path: |
28+
~/.cache/uv
29+
~/.local/share/uv
30+
.venv
31+
key: uv-main-py${{ matrix.python-version }}-${{ hashFiles('uv.lock') }}
32+
restore-keys: |
33+
uv-main-py${{ matrix.python-version }}-
34+
2335
- name: Install uv
2436
uses: astral-sh/setup-uv@v6
2537
with:
26-
enable-cache: true
27-
cache-dependency-glob: |
28-
**/pyproject.toml
29-
**/uv.lock
30-
31-
- name: Set up Python ${{ matrix.python-version }}
32-
run: uv python install ${{ matrix.python-version }}
38+
version: "0.8.4"
39+
python-version: ${{ matrix.python-version }}
40+
enable-cache: false
3341

3442
- name: Install dependencies
35-
run: uv sync --dev --all-extras --no-install-project
43+
run: uv sync --all-groups --all-extras
3644

3745
- name: Get changed Python files
3846
id: changed-files
@@ -66,6 +74,16 @@ jobs:
6674
if: steps.changed-files.outputs.has_changes == 'false'
6775
run: echo "No Python files in src/ were modified - skipping type checks"
6876

77+
- name: Save uv caches
78+
if: steps.cache-restore.outputs.cache-hit != 'true'
79+
uses: actions/cache/save@v4
80+
with:
81+
path: |
82+
~/.cache/uv
83+
~/.local/share/uv
84+
.venv
85+
key: uv-main-py${{ matrix.python-version }}-${{ hashFiles('uv.lock') }}
86+
6987
# Summary job to provide single status for branch protection
7088
type-checker:
7189
name: type-checker

0 commit comments

Comments
 (0)