diskcache-rs 0.2.3__tar.gz → 0.4.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. diskcache_rs-0.4.2/.github/actions/build-and-test/action.yml +65 -0
  2. diskcache_rs-0.4.2/.github/actions/setup-diskcache-rs/action.yml +46 -0
  3. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/.github/workflows/benchmark.yml +6 -8
  4. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/.github/workflows/build-abi3.yml +14 -14
  5. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/.github/workflows/build.yml +24 -24
  6. diskcache_rs-0.4.2/.github/workflows/ci.yml +110 -0
  7. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/.github/workflows/release.yml +66 -20
  8. diskcache_rs-0.4.2/.pre-commit-config.yaml +53 -0
  9. diskcache_rs-0.4.2/.release-please-manifest.json +3 -0
  10. diskcache_rs-0.4.2/CHANGELOG.md +239 -0
  11. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/Cargo.lock +198 -230
  12. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/Cargo.toml +14 -8
  13. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/Dockerfile.test +1 -1
  14. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/PKG-INFO +10 -24
  15. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/README.md +7 -22
  16. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/benchmarks/comprehensive_performance_test.py +34 -34
  17. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/benchmarks/final_performance_comparison.py +42 -42
  18. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/benchmarks/memory_usage_test.py +49 -49
  19. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/benchmarks/optimization_validation_test.py +65 -65
  20. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/justfile +1 -19
  21. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/pyproject.toml +8 -3
  22. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/python/diskcache_rs/__init__.py +12 -1
  23. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/python/diskcache_rs/__init__.pyi +82 -30
  24. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/python/diskcache_rs/_diskcache_rs.pyi +71 -14
  25. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/python/diskcache_rs/cache.py +31 -5
  26. diskcache_rs-0.4.2/release-please-config.json +35 -0
  27. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/scripts/sync_version.py +7 -7
  28. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/src/cache.rs +81 -10
  29. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/src/pickle_cache.rs +4 -4
  30. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/src/serialization.rs +2 -0
  31. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/src/storage/optimized_backend.rs +369 -15
  32. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/src/storage.rs +3 -0
  33. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/tests/test_cross_platform_network.py +4 -0
  34. diskcache_rs-0.4.2/tests/test_issue_17_configurable_threshold.py +155 -0
  35. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/tests/test_network_filesystem.py +4 -0
  36. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/tests/test_performance.py +19 -16
  37. diskcache_rs-0.4.2/tests/test_version_and_disk_threshold.py +346 -0
  38. diskcache_rs-0.4.2/uv.lock +802 -0
  39. diskcache_rs-0.2.3/.cz.toml +0 -18
  40. diskcache_rs-0.2.3/.github/workflows/bump-version.yml +0 -33
  41. diskcache_rs-0.2.3/.github/workflows/ci.yml +0 -73
  42. diskcache_rs-0.2.3/CHANGELOG.md +0 -82
  43. diskcache_rs-0.2.3/uv.lock +0 -499
  44. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  45. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  46. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/.github/pull_request_template.md +0 -0
  47. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/.gitignore +0 -0
  48. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/LICENSE +0 -0
  49. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/benchmarks/detailed_profiling.py +0 -0
  50. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/benchmarks/high_performance_test.py +0 -0
  51. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/benchmarks/micro_benchmark.py +0 -0
  52. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/benchmarks/performance_comparison.py +0 -0
  53. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/benchmarks/precise_benchmark.py +0 -0
  54. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/benchmarks/set_performance_analysis.py +0 -0
  55. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/docker-compose.test.yml +0 -0
  56. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/examples/basic_usage.py +0 -0
  57. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/python/diskcache_rs/core.py +0 -0
  58. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/python/diskcache_rs/fast_cache.py +0 -0
  59. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/python/diskcache_rs/pickle_cache.py +0 -0
  60. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/python/diskcache_rs/rust_pickle.py +0 -0
  61. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/renovate.json +0 -0
  62. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/scripts/generate_stubs.py +0 -0
  63. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/scripts/test-docker-network.sh +0 -0
  64. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/src/error.rs +0 -0
  65. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/src/eviction.rs +0 -0
  66. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/src/lib.rs +0 -0
  67. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/src/memory_cache.rs +0 -0
  68. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/src/migration.rs +0 -0
  69. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/src/storage/tests.rs +0 -0
  70. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/src/utils.rs +0 -0
  71. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/tests/__init__.py +0 -0
  72. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/tests/benchmark_official.py +0 -0
  73. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/tests/conftest.py +0 -0
  74. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/tests/test_basic_operations.py +0 -0
  75. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/tests/test_ci_benchmark.py +0 -0
  76. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/tests/test_compatibility.py +0 -0
  77. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/tests/test_docker_network.py +0 -0
  78. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/tests/test_fast_cache.py +0 -0
  79. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/tests/test_pickle_cache.py +0 -0
  80. {diskcache_rs-0.2.3 → diskcache_rs-0.4.2}/tests/test_rust_pickle_performance.py +0 -0
