@owenlamont/ryl 0.4.1 → 0.4.2

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 (216) hide show
  1. package/README.md +13 -0
  2. package/bin/ryl.js +195 -1
  3. package/package.json +35 -13
  4. package/.github/CODEOWNERS +0 -1
  5. package/.github/dependabot.yml +0 -13
  6. package/.github/workflows/ci.yml +0 -107
  7. package/.github/workflows/release.yml +0 -613
  8. package/.github/workflows/update_dependencies.yml +0 -61
  9. package/.github/workflows/update_linters.yml +0 -56
  10. package/.pre-commit-config.yaml +0 -87
  11. package/.yamllint +0 -4
  12. package/AGENTS.md +0 -200
  13. package/Cargo.lock +0 -908
  14. package/Cargo.toml +0 -32
  15. package/clippy.toml +0 -1
  16. package/docs/config-presets.md +0 -100
  17. package/img/benchmark-5x5-5runs.svg +0 -2176
  18. package/pyproject.toml +0 -42
  19. package/ruff.toml +0 -107
  20. package/rumdl.toml +0 -20
  21. package/rust-toolchain.toml +0 -3
  22. package/rustfmt.toml +0 -3
  23. package/scripts/benchmark_perf_vs_yamllint.py +0 -400
  24. package/scripts/coverage-missing.ps1 +0 -80
  25. package/scripts/coverage-missing.sh +0 -60
  26. package/src/bin/discover_config_bin.rs +0 -24
  27. package/src/cli_support.rs +0 -33
  28. package/src/conf/mod.rs +0 -85
  29. package/src/config.rs +0 -2099
  30. package/src/decoder.rs +0 -326
  31. package/src/discover.rs +0 -31
  32. package/src/lib.rs +0 -19
  33. package/src/lint.rs +0 -558
  34. package/src/main.rs +0 -535
  35. package/src/migrate.rs +0 -233
  36. package/src/rules/anchors.rs +0 -517
  37. package/src/rules/braces.rs +0 -77
  38. package/src/rules/brackets.rs +0 -77
  39. package/src/rules/colons.rs +0 -475
  40. package/src/rules/commas.rs +0 -372
  41. package/src/rules/comments.rs +0 -299
  42. package/src/rules/comments_indentation.rs +0 -243
  43. package/src/rules/document_end.rs +0 -175
  44. package/src/rules/document_start.rs +0 -84
  45. package/src/rules/empty_lines.rs +0 -152
  46. package/src/rules/empty_values.rs +0 -255
  47. package/src/rules/float_values.rs +0 -259
  48. package/src/rules/flow_collection.rs +0 -562
  49. package/src/rules/hyphens.rs +0 -104
  50. package/src/rules/indentation.rs +0 -803
  51. package/src/rules/key_duplicates.rs +0 -218
  52. package/src/rules/key_ordering.rs +0 -303
  53. package/src/rules/line_length.rs +0 -326
  54. package/src/rules/mod.rs +0 -25
  55. package/src/rules/new_line_at_end_of_file.rs +0 -23
  56. package/src/rules/new_lines.rs +0 -95
  57. package/src/rules/octal_values.rs +0 -121
  58. package/src/rules/quoted_strings.rs +0 -577
  59. package/src/rules/span_utils.rs +0 -37
  60. package/src/rules/trailing_spaces.rs +0 -65
  61. package/src/rules/truthy.rs +0 -420
  62. package/tests/brackets_carriage_return.rs +0 -114
  63. package/tests/build_global_cfg_error.rs +0 -23
  64. package/tests/cli_anchors_rule.rs +0 -143
  65. package/tests/cli_braces_rule.rs +0 -104
  66. package/tests/cli_brackets_rule.rs +0 -104
  67. package/tests/cli_colons_rule.rs +0 -65
  68. package/tests/cli_commas_rule.rs +0 -104
  69. package/tests/cli_comments_indentation_rule.rs +0 -61
  70. package/tests/cli_comments_rule.rs +0 -67
  71. package/tests/cli_config_data_error.rs +0 -30
  72. package/tests/cli_config_flags.rs +0 -66
  73. package/tests/cli_config_migrate.rs +0 -229
  74. package/tests/cli_document_end_rule.rs +0 -92
  75. package/tests/cli_document_start_rule.rs +0 -92
  76. package/tests/cli_empty_lines_rule.rs +0 -87
  77. package/tests/cli_empty_values_rule.rs +0 -68
  78. package/tests/cli_env_config.rs +0 -34
  79. package/tests/cli_exit_and_errors.rs +0 -41
  80. package/tests/cli_file_encoding.rs +0 -203
  81. package/tests/cli_float_values_rule.rs +0 -64
  82. package/tests/cli_format_options.rs +0 -316
  83. package/tests/cli_global_cfg_relaxed.rs +0 -20
  84. package/tests/cli_hyphens_rule.rs +0 -104
  85. package/tests/cli_indentation_rule.rs +0 -65
  86. package/tests/cli_invalid_project_config.rs +0 -39
  87. package/tests/cli_key_duplicates_rule.rs +0 -104
  88. package/tests/cli_key_ordering_rule.rs +0 -59
  89. package/tests/cli_line_length_rule.rs +0 -85
  90. package/tests/cli_list_files.rs +0 -29
  91. package/tests/cli_new_line_rule.rs +0 -141
  92. package/tests/cli_new_lines_rule.rs +0 -119
  93. package/tests/cli_octal_values_rule.rs +0 -60
  94. package/tests/cli_quoted_strings_rule.rs +0 -47
  95. package/tests/cli_toml_config.rs +0 -119
  96. package/tests/cli_trailing_spaces_rule.rs +0 -77
  97. package/tests/cli_truthy_rule.rs +0 -83
  98. package/tests/cli_yaml_files_negation.rs +0 -45
  99. package/tests/colons_rule.rs +0 -303
  100. package/tests/common/compat.rs +0 -114
  101. package/tests/common/fake_env.rs +0 -93
  102. package/tests/common/mod.rs +0 -1
  103. package/tests/conf_builtin.rs +0 -9
  104. package/tests/config_anchors.rs +0 -84
  105. package/tests/config_braces.rs +0 -121
  106. package/tests/config_brackets.rs +0 -127
  107. package/tests/config_commas.rs +0 -79
  108. package/tests/config_comments.rs +0 -65
  109. package/tests/config_comments_indentation.rs +0 -20
  110. package/tests/config_deep_merge_nonstring_key.rs +0 -24
  111. package/tests/config_document_end.rs +0 -54
  112. package/tests/config_document_start.rs +0 -55
  113. package/tests/config_empty_lines.rs +0 -48
  114. package/tests/config_empty_values.rs +0 -35
  115. package/tests/config_env_errors.rs +0 -23
  116. package/tests/config_env_invalid_inline.rs +0 -15
  117. package/tests/config_env_missing.rs +0 -63
  118. package/tests/config_env_shim.rs +0 -301
  119. package/tests/config_explicit_file_parse_error.rs +0 -55
  120. package/tests/config_extended_features.rs +0 -225
  121. package/tests/config_extends_inline.rs +0 -185
  122. package/tests/config_extends_sequence.rs +0 -18
  123. package/tests/config_find_project_home_boundary.rs +0 -54
  124. package/tests/config_find_project_two_files_in_cwd.rs +0 -47
  125. package/tests/config_float_values.rs +0 -34
  126. package/tests/config_from_yaml_paths.rs +0 -32
  127. package/tests/config_hyphens.rs +0 -51
  128. package/tests/config_ignore_errors.rs +0 -243
  129. package/tests/config_ignore_overrides.rs +0 -83
  130. package/tests/config_indentation.rs +0 -65
  131. package/tests/config_invalid_globs.rs +0 -16
  132. package/tests/config_invalid_types.rs +0 -19
  133. package/tests/config_key_duplicates.rs +0 -34
  134. package/tests/config_key_ordering.rs +0 -70
  135. package/tests/config_line_length.rs +0 -65
  136. package/tests/config_locale.rs +0 -111
  137. package/tests/config_merge.rs +0 -26
  138. package/tests/config_new_lines.rs +0 -89
  139. package/tests/config_octal_values.rs +0 -33
  140. package/tests/config_quoted_strings.rs +0 -195
  141. package/tests/config_rule_level.rs +0 -147
  142. package/tests/config_rules_non_string_keys.rs +0 -23
  143. package/tests/config_scalar_overrides.rs +0 -27
  144. package/tests/config_to_toml.rs +0 -110
  145. package/tests/config_toml_coverage.rs +0 -80
  146. package/tests/config_toml_discovery.rs +0 -304
  147. package/tests/config_trailing_spaces.rs +0 -152
  148. package/tests/config_truthy.rs +0 -77
  149. package/tests/config_yaml_files.rs +0 -62
  150. package/tests/config_yaml_files_all_non_string.rs +0 -15
  151. package/tests/config_yaml_files_empty.rs +0 -30
  152. package/tests/coverage_commas.rs +0 -46
  153. package/tests/decoder_decode.rs +0 -338
  154. package/tests/discover_config_bin_all.rs +0 -66
  155. package/tests/discover_config_bin_env_invalid_yaml.rs +0 -26
  156. package/tests/discover_config_bin_project_config_parse_error.rs +0 -24
  157. package/tests/discover_config_bin_user_global_error.rs +0 -26
  158. package/tests/discover_module.rs +0 -30
  159. package/tests/discover_per_file_dir.rs +0 -10
  160. package/tests/discover_per_file_project_config_error.rs +0 -21
  161. package/tests/float_values.rs +0 -43
  162. package/tests/lint_multi_errors.rs +0 -32
  163. package/tests/main_yaml_ok_filtering.rs +0 -30
  164. package/tests/migrate_module.rs +0 -259
  165. package/tests/resolve_ctx_empty_parent.rs +0 -16
  166. package/tests/rule_anchors.rs +0 -442
  167. package/tests/rule_braces.rs +0 -258
  168. package/tests/rule_brackets.rs +0 -217
  169. package/tests/rule_commas.rs +0 -205
  170. package/tests/rule_comments.rs +0 -197
  171. package/tests/rule_comments_indentation.rs +0 -127
  172. package/tests/rule_document_end.rs +0 -118
  173. package/tests/rule_document_start.rs +0 -60
  174. package/tests/rule_empty_lines.rs +0 -96
  175. package/tests/rule_empty_values.rs +0 -102
  176. package/tests/rule_float_values.rs +0 -109
  177. package/tests/rule_hyphens.rs +0 -65
  178. package/tests/rule_indentation.rs +0 -455
  179. package/tests/rule_key_duplicates.rs +0 -76
  180. package/tests/rule_key_ordering.rs +0 -207
  181. package/tests/rule_line_length.rs +0 -200
  182. package/tests/rule_new_lines.rs +0 -51
  183. package/tests/rule_octal_values.rs +0 -53
  184. package/tests/rule_quoted_strings.rs +0 -290
  185. package/tests/rule_trailing_spaces.rs +0 -41
  186. package/tests/rule_truthy.rs +0 -236
  187. package/tests/user_global_invalid_yaml.rs +0 -32
  188. package/tests/yamllint_compat_anchors.rs +0 -280
  189. package/tests/yamllint_compat_braces.rs +0 -411
  190. package/tests/yamllint_compat_brackets.rs +0 -364
  191. package/tests/yamllint_compat_colons.rs +0 -298
  192. package/tests/yamllint_compat_colors.rs +0 -80
  193. package/tests/yamllint_compat_commas.rs +0 -375
  194. package/tests/yamllint_compat_comments.rs +0 -167
  195. package/tests/yamllint_compat_comments_indentation.rs +0 -281
  196. package/tests/yamllint_compat_config.rs +0 -170
  197. package/tests/yamllint_compat_document_end.rs +0 -243
  198. package/tests/yamllint_compat_document_start.rs +0 -136
  199. package/tests/yamllint_compat_empty_lines.rs +0 -117
  200. package/tests/yamllint_compat_empty_values.rs +0 -179
  201. package/tests/yamllint_compat_float_values.rs +0 -216
  202. package/tests/yamllint_compat_hyphens.rs +0 -223
  203. package/tests/yamllint_compat_indentation.rs +0 -398
  204. package/tests/yamllint_compat_key_duplicates.rs +0 -139
  205. package/tests/yamllint_compat_key_ordering.rs +0 -170
  206. package/tests/yamllint_compat_line_length.rs +0 -375
  207. package/tests/yamllint_compat_list.rs +0 -127
  208. package/tests/yamllint_compat_new_line.rs +0 -133
  209. package/tests/yamllint_compat_newline_types.rs +0 -185
  210. package/tests/yamllint_compat_octal_values.rs +0 -172
  211. package/tests/yamllint_compat_quoted_strings.rs +0 -154
  212. package/tests/yamllint_compat_syntax.rs +0 -200
  213. package/tests/yamllint_compat_trailing_spaces.rs +0 -162
  214. package/tests/yamllint_compat_truthy.rs +0 -130
  215. package/tests/yamllint_compat_yaml_files.rs +0 -81
  216. package/typos.toml +0 -2
