diskcache-rs 0.2.1__tar.gz → 0.4.0__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.2.1 → diskcache_rs-0.4.0}/.cz.toml +1 -1
  2. diskcache_rs-0.4.0/.github/actions/build-and-test/action.yml +65 -0
  3. diskcache_rs-0.4.0/.github/actions/setup-diskcache-rs/action.yml +46 -0
  4. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/.github/workflows/benchmark.yml +4 -6
  5. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/.github/workflows/build-abi3.yml +8 -7
  6. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/.github/workflows/build.yml +13 -12
  7. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/.github/workflows/bump-version.yml +11 -3
  8. diskcache_rs-0.4.0/.github/workflows/ci.yml +110 -0
  9. diskcache_rs-0.4.0/.github/workflows/release.yml +166 -0
  10. diskcache_rs-0.4.0/.pre-commit-config.yaml +53 -0
  11. diskcache_rs-0.4.0/.release-please-manifest.json +3 -0
  12. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/CHANGELOG.md +64 -0
  13. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/Cargo.lock +198 -230
  14. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/Cargo.toml +14 -8
  15. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/Dockerfile.test +1 -1
  16. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/PKG-INFO +3 -2
  17. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/benchmarks/comprehensive_performance_test.py +34 -34
  18. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/benchmarks/final_performance_comparison.py +42 -42
  19. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/benchmarks/memory_usage_test.py +49 -49
  20. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/benchmarks/optimization_validation_test.py +65 -65
  21. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/justfile +1 -1
  22. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/pyproject.toml +8 -3
  23. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/python/diskcache_rs/__init__.py +12 -1
  24. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/python/diskcache_rs/__init__.pyi +82 -30
  25. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/python/diskcache_rs/_diskcache_rs.pyi +71 -14
  26. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/python/diskcache_rs/cache.py +31 -5
  27. diskcache_rs-0.4.0/release-please-config.json +40 -0
  28. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/scripts/sync_version.py +7 -7
  29. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/src/cache.rs +81 -10
  30. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/src/pickle_cache.rs +4 -4
  31. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/src/serialization.rs +2 -0
  32. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/src/storage/optimized_backend.rs +369 -15
  33. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/src/storage.rs +3 -0
  34. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/tests/test_cross_platform_network.py +4 -0
  35. diskcache_rs-0.4.0/tests/test_issue_17_configurable_threshold.py +155 -0
  36. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/tests/test_network_filesystem.py +4 -0
  37. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/tests/test_performance.py +19 -16
  38. diskcache_rs-0.4.0/tests/test_version_and_disk_threshold.py +346 -0
  39. diskcache_rs-0.4.0/uv.lock +802 -0
  40. diskcache_rs-0.2.1/.github/workflows/ci.yml +0 -73
  41. diskcache_rs-0.2.1/.github/workflows/release.yml +0 -134
  42. diskcache_rs-0.2.1/uv.lock +0 -499
  43. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  44. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  45. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/.github/pull_request_template.md +0 -0
  46. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/.gitignore +0 -0
  47. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/LICENSE +0 -0
  48. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/README.md +0 -0
  49. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/benchmarks/detailed_profiling.py +0 -0
  50. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/benchmarks/high_performance_test.py +0 -0
  51. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/benchmarks/micro_benchmark.py +0 -0
  52. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/benchmarks/performance_comparison.py +0 -0
  53. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/benchmarks/precise_benchmark.py +0 -0
  54. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/benchmarks/set_performance_analysis.py +0 -0
  55. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/docker-compose.test.yml +0 -0
  56. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/examples/basic_usage.py +0 -0
  57. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/python/diskcache_rs/core.py +0 -0
  58. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/python/diskcache_rs/fast_cache.py +0 -0
  59. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/python/diskcache_rs/pickle_cache.py +0 -0
  60. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/python/diskcache_rs/rust_pickle.py +0 -0
  61. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/renovate.json +0 -0
  62. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/scripts/generate_stubs.py +0 -0
  63. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/scripts/test-docker-network.sh +0 -0
  64. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/src/error.rs +0 -0
  65. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/src/eviction.rs +0 -0
  66. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/src/lib.rs +0 -0
  67. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/src/memory_cache.rs +0 -0
  68. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/src/migration.rs +0 -0
  69. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/src/storage/tests.rs +0 -0
  70. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/src/utils.rs +0 -0
  71. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/tests/__init__.py +0 -0
  72. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/tests/benchmark_official.py +0 -0
  73. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/tests/conftest.py +0 -0
  74. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/tests/test_basic_operations.py +0 -0
  75. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/tests/test_ci_benchmark.py +0 -0
  76. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/tests/test_compatibility.py +0 -0
  77. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/tests/test_docker_network.py +0 -0
  78. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/tests/test_fast_cache.py +0 -0
  79. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/tests/test_pickle_cache.py +0 -0
  80. {diskcache_rs-0.2.1 → diskcache_rs-0.4.0}/tests/test_rust_pickle_performance.py +0 -0