@@ -0,0 +1,65 @@
1
+ name: 'Build and Test DiskCache RS'
2
+ description: 'Build the extension and run tests'
3
+ inputs:
4
+ test-type:
5
+ description: 'Type of tests to run (basic, full)'
6
+ required: false
7
+ default: 'basic'
8
+ generate-stubs:
9
+ description: 'Whether to generate type stubs'
10
+ required: false
11
+ default: 'false'
12
+ upload-artifacts:
13
+ description: 'Whether to upload test artifacts'
14
+ required: false
15
+ default: 'false'
16
+ artifact-name:
17
+ description: 'Name for uploaded artifacts'
18
+ required: false
19
+ default: 'test-results'
20
+
21
+ runs:
22
+ using: 'composite'
23
+ steps:
24
+ - name: Build extension
25
+ shell: bash
26
+ run: uv run --with maturin maturin develop
27
+ env:
28
+ RUST_BACKTRACE: 1
29
+
30
+ - name: Generate type stubs
31
+ if: inputs.generate-stubs == 'true'
32
+ shell: bash
33
+ run: |
34
+ uv run pyo3-stubgen diskcache_rs._diskcache_rs python/diskcache_rs/
35
+ echo "✅ Type stubs generated successfully"
36
+
37
+ - name: Run basic tests
38
+ if: inputs.test-type == 'basic'
39
+ shell: bash
40
+ run: uv run python -m pytest tests/ -v --tb=short -m "not docker and not slow"
41
+ env:
42
+ PYTHONUNBUFFERED: 1
43
+
44
+ - name: Run full tests
45
+ if: inputs.test-type == 'full'
46
+ shell: bash
47
+ run: uv run python -m pytest tests/ -v --tb=short -m "not docker"
48
+ env:
49
+ PYTHONUNBUFFERED: 1
50
+
51
+ - name: Verify import
52
+ shell: bash
53
+ run: |
54
+ uv run python -c 'import diskcache_rs; print(f"✅ diskcache_rs v{diskcache_rs.__version__} imported successfully")'
55
+
56
+ - name: Upload test artifacts
57
+ if: inputs.upload-artifacts == 'true' && always()
58
+ uses: actions/upload-artifact@v5
59
+ with:
60
+ name: ${{ inputs.artifact-name }}
61
+ path: |
62
+ .coverage
63
+ htmlcov/
64
+ test-results/
65
+ retention-days: 7
@@ -0,0 +1,46 @@
1
+ name: 'Setup DiskCache RS Environment'
2
+ description: 'Setup Python, Rust, and dependencies for DiskCache RS'
3
+ inputs:
4
+ python-version:
5
+ description: 'Python version to use'
6
+ required: true
7
+ default: '3.11'
8
+ rust-components:
9
+ description: 'Rust components to install (comma-separated)'
10
+ required: false
11
+ default: ''
12
+ cache-key-suffix:
13
+ description: 'Suffix for cache key'
14
+ required: false
15
+ default: 'default'
16
+
17
+ runs:
18
+ using: 'composite'
19
+ steps:
20
+ - name: Install uv
21
+ uses: astral-sh/setup-uv@v7
22
+ with:
23
+ python-version: ${{ inputs.python-version }}
24
+
25
+ - name: Setup Rust
26
+ uses: dtolnay/rust-toolchain@stable
27
+ with:
28
+ components: ${{ inputs.rust-components }}
29
+
30
+ - name: Cache Rust dependencies
31
+ uses: actions/cache@v4
32
+ with:
33
+ path: |
34
+ ~/.cargo/bin/
35
+ ~/.cargo/registry/index/
36
+ ~/.cargo/registry/cache/
37
+ ~/.cargo/git/db/
38
+ target/
39
+ key: ${{ runner.os }}-cargo-${{ inputs.cache-key-suffix }}-${{ hashFiles('**/Cargo.lock') }}
40
+ restore-keys: |
41
+ ${{ runner.os }}-cargo-${{ inputs.cache-key-suffix }}-
42
+ ${{ runner.os }}-cargo-
43
+
44
+ - name: Install Python dependencies
45
+ shell: bash
46
+ run: uv sync --group dev
@@ -21,19 +21,19 @@ jobs:
21
21
  name: Performance Comparison