@@ -1,613 +0,0 @@
1
- name: Release Crate and Wheels
2
-
3
- on:
4
- push:
5
- tags: ['v*']
6
- workflow_dispatch:
7
- inputs:
8
- publish:
9
- description: "Publish to PyPI and crates.io"
10
- type: boolean
11
- required: false
12
- default: false
13
-
14
- permissions:
15
- contents: read
16
-
17
- jobs:
18
- version-check:
19
- runs-on: ubuntu-latest
20
- steps:
21
- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
22
- - name: Verify version consistency
23
- run: |
24
- set -euo pipefail
25
- EVENT_NAME="${GITHUB_EVENT_NAME}"
26
- REF_NAME="${GITHUB_REF_NAME}"
27
- TAG_VERSION=""
28
- if [ "$EVENT_NAME" = "push" ] && [[ "$REF_NAME" == v* ]]; then
29
- TAG_VERSION="${REF_NAME#v}" # drop 'v' prefix if present
30
- fi
31
- echo "Event: $EVENT_NAME"
32
- echo "Ref name: $REF_NAME"
33
- echo "Tag version: ${TAG_VERSION:-<none>}"
34
- python - <<'PY'
35
- import os, sys
36
- try:
37
- import tomllib # Python 3.11+
38
- except Exception as e: # pragma: no cover
39
- print("Python 3.11+ with tomllib is required", file=sys.stderr)
40
- raise
41
-
42
- def read_toml(path: str):
43
- with open(path, 'rb') as f:
44
- return tomllib.load(f)
45
-
46
- tag = os.environ.get('TAG_VERSION', '')
47
- cargo = read_toml('Cargo.toml')
48
- pyproj = read_toml('pyproject.toml')
49
-
50
- cargo_version = cargo.get('package', {}).get('version')
51
- py_version = pyproj.get('project', {}).get('version')
52
-
53
- print(f"Cargo.toml version: {cargo_version}")
54
- print(f"pyproject.toml version: {py_version}")
55
-
56
- ok = True
57
- # Always ensure Cargo and pyproject match each other
58
- if cargo_version != py_version:
59
- print("❌ Cargo.toml and pyproject.toml versions differ", file=sys.stderr)
60
- ok = False
61
- # On tag builds, also enforce equality with the tag
62
- if tag:
63
- if cargo_version != tag:
64
- print("❌ Cargo.toml version does not match tag", file=sys.stderr)
65
- ok = False
66
- if py_version != tag:
67
- print("❌ pyproject.toml version does not match tag", file=sys.stderr)
68
- ok = False
69
-
70
- if not ok:
71
- sys.exit(1)
72
-
73
- print("✅ Versions are consistent")
74
- PY
75
-
76
- preflight-release-guard:
77
- name: Preflight release guard
78
- needs: [version-check]
79
- if: >-
80
- startsWith(github.ref, 'refs/tags/v') &&
81
- (github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.publish == true))
82
- runs-on: ubuntu-latest
83
- environment: automation
84
- permissions:
85
- contents: read
86
- steps:
87
- - name: Ensure existing release (if any) is a draft
88
- env:
89
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90
- RELEASE_TAG: ${{ github.ref_name }}
91
- run: |
92
- set -euo pipefail
93
- release_query_err_file="$(mktemp)"
94
- if release_is_draft="$(gh release view "${RELEASE_TAG}" -R "${GITHUB_REPOSITORY}" --json isDraft --jq '.isDraft' 2>"${release_query_err_file}")"; then
95
- :
96
- elif grep -Eq '404|not[[:space:]]+found' "${release_query_err_file}"; then
97
- echo "No release exists for ${RELEASE_TAG}; continuing."
98
- exit 0
99
- else
100
- echo "Failed to query release ${RELEASE_TAG}." >&2
101
- cat "${release_query_err_file}" >&2
102
- exit 1
103
- fi
104
- if [ "${release_is_draft}" = "true" ]; then
105
- echo "Draft release ${RELEASE_TAG} already exists; continuing for rerun safety."
106
- exit 0
107
- fi
108
- echo "Published release ${RELEASE_TAG} already exists; refusing to continue." >&2
109
- exit 1
110
-
111
- linux:
112
- needs: [version-check]
113
- runs-on: ubuntu-22.04
114
- strategy:
115
- matrix:
116
- target: [x86_64, aarch64, armv7, i686, ppc64le, s390x]
117
- steps:
118
- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
119
- - name: Build manylinux wheels
120
- uses: PyO3/maturin-action@04ac600d27cdf7a9a280dadf7147097c42b757ad
121
- with:
122
- target: ${{ matrix.target }}
123
- args: --release --out dist
124
- manylinux: auto
125
- sccache: ${{ github.event_name != 'release' }}
126
- - name: Upload wheels (manylinux)
127
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
128
- with:
129
- name: wheels-manylinux-${{ matrix.target }}
130
- path: dist
131
-
132
- smoke-manylinux:
133
- name: Smoke Test (manylinux)
134
- needs: [linux]
135
- runs-on: ubuntu-22.04
136
- strategy:
137
- matrix:
138
- python: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.14t"]
139
- steps:
140
- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
141
- - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
142
- with:
143
- pattern: wheels-manylinux-*
144
- merge-multiple: true
145
- path: dist
146
- - name: Install uv
147
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78
148
- - name: Install wheel and run CLI
149
- run: |
150
- set -euxo pipefail
151
- uv python install ${{ matrix.python }}
152
- uv venv -p ${{ matrix.python }} .venv
153
- uv pip install -p .venv --no-index --find-links dist ryl
154
- uv run -p .venv ryl --version
155
-
156
- musllinux:
157
- needs: [version-check]
158
- runs-on: ubuntu-22.04
159
- strategy:
160
- matrix:
161
- target: [x86_64, aarch64]
162
- steps:
163
- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
164
- - name: Build musllinux wheels
165
- uses: PyO3/maturin-action@04ac600d27cdf7a9a280dadf7147097c42b757ad
166
- with:
167
- target: ${{ matrix.target }}
168
- args: --release --out dist
169
- manylinux: musllinux_1_2
170
- sccache: ${{ github.event_name != 'release' }}
171
- - name: Upload wheels (musllinux)
172
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
173
- with:
174
- name: wheels-musllinux-${{ matrix.target }}
175
- path: dist
176
-
177
- smoke-musllinux:
178
- name: Smoke Test (musllinux)
179
- needs: [musllinux]
180
- runs-on: ubuntu-22.04
181
- strategy:
182
- matrix:
183
- python_image: ["3.10-alpine", "3.11-alpine", "3.12-alpine", "3.13-alpine", "3.14-alpine"]
184
- steps:
185
- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
186
- - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
187
- with:
188
- pattern: wheels-musllinux-*
189
- merge-multiple: true
190
- path: dist
191
- - name: Install wheel and run CLI in Alpine
192
- run: |
193
- set -euxo pipefail
194
- docker run --rm -v "$PWD/dist":/dist python:${{ matrix.python_image }} \
195
- sh -euxc "python --version; python -m pip install --no-index --find-links /dist ryl; ryl --version"
196
-
197
- windows:
198
- needs: [version-check]
199
- runs-on: windows-latest
200
- strategy:
201
- matrix:
202
- target: [x86_64, aarch64]
203
- steps:
204
- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
205
- - name: Build Windows wheels
206
- uses: PyO3/maturin-action@04ac600d27cdf7a9a280dadf7147097c42b757ad
207
- with:
208
- target: ${{ matrix.target }}
209
- args: --release --out dist
210
- sccache: ${{ github.event_name != 'release' }}
211
- - name: Upload wheels (Windows)
212
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
213
- with:
214
- name: wheels-windows-${{ matrix.target }}
215
- path: dist
216
-
217
- smoke-windows:
218
- name: Smoke Test (Windows)
219
- needs: [windows]
220
- runs-on: windows-latest
221
- strategy:
222
- matrix:
223
- python: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.14t"]
224
- steps:
225
- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
226
- - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
227
- with:
228
- pattern: wheels-windows-*
229
- merge-multiple: true
230
- path: dist
231
- - name: Install uv
232
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78
233
- - name: Install wheel and run CLI
234
- shell: bash
235
- run: |
236
- set -euxo pipefail
237
- uv python install ${{ matrix.python }}
238
- uv venv -p ${{ matrix.python }} .venv
239
- uv pip install -p .venv --no-index --find-links dist ryl
240
- uv run -p .venv ryl --version
241
-
242
- macos:
243
- needs: [version-check]
244
- strategy:
245
- matrix:
246
- include:
247
- - runner: macos-14
248
- target: aarch64
249
- runs-on: ${{ matrix.runner }}
250
- steps:
251
- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
252
- - name: Build macOS wheels
253
- uses: PyO3/maturin-action@04ac600d27cdf7a9a280dadf7147097c42b757ad
254
- with:
255
- target: ${{ matrix.target }}
256
- args: --release --out dist
257
- sccache: ${{ github.event_name != 'release' }}
258
- - name: Upload wheels (macOS)
259
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
260
- with:
261
- name: wheels-macos-${{ matrix.target }}
262
- path: dist
263
-
264
- smoke-macos:
265
- name: Smoke Test (macOS)
266
- needs: [macos]
267
- strategy:
268
- matrix:
269
- runner: [macos-14]
270
- python: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.14t"]
271
- runs-on: ${{ matrix.runner }}
272
- steps:
273
- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
274
- - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
275
- with:
276
- pattern: wheels-macos-*
277
- merge-multiple: true
278
- path: dist
279
- - name: Install uv
280
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78
281
- - name: Install wheel and run CLI
282
- run: |
283
- set -euxo pipefail
284
- uv python install ${{ matrix.python }}
285
- uv venv -p ${{ matrix.python }} .venv
286
- uv pip install -p .venv --no-index --find-links dist ryl
287
- uv run -p .venv ryl --version
288
-
289
- sdist:
290
- needs: [version-check]
291
- runs-on: ubuntu-latest
292
- steps:
293
- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
294
- - name: Build sdist
295
- uses: PyO3/maturin-action@04ac600d27cdf7a9a280dadf7147097c42b757ad
296
- with:
297
- command: sdist
298
- args: --out dist
299
- - name: Upload sdist
300
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
301
- with:
302
- name: wheels-sdist
303
- path: dist
304
-
305
- upload-release-binaries:
306
- name: Upload release binaries
307
- needs:
308
- - smoke-manylinux
309
- - smoke-musllinux
310
- - smoke-windows
311
- - smoke-macos
312
- - sdist
313
- - preflight-release-guard
314
- if: >-
315
- startsWith(github.ref, 'refs/tags/v') &&
316
- (github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.publish == true))
317
- strategy:
318
- fail-fast: false
319
- matrix:
320
- include:
321
- - runner: ubuntu-22.04
322
- target: x86_64-unknown-linux-gnu
323
- - runner: ubuntu-22.04
324
- target: aarch64-unknown-linux-gnu
325
- - runner: ubuntu-22.04
326
- target: armv7-unknown-linux-gnueabihf
327
- - runner: ubuntu-22.04
328
- target: i686-unknown-linux-gnu
329
- - runner: ubuntu-22.04
330
- target: powerpc64le-unknown-linux-gnu
331
- - runner: ubuntu-22.04
332
- target: s390x-unknown-linux-gnu
333
- - runner: ubuntu-22.04
334
- target: x86_64-unknown-linux-musl
335
- - runner: ubuntu-22.04
336
- target: aarch64-unknown-linux-musl
337
- - runner: windows-latest
338
- target: x86_64-pc-windows-msvc
339
- - runner: windows-latest
340
- target: aarch64-pc-windows-msvc
341
- - runner: macos-14
342
- target: aarch64-apple-darwin
343
- runs-on: ${{ matrix.runner }}
344
- permissions:
345
- contents: read
346
- steps:
347
- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
348
- - name: Build binaries for ${{ matrix.target }}
349
- uses: taiki-e/upload-rust-binary-action@0e34102c043ded9f2ca39f7af5cd99a540c61aff
350
- with:
351
- bin: ryl
352
- target: ${{ matrix.target }}
353
- locked: true
354
- token: ${{ secrets.GITHUB_TOKEN }}
355
- dry-run: true
356
- - name: Collect release assets for ${{ matrix.target }}
357
- shell: bash
358
- run: |
359
- set -euo pipefail
360
- shopt -s nullglob
361
- mkdir -p release-assets
362
- assets=(ryl-${{ matrix.target }}*)
363
- for asset in "${assets[@]}"; do
364
- if [ -f "$asset" ]; then
365
- cp "$asset" release-assets/
366
- fi
367
- done
368
- if [ -z "$(ls -A release-assets)" ]; then
369
- echo "No release assets found for target ${{ matrix.target }}" >&2
370
- exit 1
371
- fi
372
- - name: Upload release assets for ${{ matrix.target }}
373
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
374
- with:
375
- name: release-binaries-${{ matrix.target }}
376
- path: release-assets/*
377
-
378
- create-github-release:
379
- name: Create GitHub release
380
- needs:
381
- - upload-release-binaries
382
- - publish-pypi
383
- if: >-
384
- startsWith(github.ref, 'refs/tags/v') &&
385
- (github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.publish == true))
386
- runs-on: ubuntu-latest
387
- permissions:
388
- contents: write
389
- id-token: write
390
- attestations: write
391
- steps:
392
- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
393
- - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
394
- with:
395
- pattern: release-binaries-*
396
- merge-multiple: true
397
- path: release-assets
398
- - name: Generate release asset attestation
399
- uses: actions/attest-build-provenance@a2bbfa25375fe432b6a289bc6b6cd05ecd0c4c32
400
- with:
401
- subject-path: 'release-assets/*'
402
- - name: Ensure draft tag release exists
403
- env:
404
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
405
- RELEASE_TAG: ${{ github.ref_name }}
406
- run: |
407
- set -euo pipefail
408
- if [[ "${GITHUB_REF}" != refs/tags/v* ]]; then
409
- echo "Ref '${GITHUB_REF}' is not a release tag (refs/tags/v*)." >&2
410
- exit 1
411
- fi
412
- release_query_err_file="$(mktemp)"
413
- if release_is_draft="$(gh release view "${RELEASE_TAG}" -R "${GITHUB_REPOSITORY}" --json isDraft --jq '.isDraft' 2>"${release_query_err_file}")"; then
414
- :
415
- elif grep -Eq '404|not[[:space:]]+found' "${release_query_err_file}"; then
416
- gh release create "${RELEASE_TAG}" -R "${GITHUB_REPOSITORY}" --verify-tag --title "${RELEASE_TAG}" --draft --generate-notes
417
- exit 0
418
- else
419
- echo "Failed to query release ${RELEASE_TAG}." >&2
420
- cat "${release_query_err_file}" >&2
421
- exit 1
422
- fi
423
- if [ "${release_is_draft}" = "true" ]; then
424
- echo "Reusing existing draft release ${RELEASE_TAG}."
425
- exit 0
426
- fi
427
- echo "Published release ${RELEASE_TAG} already exists; refusing to continue." >&2
428
- exit 1
429
- - name: Upload release assets
430
- env:
431
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
432
- RELEASE_TAG: ${{ github.ref_name }}
433
- run: gh release upload "$RELEASE_TAG" -R "${GITHUB_REPOSITORY}" release-assets/* --clobber
434
- - name: Publish GitHub release
435
- env:
436
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
437
- RELEASE_TAG: ${{ github.ref_name }}
438
- run: gh release edit "$RELEASE_TAG" -R "${GITHUB_REPOSITORY}" --draft=false
439
-
440
- publish-crates:
441
- name: Publish to crates.io
442
- runs-on: ubuntu-latest
443
- needs:
444
- - smoke-manylinux
445
- - smoke-musllinux
446
- - smoke-windows
447
- - smoke-macos
448
- - sdist
449
- - upload-release-binaries
450
- if: >-
451
- startsWith(github.ref, 'refs/tags/v') &&
452
- (github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.publish == true))
453
- permissions:
454
- id-token: write
455
- contents: read
456
- steps:
457
- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
458
- - name: Read crate metadata
459
- id: crate_metadata
460
- run: |
461
- set -euo pipefail
462
- crate_name="$(python - <<'PY'
463
- import tomllib
464
- with open("Cargo.toml", "rb") as f:
465
- data = tomllib.load(f)
466
- print(data["package"]["name"])
467
- PY
468
- )"
469
- crate_version="$(python - <<'PY'
470
- import tomllib
471
- with open("Cargo.toml", "rb") as f:
472
- data = tomllib.load(f)
473
- print(data["package"]["version"])
474
- PY
475
- )"
476
- echo "name=${crate_name}" >> "${GITHUB_OUTPUT}"
477
- echo "version=${crate_version}" >> "${GITHUB_OUTPUT}"
478
- - name: Check if crate version already exists
479
- id: crate_exists
480
- env:
481
- CRATE_NAME: ${{ steps.crate_metadata.outputs.name }}
482
- CRATE_VERSION: ${{ steps.crate_metadata.outputs.version }}
483
- HTTP_USER_AGENT: ryl-release-workflow/1.0 (+https://github.com/${{ github.repository }})
484
- run: |
485
- set -euo pipefail
486
- url="https://crates.io/api/v1/crates/${CRATE_NAME}/${CRATE_VERSION}"
487
- http_status="$(curl -sS -A "${HTTP_USER_AGENT}" -o /dev/null -w "%{http_code}" "${url}")"
488
- if [ "${http_status}" = "200" ]; then
489
- echo "already_published=true" >> "${GITHUB_OUTPUT}"
490
- echo "Crate ${CRATE_NAME} ${CRATE_VERSION} already published; skipping cargo publish."
491
- exit 0
492
- fi
493
- if [ "${http_status}" = "404" ]; then
494
- echo "already_published=false" >> "${GITHUB_OUTPUT}"
495
- exit 0
496
- fi
497
- echo "Unexpected crates.io response (${http_status}) for ${CRATE_NAME} ${CRATE_VERSION}." >&2
498
- exit 1
499
- - name: Authenticate with crates.io (Trusted Publishing)
500
- if: steps.crate_exists.outputs.already_published != 'true'
501
- id: crates_io_auth
502
- uses: rust-lang/crates-io-auth-action@bbd81622f20ce9e2dd9622e3218b975523e45bbe
503
- - name: Publish to crates.io
504
- if: steps.crate_exists.outputs.already_published != 'true'
505
- run: cargo publish
506
- env:
507
- CARGO_REGISTRY_TOKEN: ${{ steps.crates_io_auth.outputs.token }}
508
-
509
- publish-pypi:
510
- name: Publish to PyPI
511
- runs-on: ubuntu-latest
512
- needs:
513
- - publish-crates
514
- if: >-
515
- startsWith(github.ref, 'refs/tags/v') &&
516
- (github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.publish == true))
517
- permissions:
518
- id-token: write
519
- contents: read
520
- attestations: write
521
- steps:
522
- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
523
- - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
524
- with:
525
- pattern: wheels-*
526
- merge-multiple: true
527
- path: dist
528
- - name: Read package metadata
529
- id: package_metadata
530
- run: |
531
- set -euo pipefail
532
- package_name="$(python - <<'PY'
533
- import tomllib
534
- with open("pyproject.toml", "rb") as f:
535
- data = tomllib.load(f)
536
- print(data["project"]["name"])
537
- PY
538
- )"
539
- package_version="$(python - <<'PY'
540
- import tomllib
541
- with open("pyproject.toml", "rb") as f:
542
- data = tomllib.load(f)
543
- print(data["project"]["version"])
544
- PY
545
- )"
546
- echo "name=${package_name}" >> "${GITHUB_OUTPUT}"
547
- echo "version=${package_version}" >> "${GITHUB_OUTPUT}"
548
- - name: Check if PyPI version already exists
549
- id: pypi_exists
550
- env:
551
- PACKAGE_NAME: ${{ steps.package_metadata.outputs.name }}
552
- PACKAGE_VERSION: ${{ steps.package_metadata.outputs.version }}
553
- HTTP_USER_AGENT: ryl-release-workflow/1.0 (+https://github.com/${{ github.repository }})
554
- run: |
555
- set -euo pipefail
556
- url="https://pypi.org/pypi/${PACKAGE_NAME}/${PACKAGE_VERSION}/json"
557
- http_status="$(curl -sS -A "${HTTP_USER_AGENT}" -o /dev/null -w "%{http_code}" "${url}")"
558
- if [ "${http_status}" = "200" ]; then
559
- echo "already_published=true" >> "${GITHUB_OUTPUT}"
560
- echo "PyPI package ${PACKAGE_NAME} ${PACKAGE_VERSION} already published; skipping upload."
561
- exit 0
562
- fi
563
- if [ "${http_status}" = "404" ]; then
564
- echo "already_published=false" >> "${GITHUB_OUTPUT}"
565
- exit 0
566
- fi
567
- echo "Unexpected PyPI response (${http_status}) for ${PACKAGE_NAME} ${PACKAGE_VERSION}." >&2
568
- exit 1
569
- - name: Generate artifact attestation
570
- uses: actions/attest-build-provenance@a2bbfa25375fe432b6a289bc6b6cd05ecd0c4c32
571
- with:
572
- subject-path: 'dist/*'
573
- - name: Publish to PyPI (Trusted Publishing)
574
- if: steps.pypi_exists.outputs.already_published != 'true'
575
- uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e
576
- with:
577
- print-hash: true
578
- skip-existing: true
579
-
580
- notify-ryl-pre-commit:
581
- name: Notify ryl-pre-commit
582
- runs-on: ubuntu-latest
583
- environment: automation
584
- needs:
585
- - create-github-release
586
- - publish-pypi
587
- if: >-
588
- startsWith(github.ref, 'refs/tags/v') &&
589
- (github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.publish == true))
590
- permissions:
591
- contents: read
592
- steps:
593
- - name: Generate token for cross-repository dispatch
594
- id: app-token
595
- uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859
596
- with:
597
- app-id: ${{ secrets.AUTH_APP_CLIENT_ID }}
598
- private-key: ${{ secrets.AUTH_APP_PRIVATE_KEY }}
599
- owner: owenlamont
600
- repositories: ryl-pre-commit
601
-
602
- - name: Dispatch pypi_release event to ryl-pre-commit
603
- env:
604
- APP_TOKEN: ${{ steps.app-token.outputs.token }}
605
- RELEASE_TAG: ${{ github.ref_name }}
606
- run: |
607
- set -euo pipefail
608
- version="${RELEASE_TAG#v}"
609
- curl --fail -X POST \
610
- -H "Accept: application/vnd.github+json" \
611
- -H "Authorization: Bearer ${APP_TOKEN}" \
612
- https://api.github.com/repos/owenlamont/ryl-pre-commit/dispatches \
613
- -d "{\"event_type\":\"pypi_release\",\"client_payload\":{\"version\":\"${version}\"}}"
@@ -1,61 +0,0 @@
1
- name: Update Rust Dependencies
2
-
3
- on:
4
- schedule:
5
- - cron: '30 8 * * 0' # Sunday 18:00 UTC+9:30
6
- workflow_dispatch:
7
-
8
- jobs:
9
- upgrade-all:
10
- runs-on: ubuntu-latest
11
- environment: automation
12
- permissions:
13
- contents: write
14
- pull-requests: write
15
-
16
- steps:
17
- - name: Checkout repository
18
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
19
-
20
- - name: Install cargo-edit
21
- run: cargo install cargo-edit --locked
22
-
23
- - name: Upgrade all dependencies to latest (allow majors)
24
- run: |
25
- cargo upgrade --incompatible --recursive
26
- cargo update
27
-
28
- - name: Check for changes
29
- id: check_diff
30
- run: |
31
- git add -A
32
- if git diff --cached --quiet; then
33
- echo "changed=false" >> $GITHUB_OUTPUT
34
- else
35
- echo "changed=true" >> $GITHUB_OUTPUT
36
- fi
37
-
38
- - name: Generate token
39
- if: steps.check_diff.outputs.changed == 'true'
40
- uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859
41
- id: generate-token
42
- with:
43
- app-id: ${{ secrets.AUTH_APP_CLIENT_ID }}
44
- private-key: ${{ secrets.AUTH_APP_PRIVATE_KEY }}
45
-
46
- - name: Create PR with upgraded dependencies
47
- if: steps.check_diff.outputs.changed == 'true'
48
- uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0
49
- with:
50
- token: ${{ steps.generate-token.outputs.token }}
51
- commit-message: "chore: upgrade Rust dependencies to latest (allow majors)"
52
- title: "chore: upgrade Rust dependencies to latest (allow majors)"
53
- body: |
54
- Automated dependency refresh:
55
- - Ran `cargo upgrade --incompatible --recursive`
56
- - Ran `cargo update`
57
-
58
- Merge if CI is green.
59
- branch: bot/rust-deps-max
60
- author: GitHub Actions <actions@github.com>
61
- delete-branch: true