Skip to content

Commit 3d0cf73

Browse files
authored
feat: add pattern * to default branch rules (#139)
1 parent c54b6de commit 3d0cf73

File tree

8 files changed

+262
-73
lines changed

8 files changed

+262
-73
lines changed

.github/workflows/ci-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ jobs:
6161

6262
- name: SonarQube Scan
6363
if: matrix.os == 'ubuntu-latest'
64-
uses: SonarSource/sonarqube-scan-action@fd88b7d7ccbaefd23d8f36f73b59db7a3d246602 # v6.0.0
64+
uses: SonarSource/sonarqube-scan-action@a31c9398be7ace6bbfaf30c0bd5d415f843d45e9 # v7.0.0
6565
env:
6666
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
6767

6868
- name: Upload coverage reports to Codecov
6969
if: matrix.os == 'ubuntu-latest'
70-
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
70+
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
7171
with:
7272
fail_ci_if_error: true
7373
token: ${{ secrets.CODECOV_TOKEN }}

Cargo.lock

Lines changed: 24 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cli/flow/args/branch_rules.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,13 @@ mod tests {
175175
.find_rule("release/1")
176176
.is_some()
177177
);
178+
// Should have universal wildcard rule
179+
assert!(
180+
args.branch_config
181+
.branch_rules
182+
.find_rule("any-branch")
183+
.is_some()
184+
);
178185
}
179186

180187
#[test]

src/cli/flow/args/main.rs

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -153,21 +153,13 @@ Standard Schema Family (SemVer):
153153
standard-base-prerelease-post-context - 1.1.0-alpha.1.post.2+main.2.a1b2c3d
154154
standard-base-prerelease-post-dev-context - 1.1.0-alpha.1.post.2.dev.1729924622+main.2.a1b2c3d
155155
standard-context - Smart auto-detection with build context
156-
157-
CalVer Schema Family:
158-
calver - Smart auto-detection based on repository state (clean/dirty/distance)
159-
calver-base - 2024.11.03
160-
calver-base-prerelease - 2024.11.03-alpha.1
161-
calver-base-prerelease-post - 2024.11.03-alpha.1.post.2
162-
calver-base-prerelease-post-dev - 2024.11.03-alpha.1.post.2.dev.1729924622
163-
calver-base-context - 2024.11.03+main.2.a1b2c3d
164-
calver-base-prerelease-context - 2024.11.03-alpha.1+main.2.a1b2c3d
165-
calver-base-prerelease-post-context - 2024.11.03-alpha.1.post.2+main.2.a1b2c3d
166-
calver-base-prerelease-post-dev-context - 2024.11.03-alpha.1.post.2.dev.1729924622+main.2.a1b2c3d
167-
calver-context - Smart auto-detection with build context
168156
"
169157
)]
170158
pub schema: Option<String>,
159+
160+
/// Custom RON schema definition
161+
#[arg(long, help = "Custom schema in RON format")]
162+
pub schema_ron: Option<String>,
171163
}
172164

173165
impl Default for FlowArgs {
@@ -179,6 +171,7 @@ impl Default for FlowArgs {
179171
overrides: OverridesConfig::default(),
180172
hash_branch_len: 5,
181173
schema: None,
174+
schema_ron: None,
182175
}
183176
}
184177
}
@@ -213,6 +206,7 @@ mod tests {
213206
assert!(args.branch_config.pre_release_num.is_none());
214207
assert_eq!(args.branch_config.post_mode, None);
215208
assert!(args.schema.is_none()); // Default is None (will use standard schema)
209+
assert!(args.schema_ron.is_none()); // Default is None
216210
assert!(args.overrides.common.bumped_branch.is_none()); // Default is None (use detected branch)
217211
}
218212

@@ -247,6 +241,19 @@ mod tests {
247241
assert_eq!(args.output.output_prefix, Some("v".to_string()));
248242
assert!(args.validate(&mock_zerv()).is_ok());
249243
}
244+
245+
#[test]
246+
fn test_flow_args_with_schema_ron() {
247+
let ron_schema = "core: [{var: \"major\"}]";
248+
let mut args = FlowArgs {
249+
schema: None,
250+
schema_ron: Some(ron_schema.to_string()),
251+
..FlowArgs::default()
252+
};
253+
assert!(args.schema.is_none());
254+
assert_eq!(args.schema_ron, Some(ron_schema.to_string()));
255+
assert!(args.validate(&mock_zerv()).is_ok());
256+
}
250257
}
251258

252259
mod error_cases {

src/cli/flow/args/version_args.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ impl FlowArgs {
1919
VersionArgs {
2020
input: self.input.clone(),
2121
output: OutputConfig::zerv(),
22-
main: MainConfig::from_schema(self.schema.clone()),
22+
main: MainConfig::from_schema_and_ron(self.schema.clone(), self.schema_ron.clone()),
2323
overrides: OverridesConfig {
2424
common: {
2525
let mut common_config = self.overrides.common.clone();

0 commit comments

Comments
 (0)