22
22
  runs-on: ubuntu-latest
23
23
  steps:
24
- - uses: actions/checkout@v4
24
+ - uses: actions/checkout@v6
25
25
  with:
26
26
  fetch-depth: 0
27
27
 
28
- - uses: actions/setup-python@v5
28
+ - uses: actions/setup-python@v6
29
29
  with:
30
- python-version: '3.13'
30
+ python-version: '3.14'
31
31
 
32
32
  - name: Install Rust
33
33
  uses: dtolnay/rust-toolchain@stable
34
34
 
35
35
  - name: Install uv
36
- uses: astral-sh/setup-uv@v6
36
+ uses: astral-sh/setup-uv@v7
37
37
 
38
38
  - name: Install dependencies
39
39
  run: |
@@ -55,7 +55,7 @@ jobs:
55
55
  uv run python tests/benchmark_official.py -n 1000
56
56
 
57
57
  - name: Upload benchmark results
58
- uses: actions/upload-artifact@v4
58
+ uses: actions/upload-artifact@v5
59
59
  with:
60
60
  name: benchmark-results-${{ github.sha }}
61
61
  path: benchmark_results.json
@@ -63,7 +63,7 @@ jobs:
63
63
 
64
64
  - name: Comment PR with benchmark results
65
65
  if: github.event_name == 'pull_request'
66
- uses: actions/github-script@v7
66
+ uses: actions/github-script@v8
67
67
  with:
68
68
  script: |
69
69
  const fs = require('fs');
@@ -113,5 +113,3 @@ jobs:
113
113
  } catch (error) {
114
114
  console.error('Failed to post benchmark results:', error);
115
115
  }
116
-
117
-
@@ -19,10 +19,10 @@ jobs:
19
19
  matrix:
20
20
  target: [x86_64, i686]
21
21
  steps:
22
- - uses: actions/checkout@v4
23
- - uses: actions/setup-python@v5
22
+ - uses: actions/checkout@v6
23
+ - uses: actions/setup-python@v6
24
24
  with:
25
- python-version: '3.13'
25
+ python-version: '3.14'
26
26
  architecture: x64
27
27
  - name: Build ABI3 wheels
28
28
  uses: PyO3/maturin-action@v1
@@ -37,7 +37,7 @@ jobs:
37
37
  pip install diskcache_rs --find-links dist --force-reinstall
38
38
  python -c "import diskcache_rs; print('diskcache_rs imported successfully')"
39
39
  - name: Upload wheels
40
- uses: actions/upload-artifact@v4
40
+ uses: actions/upload-artifact@v5
41
41
  with:
42
42
  name: wheels-linux-abi3-${{ matrix.target }}
43
43
  path: dist
@@ -49,10 +49,10 @@ jobs:
49
49
  matrix:
50
50
  target: [x64, x86]
51
51
  steps:
52
- - uses: actions/checkout@v4
53
- - uses: actions/setup-python@v5
52
+ - uses: actions/checkout@v6
53
+ - uses: actions/setup-python@v6
54
54
  with:
55
- python-version: '3.13'
55
+ python-version: '3.14'
56
56
  architecture: ${{ matrix.target }}
57
57
  - name: Build ABI3 wheels
58
58
  uses: PyO3/maturin-action@v1
@@ -66,7 +66,7 @@ jobs:
66
66
  pip install diskcache_rs --find-links dist --force-reinstall
67
67
  python -c "import diskcache_rs; print('diskcache_rs imported successfully')"
68
68
  - name: Upload wheels
69
- uses: actions/upload-artifact@v4
69
+ uses: actions/upload-artifact@v5
70
70
  with:
71
71
  name: wheels-windows-abi3-${{ matrix.target }}
72
72
  path: dist
@@ -78,10 +78,10 @@ jobs:
78
78
  matrix:
79
79
  target: [x86_64, aarch64]
80
80
  steps:
81
- - uses: actions/checkout@v4
82
- - uses: actions/setup-python@v5
81
+ - uses: actions/checkout@v6
82
+ - uses: actions/setup-python@v6
83
83
  with:
84
- python-version: '3.13'
84
+ python-version: '3.14'
85
85
  architecture: x64
86
86
  - name: Build ABI3 wheels
87
87
  uses: PyO3/maturin-action@v1
@@ -95,7 +95,7 @@ jobs:
95
95
  pip install diskcache_rs --find-links dist --force-reinstall
96
96
  python -c "import diskcache_rs; print('diskcache_rs imported successfully')"
97
97
  - name: Upload wheels
98
- uses: actions/upload-artifact@v4
98
+ uses: actions/upload-artifact@v5
99
99
  with:
100
100
  name: wheels-macos-abi3-${{ matrix.target }}
101
101
  path: dist
@@ -104,14 +104,14 @@ jobs:
104
104
  sdist-abi3:
105
105
  runs-on: ubuntu-latest
106
106
  steps:
107
- - uses: actions/checkout@v4
107
+ - uses: actions/checkout@v6
108
108
  - name: Build sdist
109
109
  uses: PyO3/maturin-action@v1
110
110
  with:
111
111
  command: sdist
112
112
  args: --out dist
113
113
  - name: Upload sdist
114
- uses: actions/upload-artifact@v4
114
+ uses: actions/upload-artifact@v5
115
115
  with:
116
116
  name: wheels-sdist-abi3
117
117
  path: dist
@@ -22,10 +22,10 @@ jobs:
22
22
  matrix:
23
23
  target: [x86_64, i686]
24
24
  steps:
25
- - uses: actions/checkout@v4
26
- - uses: actions/setup-python@v5
25
+ - uses: actions/checkout@v6
26
+ - uses: actions/setup-python@v6
27
27
  with:
28
- python-version: '3.13'
28
+ python-version: '3.14'
29
29
  architecture: x64
30
30
  - name: Build wheels
31
31
  uses: PyO3/maturin-action@v1
@@ -40,7 +40,7 @@ jobs:
40
40
  pip install diskcache_rs --find-links dist --force-reinstall
41
41
  python -c "import diskcache_rs; print('diskcache_rs imported successfully')"
42
42
  - name: Upload wheels
43
- uses: actions/upload-artifact@v4
43
+ uses: actions/upload-artifact@v5
44
44
  with:
45
45
  name: wheels-linux-${{ matrix.target }}
46
46
  path: dist
@@ -52,10 +52,10 @@ jobs:
52
52
  matrix:
53
53
  target: [aarch64, armv7]
54
54
  steps:
55
- - uses: actions/checkout@v4
56
- - uses: actions/setup-python@v5
55
+ - uses: actions/checkout@v6
56
+ - uses: actions/setup-python@v6
57
57
  with:
58
- python-version: '3.13'
58
+ python-version: '3.14'
59
59
  - name: Build wheels
60
60
  uses: PyO3/maturin-action@v1
61
61
  with:
@@ -79,7 +79,7 @@ jobs:
79
79
  uv pip install diskcache_rs --find-links dist/ --force-reinstall --system
80
80
  python3 -c "import diskcache_rs; print('diskcache_rs imported successfully')"
81
81
  - name: Upload wheels
82
- uses: actions/upload-artifact@v4
82
+ uses: actions/upload-artifact@v5
83
83
  with:
84
84
  name: wheels-linux-cross-${{ matrix.target }}
85
85
  path: dist
@@ -93,10 +93,10 @@ jobs:
93
93
  - x86_64-unknown-linux-musl
94
94
  - i686-unknown-linux-musl
95
95
  steps:
96
- - uses: actions/checkout@v4
97
- - uses: actions/setup-python@v5
96
+ - uses: actions/checkout@v6
97
+ - uses: actions/setup-python@v6
98
98
  with:
99
- python-version: '3.13'
99
+ python-version: '3.14'
100
100
  architecture: x64
101
101
  - name: Build wheels
102
102
  uses: PyO3/maturin-action@v1
@@ -125,7 +125,7 @@ jobs:
125
125
  fi
126
126
  python3 -c "import diskcache_rs; print('diskcache_rs imported successfully')"
127
127
  - name: Upload wheels
128
- uses: actions/upload-artifact@v4
128
+ uses: actions/upload-artifact@v5
129
129
  with:
130
130
  name: wheels-musllinux-${{ matrix.target }}
131
131
  path: dist
@@ -141,10 +141,10 @@ jobs:
141
141
  - target: armv7-unknown-linux-musleabihf
142
142
  arch: armv7
143
143
  steps:
144
- - uses: actions/checkout@v4
145
- - uses: actions/setup-python@v5
144
+ - uses: actions/checkout@v6
145
+ - uses: actions/setup-python@v6
146
146
  with:
147
- python-version: '3.13'
147
+ python-version: '3.14'
148
148
  - name: Build wheels
149
149
  uses: PyO3/maturin-action@v1
150
150
  with:
@@ -173,7 +173,7 @@ jobs:
173
173
  fi
174
174
  python3 -c "import diskcache_rs; print('diskcache_rs imported successfully')"
175
175
  - name: Upload wheels
176
- uses: actions/upload-artifact@v4
176
+ uses: actions/upload-artifact@v5
177
177
  with:
178
178
  name: wheels-musllinux-cross-${{ matrix.platform.target }}
179
179
  path: dist
@@ -185,10 +185,10 @@ jobs:
185
185
  matrix:
186
186
  target: [x64, x86]
187
187
  steps:
188
- - uses: actions/checkout@v4
189
- - uses: actions/setup-python@v5
188
+ - uses: actions/checkout@v6
189
+ - uses: actions/setup-python@v6
190
190
  with:
191
- python-version: '3.13'
191
+ python-version: '3.14'
192
192
  architecture: ${{ matrix.target }}
193
193
  - uses: dtolnay/rust-toolchain@stable
194
194
  - name: Build wheels
@@ -202,7 +202,7 @@ jobs:
202
202
  pip install diskcache_rs --find-links dist --force-reinstall
203
203
  python -c "import diskcache_rs; print('diskcache_rs imported successfully')"
204
204
  - name: Upload wheels
205
- uses: actions/upload-artifact@v4
205
+ uses: actions/upload-artifact@v5
206
206
  with:
207
207
  name: wheels-windows-${{ matrix.target }}
208
208
  path: dist
@@ -211,10 +211,10 @@ jobs:
211
211
  macos:
212
212
  runs-on: macos-latest
213
213
  steps:
214
- - uses: actions/checkout@v4
215
- - uses: actions/setup-python@v5
214
+ - uses: actions/checkout@v6
215
+ - uses: actions/setup-python@v6
216
216
  with:
217
- python-version: '3.13'
217
+ python-version: '3.14'
218
218
  architecture: x64
219
219
  - uses: dtolnay/rust-toolchain@stable
220
220
  - name: Build wheels - x86_64
@@ -238,7 +238,7 @@ jobs:
238
238
  pip install diskcache_rs --find-links dist --force-reinstall
239
239
  python -c "import diskcache_rs; print('diskcache_rs imported successfully')"
240
240
  - name: Upload wheels
241
- uses: actions/upload-artifact@v4
241
+ uses: actions/upload-artifact@v5
242
242
  with:
243
243
  name: wheels-macos
244
244
  path: dist
@@ -0,0 +1,110 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ workflow_dispatch:
9
+ workflow_call:
10
+
11
+ permissions:
12
+ contents: read
13
+
14
+ jobs:
15
+ # Quick validation - runs on every PR
16
+ quick-test:
17
+ name: Quick Test (Python ${{ matrix.python-version }})
18
+ runs-on: ubuntu-latest
19
+ strategy:
20
+ fail-fast: false
21
+ matrix:
22
+ python-version: ["3.8", "3.10", "3.12"] # Test min, stable, and recent
23
+
24
+ steps:
25
+ - uses: actions/checkout@v6
26
+
27
+ - name: Setup DiskCache RS Environment
28
+ uses: ./.github/actions/setup-diskcache-rs
29
+ with:
30
+ python-version: ${{ matrix.python-version }}
31
+ cache-key-suffix: 'quick-test'
32
+
33
+ - name: Build and Test
34
+ uses: ./.github/actions/build-and-test
35
+ with:
36
+ test-type: 'basic'
37
+ generate-stubs: 'true'
38
+
39
+ # Comprehensive testing - runs on main branch
40
+ full-test:
41
+ name: Full Test Suite (${{ matrix.os }}, Python ${{ matrix.python-version }})
42
+ runs-on: ${{ matrix.os }}
43
+ if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
44
+ strategy:
45
+ fail-fast: false
46
+ matrix:
47
+ os: [ubuntu-latest, windows-latest, macos-latest]
48
+ python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
49
+
50
+ steps:
51
+ - uses: actions/checkout@v6
52
+
53
+ - name: Setup DiskCache RS Environment
54
+ uses: ./.github/actions/setup-diskcache-rs
55
+ with:
56
+ python-version: ${{ matrix.python-version }}
57
+ cache-key-suffix: 'full-test-${{ matrix.os }}'
58
+
59
+ - name: Build and Test
60
+ uses: ./.github/actions/build-and-test
61
+ with:
62
+ test-type: 'full'
63
+ upload-artifacts: 'true'
64
+ artifact-name: 'full-test-results-${{ matrix.os }}-py${{ matrix.python-version }}'
65
+
66
+ # Code formatting and linting
67
+ lint:
68
+ name: Code Quality
69
+ runs-on: ubuntu-latest
70
+ steps:
71
+ - uses: actions/checkout@v6
72
+
73
+ - name: Setup DiskCache RS Environment
74
+ uses: ./.github/actions/setup-diskcache-rs
75
+ with:
76
+ python-version: "3.11"
77
+ rust-components: 'rustfmt,clippy'
78
+ cache-key-suffix: 'lint'
79
+
80
+ - name: Check Rust formatting
81
+ run: cargo fmt --all -- --check
82
+
83
+ - name: Run Clippy
84
+ run: cargo clippy --all-targets --all-features -- -D warnings
85
+
86
+ - name: Run ruff check
87
+ run: uv run ruff check .
88
+
89
+ - name: Run ruff format check
90
+ run: uv run ruff format --check .
91
+
92
+ # Overall CI status check
93
+ ci-success:
94
+ name: CI Success
95
+ runs-on: ubuntu-latest
96
+ needs: [quick-test, lint]
97
+ if: always()
98
+
99
+ steps:
100
+ - name: Check all required jobs
101
+ run: |
102
+ if [[ "${{ needs.quick-test.result }}" != "success" ]]; then
103
+ echo "❌ Quick tests failed"
104
+ exit 1
105
+ fi
106
+ if [[ "${{ needs.lint.result }}" != "success" ]]; then
107
+ echo "❌ Linting failed"
108
+ exit 1
109
+ fi
110
+ echo "✅ All required CI checks passed"
@@ -1,44 +1,75 @@
1
1
  name: Release