@@ -1,6 +1,6 @@
1
1
  [tool.commitizen]
2
2
  name = "cz_conventional_commits"
3
- version = "0.2.1"
3
+ version = "0.4.0"
4
4
  tag_format = "v$version"
5
5
  update_changelog_on_bump = true
6
6
  major_version_zero = true
@@ -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
@@ -27,13 +27,13 @@ jobs:
27
27
 
28
28
  - uses: actions/setup-python@v5
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
-
@@ -9,6 +9,7 @@ on:
9
9
 
10
10
  permissions:
11
11
  contents: read
12
+ actions: write # Required for uploading artifacts
12
13
 
13
14
  jobs:
14
15
  # Linux ABI3 builds
@@ -21,7 +22,7 @@ jobs:
21
22
  - uses: actions/checkout@v4
22
23
  - uses: actions/setup-python@v5
23
24
  with:
24
- python-version: '3.13'
25
+ python-version: '3.14'
25
26
  architecture: x64
26
27
  - name: Build ABI3 wheels
27
28
  uses: PyO3/maturin-action@v1
@@ -36,7 +37,7 @@ jobs:
36
37
  pip install diskcache_rs --find-links dist --force-reinstall
37
38
  python -c "import diskcache_rs; print('diskcache_rs imported successfully')"
38
39
  - name: Upload wheels
39
- uses: actions/upload-artifact@v4
40
+ uses: actions/upload-artifact@v5
40
41
  with:
41
42
  name: wheels-linux-abi3-${{ matrix.target }}
42
43
  path: dist
@@ -51,7 +52,7 @@ jobs:
51
52
  - uses: actions/checkout@v4
52
53
  - uses: actions/setup-python@v5
53
54
  with:
54
- python-version: '3.13'
55
+ python-version: '3.14'
55
56
  architecture: ${{ matrix.target }}
56
57
  - name: Build ABI3 wheels
57
58
  uses: PyO3/maturin-action@v1
@@ -65,7 +66,7 @@ jobs:
65
66
  pip install diskcache_rs --find-links dist --force-reinstall
66
67
  python -c "import diskcache_rs; print('diskcache_rs imported successfully')"
67
68
  - name: Upload wheels
68
- uses: actions/upload-artifact@v4
69
+ uses: actions/upload-artifact@v5
69
70
  with:
70
71
  name: wheels-windows-abi3-${{ matrix.target }}
71
72
  path: dist
@@ -80,7 +81,7 @@ jobs:
80
81
  - uses: actions/checkout@v4
81
82
  - uses: actions/setup-python@v5
82
83
  with:
83
- python-version: '3.13'
84
+ python-version: '3.14'
84
85
  architecture: x64
85
86
  - name: Build ABI3 wheels
86
87
  uses: PyO3/maturin-action@v1
@@ -94,7 +95,7 @@ jobs:
94
95
  pip install diskcache_rs --find-links dist --force-reinstall
95
96
  python -c "import diskcache_rs; print('diskcache_rs imported successfully')"
96
97
  - name: Upload wheels
