Skip to content

Commit 00ee08e

Browse files
committed
Match min Python version for GitHub actions testing
1 parent af86b62 commit 00ee08e

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

src/project_info.rs

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -431,13 +431,32 @@ pub fn get_project_info(use_defaults: bool) -> Result<ProjectInfo> {
431431
let github_actions_python_test_version_default =
432432
match config.github_actions_python_test_versions {
433433
Some(versions) => versions,
434-
None => vec![
435-
"3.8".to_string(),
436-
"3.9".to_string(),
437-
"3.10".to_string(),
438-
"3.11".to_string(),
439-
"3.12".to_string(),
440-
],
434+
None => {
435+
let mut split_version = min_python_version.split('.');
436+
if let Some(v) = split_version.nth(1) {
437+
let min = v.parse::<i32>()?;
438+
if min >= 12 {
439+
vec![format!("3.{min}")]
440+
} else {
441+
let mut versions: Vec<String> = Vec::new();
442+
443+
// Up to 3.12
444+
for i in min..13 {
445+
versions.push(format!("3.{i}"));
446+
}
447+
448+
versions
449+
}
450+
} else {
451+
vec![
452+
"3.8".to_string(),
453+
"3.9".to_string(),
454+
"3.10".to_string(),
455+
"3.11".to_string(),
456+
"3.12".to_string(),
457+
]
458+
}
459+
}
441460
};
442461
let github_actions_python_test_versions = if use_defaults {
443462
github_actions_python_test_version_default

0 commit comments

Comments
 (0)