2
2
 
3
+ # This workflow handles both release-please automation and publishing
4
+ # It creates releases when changes are pushed to main, and publishes to PyPI
5
+
3
6
  on:
4
7
  push:
8
+ branches:
9
+ - main
5
10
  tags:
6
11
  - 'v*'
7
12
  - 'diskcache_rs-v*' # Support release-please tag format
8
13
  workflow_dispatch:
9
- workflow_call:
10
14
 
11
15
  permissions:
12
16
  contents: write # Required for creating releases and uploading artifacts
17
+ pull-requests: write # Required for release-please
18
+ issues: write # Required for release-please
13
19
  id-token: write # Required for PyPI trusted publishing
14
20
  attestations: write # Required for artifact attestation
15
21
 
16
22
  jobs:
17
- # Call the build workflow to build standard wheels
23
+ # First job: Run release-please to create releases and tags
24
+ release-please:
25
+ runs-on: ubuntu-latest
26
+ outputs:
27
+ release_created: ${{ steps.release.outputs.release_created }}
28
+ tag_name: ${{ steps.release.outputs.tag_name }}
29
+ releases_created: ${{ steps.release.outputs.releases_created }}
30
+ steps:
31
+ - uses: googleapis/release-please-action@v4
32
+ id: release
33
+ with:
34
+ token: ${{ secrets.GITHUB_TOKEN }}
35
+ config-file: release-please-config.json
36
+ manifest-file: .release-please-manifest.json
37
+ # Call the build workflow to build standard wheels (only if release was created)
18
38
  build:
39
+ needs: release-please
40
+ if: ${{ needs.release-please.outputs.release_created }}
19
41
  uses: ./.github/workflows/build.yml
20
42
  permissions:
21
43
  contents: read
22
44
  actions: write # Required for uploading artifacts
45
+ id-token: write # Required for artifact attestation
23
46
 
24
- # Call the ABI3 build workflow to build universal wheels
47
+ # Call the ABI3 build workflow to build universal wheels (only if release was created)
25
48
  build-abi3:
49
+ needs: release-please
50
+ if: ${{ needs.release-please.outputs.release_created }}
26
51
  uses: ./.github/workflows/build-abi3.yml
27
52
  permissions:
28
53
  contents: read
29
54
  actions: write # Required for uploading artifacts
55
+ id-token: write # Required for artifact attestation
30
56
 
31
- # Call the CI workflow to run tests
57
+ # Call the CI workflow to run tests (only if release was created)
32
58
  test:
59
+ needs: release-please
60
+ if: ${{ needs.release-please.outputs.release_created }}
33
61
  uses: ./.github/workflows/ci.yml
34
62
  permissions:
35
63
  contents: read
36
64
 
37
- # Publish to PyPI
38
- release:
65
+ # Publish to PyPI - only depends on builds, not tests (tests should pass in PR)
66
+ pypi-publish:
39
67
  name: Publish to PyPI
40
68
  runs-on: ubuntu-latest
41
- needs: [build, build-abi3, test]
69
+ needs: [build, build-abi3]
70
+ environment:
71
+ name: pypi
72
+ url: https://pypi.org/p/diskcache_rs
42
73
  permissions:
43
74
  # IMPORTANT: this permission is mandatory for trusted publishing
44
75
  id-token: write