97
- uses: actions/upload-artifact@v4
98
+ uses: actions/upload-artifact@v5
98
99
  with:
99
100
  name: wheels-macos-abi3-${{ matrix.target }}
100
101
  path: dist
@@ -110,7 +111,7 @@ jobs:
110
111
  command: sdist
111
112
  args: --out dist
112
113
  - name: Upload sdist
113
- uses: actions/upload-artifact@v4
114
+ uses: actions/upload-artifact@v5
114
115
  with:
115
116
  name: wheels-sdist-abi3
116
117
  path: dist
@@ -12,6 +12,7 @@ on:
12
12
 
13
13
  permissions:
14
14
  contents: read
15
+ actions: write # Required for uploading artifacts
15
16
 
16
17
  jobs:
17
18
  # Linux builds
@@ -24,7 +25,7 @@ jobs:
24
25
  - uses: actions/checkout@v4
25
26
  - uses: actions/setup-python@v5
26
27
  with:
27
- python-version: '3.13'
28
+ python-version: '3.14'
28
29
  architecture: x64
29
30
  - name: Build wheels
30
31
  uses: PyO3/maturin-action@v1
@@ -39,7 +40,7 @@ jobs:
39
40
  pip install diskcache_rs --find-links dist --force-reinstall
40
41
  python -c "import diskcache_rs; print('diskcache_rs imported successfully')"
41
42
  - name: Upload wheels
42
- uses: actions/upload-artifact@v4
43
+ uses: actions/upload-artifact@v5
43
44
  with:
44
45
  name: wheels-linux-${{ matrix.target }}
45
46
  path: dist
@@ -54,7 +55,7 @@ jobs:
54
55
  - uses: actions/checkout@v4
55
56
  - uses: actions/setup-python@v5
56
57
  with:
57
- python-version: '3.13'
58
+ python-version: '3.14'
58
59
  - name: Build wheels
59
60
  uses: PyO3/maturin-action@v1
60
61
  with:
@@ -78,7 +79,7 @@ jobs:
78
79
  uv pip install diskcache_rs --find-links dist/ --force-reinstall --system
79
80
  python3 -c "import diskcache_rs; print('diskcache_rs imported successfully')"
80
81
  - name: Upload wheels
81
- uses: actions/upload-artifact@v4
82
+ uses: actions/upload-artifact@v5
82
83
  with:
83
84
  name: wheels-linux-cross-${{ matrix.target }}
84
85
  path: dist
@@ -95,7 +96,7 @@ jobs:
95
96
  - uses: actions/checkout@v4
96
97
  - uses: actions/setup-python@v5
97
98
  with:
98
- python-version: '3.13'
99
+ python-version: '3.14'
99
100
  architecture: x64
100
101
  - name: Build wheels
101
102
  uses: PyO3/maturin-action@v1
@@ -124,7 +125,7 @@ jobs:
124
125
  fi
125
126
  python3 -c "import diskcache_rs; print('diskcache_rs imported successfully')"
126
127
  - name: Upload wheels
127
- uses: actions/upload-artifact@v4
128
+ uses: actions/upload-artifact@v5
128
129
  with:
129
130
  name: wheels-musllinux-${{ matrix.target }}
130
131
  path: dist
@@ -143,7 +144,7 @@ jobs:
143
144
  - uses: actions/checkout@v4
144
145
  - uses: actions/setup-python@v5
145
146
  with:
146
- python-version: '3.13'
147
+ python-version: '3.14'
147
148
  - name: Build wheels
148
149
  uses: PyO3/maturin-action@v1
149
150
  with:
@@ -172,7 +173,7 @@ jobs:
172
173
  fi
173
174
  python3 -c "import diskcache_rs; print('diskcache_rs imported successfully')"
174
175
  - name: Upload wheels
175
- uses: actions/upload-artifact@v4
176
+ uses: actions/upload-artifact@v5
176
177
  with:
177
178
  name: wheels-musllinux-cross-${{ matrix.platform.target }}
178
179
  path: dist
@@ -187,7 +188,7 @@ jobs:
187
188
  - uses: actions/checkout@v4
188
189
  - uses: actions/setup-python@v5
189
190
  with:
190
- python-version: '3.13'
191
+ python-version: '3.14'
191
192
  architecture: ${{ matrix.target }}
192
193
  - uses: dtolnay/rust-toolchain@stable
193
194
  - name: Build wheels
@@ -201,7 +202,7 @@ jobs:
201
202
  pip install diskcache_rs --find-links dist --force-reinstall
202
203
  python -c "import diskcache_rs; print('diskcache_rs imported successfully')"
203
204
  - name: Upload wheels
204
- uses: actions/upload-artifact@v4
205
+ uses: actions/upload-artifact@v5
205
206
  with:
206
207
  name: wheels-windows-${{ matrix.target }}
207
208
  path: dist
@@ -213,7 +214,7 @@ jobs:
213
214
  - uses: actions/checkout@v4
214
215
  - uses: actions/setup-python@v5
215
216
  with:
216
- python-version: '3.13'
217
+ python-version: '3.14'
217
218
  architecture: x64
218
219
  - uses: dtolnay/rust-toolchain@stable
219
220
  - name: Build wheels - x86_64
@@ -237,7 +238,7 @@ jobs:
237
238
  pip install diskcache_rs --find-links dist --force-reinstall
238
239
  python -c "import diskcache_rs; print('diskcache_rs imported successfully')"
239
240
  - name: Upload wheels
240
- uses: actions/upload-artifact@v4
241
+ uses: actions/upload-artifact@v5
241
242
  with:
242
243
  name: wheels-macos
243
244
  path: dist
@@ -4,9 +4,12 @@ on:
4
4
  push:
5
5
  branches:
6
6
  - main
7
+
7
8
  permissions:
8
- contents: write
9
- pull-requests: write
9
+ contents: write # Required for: modify files, create tags, create releases
10
+ pull-requests: write # Optional: for automated PR operations
11
+ actions: write # Optional: for triggering other workflows
12
+
10
13
  jobs:
11
14
  bump-version:
12
15
  if: "!startsWith(github.event.head_commit.message, 'bump:')"
@@ -14,12 +17,17 @@ jobs:
14
17
  name: "Bump version and create changelog with commitizen"
15
18
  steps:
16
19
  - name: Check out
17
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
20
+ uses: actions/checkout@v4
18
21
  with:
19
22
  fetch-depth: 0
20
23
  token: '${{ secrets.GITHUB_TOKEN }}'
24
+
21
25
  - name: Create bump and changelog
22
26
  uses: commitizen-tools/commitizen-action@master
23
27
  with:
24
28
  github_token: ${{ secrets.GITHUB_TOKEN }}
25
29
  branch: main