@@ -46,12 +77,10 @@ jobs:
46
77
  contents: write
47
78
  # Used to generate artifact attestation
48
79
  attestations: write
49
- environment:
50
- name: pypi
51
- url: https://pypi.org/p/diskcache_rs
80
+
52
81
  steps:
53
82
  - name: Download all artifacts
54
- uses: actions/download-artifact@v4
83
+ uses: actions/download-artifact@v6
55
84
  with:
56
85
  path: dist
57
86
  merge-multiple: true
@@ -62,26 +91,31 @@ jobs:
62
91
  echo "Total files: $(ls -1 dist/ | wc -l)"
63
92
 
64
93
  - name: Generate artifact attestation
65
- uses: actions/attest-build-provenance@v2
94
+ uses: actions/attest-build-provenance@v3
66
95
  with:
67
96
  subject-path: 'dist/*'
68
97
 
69
98
  - name: Publish to PyPI
70
99
  uses: pypa/gh-action-pypi-publish@release/v1
71
100
  with:
72
- packages-dir: dist/
101
+ packages-dir: dist
102
+ verbose: true
103
+ print-hash: true
104
+ skip-existing: true # Skip files that already exist on PyPI
73
105
 
74
106
  # Create GitHub Release
75
107
  github-release:
76
108
  name: Create GitHub Release
77
109
  runs-on: ubuntu-latest
78
- needs: [release]
110
+ needs: [release-please, pypi-publish]
111
+ if: ${{ needs.release-please.outputs.release_created }}
79
112
  permissions:
80
113
  contents: write # Required for creating releases
81
114
  actions: read # Required for downloading artifacts
82
115
  attestations: write # Required for artifact attestation
116
+
83
117
  steps:
84
- - uses: actions/checkout@v4
118
+ - uses: actions/checkout@v6
85
119
  with:
86
120
  fetch-depth: 0
87
121
 
@@ -90,31 +124,43 @@ jobs:
90
124
  uses: jaywcjlove/changelog-generator@main
91
125
  with:
92
126
  token: ${{ secrets.GITHUB_TOKEN }}
93
- filter-author: (loonghao|renovate\[bot\]|dependabot\[bot\]|Renovate Bot)
94
- filter: '[R|r]elease[d]\s+[v|V]\d(\.\d+){0,2}'
127
+ filter-author: (loonghao|renovate\\[bot\\]|dependabot\\[bot\\]|Renovate Bot)
128
+ filter: ''
95
129
  template: |
96
130
  ## Bugs
97
131
  {{fix}}
132
+
98
133
  ## Feature
99
134
  {{feat}}
135
+
100
136
  ## Improve
101
137
  {{refactor,perf,clean}}
138
+
102
139
  ## Misc
103
- {{chore,style,ci}} 🔧 Nothing change}}
140
+ {{chore,style,ci,build||🔧 Nothing changed}}
141
+
104
142
  ## Unknown
105
143
  {{__unknown__}}
106
144
 
107
145
  - name: Download all artifacts
108
- uses: actions/download-artifact@v4
146
+ uses: actions/download-artifact@v6
109
147
  with:
110
148
  path: release-artifacts
111
149
  merge-multiple: true
112
150
 
113
- - uses: ncipollo/release-action@v1
151
+ - name: Create GitHub Release
152
+ uses: ncipollo/release-action@v1
114
153
  with:
115
154
  artifacts: "release-artifacts/*"
116
155
  token: ${{ secrets.GITHUB_TOKEN }}
156
+ tag: ${{ needs.release-please.outputs.tag_name }}
157
+ name: ${{ needs.release-please.outputs.tag_name }}
117
158
  body: |
118
159
  Comparing Changes: ${{ steps.changelog.outputs.compareurl }}
119
160
 
120
161
  ${{ steps.changelog.outputs.changelog }}
162
+ draft: false
163
+ prerelease: false
164
+ allowUpdates: true
165
+ skipIfReleaseExists: false
166
+ updateOnlyUnreleased: false