30
+ debug: true
31
+
32
+ - name: Print Version
33
+ run: echo "Bumped to version ${{ env.REVISION }}"
@@ -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@v4
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@v4
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@v4
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"
@@ -0,0 +1,166 @@
1
+ name: Release
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
+
6
+ on:
7
+ push:
8
+ branches:
9
+ - main
10
+ tags:
11
+ - 'v*'
12
+ - 'diskcache_rs-v*' # Support release-please tag format
13
+ workflow_dispatch:
14
+
15
+ permissions:
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
19
+ id-token: write # Required for PyPI trusted publishing
20
+ attestations: write # Required for artifact attestation
21
+
22
+ jobs:
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)
38
+ build:
39
+ needs: release-please
40
+ if: ${{ needs.release-please.outputs.release_created }}
41
+ uses: ./.github/workflows/build.yml
42
+ permissions:
43
+ contents: read
44
+ actions: write # Required for uploading artifacts
45
+ id-token: write # Required for artifact attestation
46
+
47
+ # Call the ABI3 build workflow to build universal wheels (only if release was created)
48
+ build-abi3:
49
+ needs: release-please
50
+ if: ${{ needs.release-please.outputs.release_created }}
51
+ uses: ./.github/workflows/build-abi3.yml
52
+ permissions:
53
+ contents: read
54
+ actions: write # Required for uploading artifacts
55
+ id-token: write # Required for artifact attestation
56
+
57
+ # Call the CI workflow to run tests (only if release was created)
58
+ test:
59
+ needs: release-please
60
+ if: ${{ needs.release-please.outputs.release_created }}
61
+ uses: ./.github/workflows/ci.yml
62
+ permissions:
63
+ contents: read
64
+
65
+ # Publish to PyPI - only depends on builds, not tests (tests should pass in PR)
66
+ pypi-publish:
67
+ name: Publish to PyPI
68
+ runs-on: ubuntu-latest
69
+ needs: [build, build-abi3]
70
+ environment:
71
+ name: pypi
72
+ url: https://pypi.org/p/diskcache_rs
73
+ permissions:
74
+ # IMPORTANT: this permission is mandatory for trusted publishing
75
+ id-token: write
76
+ # Used to upload release artifacts
77
+ contents: write
78
+ # Used to generate artifact attestation
79
+ attestations: write
80
+
81
+ steps:
82
+ - name: Download all artifacts
83
+ uses: actions/download-artifact@v6
84
+ with:
85
+ path: dist
86
+ merge-multiple: true
87
+
88
+ - name: List downloaded artifacts
89
+ run: |
90
+ ls -la dist/
91
+ echo "Total files: $(ls -1 dist/ | wc -l)"
92
+
93
+ - name: Generate artifact attestation
94
+ uses: actions/attest-build-provenance@v3
95
+ with:
96
+ subject-path: 'dist/*'
97
+
98
+ - name: Publish to PyPI
99
+ uses: pypa/gh-action-pypi-publish@release/v1
100
+ with:
101
+ packages-dir: dist
102
+ verbose: true
103
+ print-hash: true
104
+ skip-existing: true # Skip files that already exist on PyPI
105
+
106
+ # Create GitHub Release
107
+ github-release:
108
+ name: Create GitHub Release
109
+ runs-on: ubuntu-latest
110
+ needs: [release-please, pypi-publish]
111
+ if: ${{ needs.release-please.outputs.release_created }}
112
+ permissions:
113
+ contents: write # Required for creating releases
114
+ actions: read # Required for downloading artifacts
115
+ attestations: write # Required for artifact attestation
116
+
117
+ steps:
118
+ - uses: actions/checkout@v5
119
+ with:
120
+ fetch-depth: 0
121
+
122
+ - name: Generate changelog
123
+ id: changelog
124
+ uses: jaywcjlove/changelog-generator@main
125
+ with:
126
+ token: ${{ secrets.GITHUB_TOKEN }}
127
+ filter-author: (loonghao|renovate\\[bot\\]|dependabot\\[bot\\]|Renovate Bot)
128
+ filter: ''
129
+ template: |
130
+ ## Bugs
131
+ {{fix}}
132
+
133
+ ## Feature
134
+ {{feat}}
135
+
136
+ ## Improve
137
+ {{refactor,perf,clean}}
138
+
139
+ ## Misc
140
+ {{chore,style,ci,build||🔧 Nothing changed}}
141
+
142
+ ## Unknown
143
+ {{__unknown__}}
144
+
145
+ - name: Download all artifacts
146
+ uses: actions/download-artifact@v6
147
+ with:
148
+ path: release-artifacts
149
+ merge-multiple: true
150
+
151
+ - name: Create GitHub Release
152
+ uses: ncipollo/release-action@v1
153
+ with:
154
+ artifacts: "release-artifacts/*"
155
+ token: ${{ secrets.GITHUB_TOKEN }}
156
+ tag: ${{ needs.release-please.outputs.tag_name }}
157
+ name: ${{ needs.release-please.outputs.tag_name }}
158
+ body: |
159
+ Comparing Changes: ${{ steps.changelog.outputs.compareurl }}
160
+
161
+ ${{ steps.changelog.outputs.changelog }}
162
+ draft: false
163
+ prerelease: false
164
+ allowUpdates: true
165
+ skipIfReleaseExists: false
166
+ updateOnlyUnreleased: false