Skip to content

Commit f747efd

Browse files
committed
review
1 parent 77b5f63 commit f747efd

File tree

10 files changed

+59
-138
lines changed

10 files changed

+59
-138
lines changed

.github/workflows/binary-builds.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ jobs:
6767
os: ubuntu-latest
6868
vendored: true
6969
cross: true
70-
- target: powerpc64-unknown-linux-gnu
71-
os: ubuntu-latest
72-
vendored: true
73-
cross: true
70+
# - target: powerpc64-unknown-linux-gnu
71+
# os: ubuntu-latest
72+
# vendored: true
73+
# cross: true
7474
- target: powerpc64le-unknown-linux-gnu
7575
os: ubuntu-latest
7676
vendored: true

.github/workflows/run-dev-tests.yml

Lines changed: 18 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
strategy:
3232
fail-fast: false
3333
matrix:
34-
os: ['windows-latest', ubuntu-latest]
34+
os: ["windows-latest", ubuntu-latest]
3535

3636
runs-on: ${{ matrix.os }}
3737
steps:
@@ -93,125 +93,25 @@ jobs:
9393
- if: runner.os == 'Linux'
9494
run: sudo apt-get update
9595

96-
- name: Install clang 11
97-
uses: ./.github/install-clang-action
98-
with:
99-
version: '11'
100-
101-
- name: Collect Coverage for clang v11
102-
env:
103-
CLANG_VERSION: '11'
104-
run: nur test --profile ci
105-
106-
- name: Install clang 12
107-
uses: ./.github/install-clang-action
108-
with:
109-
version: '12'
110-
111-
- name: Collect Coverage for clang v12
112-
env:
113-
CLANG_VERSION: '12'
114-
run: nur test --profile ci
115-
116-
- name: Install clang 13
117-
uses: ./.github/install-clang-action
118-
with:
119-
version: '13'
120-
121-
- name: Collect Coverage for clang v13
122-
env:
123-
CLANG_VERSION: '13'
124-
run: nur test --profile ci
125-
126-
- name: Install clang 14
127-
uses: ./.github/install-clang-action
128-
with:
129-
version: '14'
130-
131-
- name: Collect Coverage for clang v14
132-
env:
133-
CLANG_VERSION: '14'
134-
run: nur test --profile ci
135-
136-
- name: Install clang 15
137-
uses: ./.github/install-clang-action
138-
with:
139-
version: '15'
140-
141-
- name: Collect Coverage for clang v15
142-
env:
143-
CLANG_VERSION: '15'
144-
run: nur test --profile ci
145-
146-
- name: Install clang 16
147-
uses: ./.github/install-clang-action
148-
with:
149-
version: '16'
150-
151-
- name: Collect Coverage for clang v16
152-
env:
153-
CLANG_VERSION: '16'
154-
run: nur test --profile ci
96+
- name: Install nushell
97+
uses: hustcer/setup-nu@920172d92eb04671776f3ba69d605d3b09351c30 # v3.22
15598

156-
- name: Install clang 17
157-
uses: ./.github/install-clang-action
158-
with:
159-
version: '17'
160-
161-
- name: Collect Coverage for clang v17
162-
env:
163-
CLANG_VERSION: '17'
164-
run: nur test --profile ci
165-
166-
- name: Install clang 18
167-
uses: ./.github/install-clang-action
168-
with:
169-
version: '18'
170-
171-
- name: Collect Coverage for clang v18
99+
- name: Run test suite
172100
env:
173-
CLANG_VERSION: '18'
174-
run: nur test --profile ci
175-
176-
- name: Install clang v19
177-
uses: ./.github/install-clang-action
178-
with:
179-
version: '19'
180-
181-
- name: Collect Coverage for clang v19
182-
env:
183-
CLANG_VERSION: '19'
184-
run: nur test --profile ci
185-
186-
- name: Install clang v20
187-
uses: ./.github/install-clang-action
188-
with:
189-
version: '20'
190-
191-
- name: Collect Coverage for clang v20
192-
env:
193-
CLANG_VERSION: '20'
194-
run: nur test --profile ci
195-
196-
- name: Install clang v21
197-
uses: ./.github/install-clang-action
198-
with:
199-
version: '21'
200-
201-
- name: Collect Coverage for clang v21
202-
env:
203-
CLANG_VERSION: '21'
204-
run: nur test --profile ci
205-
206-
- name: Install clang v22
207-
uses: ./.github/install-clang-action
208-
with:
209-
version: '22'
210-
211-
- name: Collect Coverage for clang v22
212-
env:
213-
CLANG_VERSION: '22'
214-
run: nur test --profile all
101+
MIN_CLANG_VERSION: "11"
102+
MAX_CLANG_VERSION: "22"
103+
run: |-
104+
for $version in ($env.MIN_CLANG_VERSION..$env.MAX_CLANG_VERSION) {
105+
print $"::group::Testing with clang v($version)"
106+
with-env { CLANG_VERSION = $version } {
107+
if $version == $env.MAX_CLANG_VERSION {
108+
nur test --profile all
109+
} else {
110+
nur test --profile ci
111+
}
112+
}
113+
print $"::endgroup::"
114+
}
215115
216116
- name: Generate Coverage HTML report
217117
run: nur test llvm-cov

clang-installer/src/downloader/native_packages/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ pub fn try_install_package(
7474
} else {
7575
let min_version = get_min_ver(version_req).ok_or(GetToolError::VersionMajorRequired)?;
7676
for mgr in os_pkg_managers {
77+
if !mgr.is_installed() {
78+
log::debug!("Skipping {mgr} package manager as it is not installed.");
79+
continue;
80+
}
7781
log::info!("Trying to install {tool} v{min_version} using {mgr} package manager.");
7882
let pkg_name = mgr.get_package_name(tool);
7983
if mgr.is_installed_package(&pkg_name, Some(&min_version)) {

clang-installer/src/downloader/pypi.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,12 @@ impl PyPiDownloader {
461461
for i in 0..archive.len() {
462462
let mut file = archive.by_index(i)?;
463463
if file.name() == expected_zip_path {
464+
if extracted_bin.exists() {
465+
let meta = fs::metadata(extracted_bin)?;
466+
if meta.len() == file.size() {
467+
return Ok(());
468+
}
469+
}
464470
if let Some(parent) = extracted_bin.parent() {
465471
fs::create_dir_all(parent)?;
466472
}
@@ -474,6 +480,7 @@ impl PyPiDownloader {
474480
let mut total_extracted = 0;
475481
let mut progress_bar =
476482
ProgressBar::new(Some(file_size), "Extracting binary from wheel");
483+
progress_bar.render()?;
477484
while total_extracted < file_size {
478485
let bytes_read = file.read(&mut buffer)?;
479486
if bytes_read == 0 {

clang-installer/src/downloader/static_dist.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,15 @@ impl StaticDistDownloader {
144144
} else {
145145
log::info!("Downloading static binary for {tool} version {ver_str} from {url}");
146146
download(&url, &download_path, 60 * 2).await?;
147+
#[cfg(unix)]
148+
{
149+
// Make the extracted binary executable on Unix-like systems.
150+
use std::os::unix::fs::PermissionsExt;
151+
let out = fs::OpenOptions::new().write(true).open(&download_path)?;
152+
let mut perms = out.metadata()?.permissions();
153+
perms.set_mode(0o755);
154+
out.set_permissions(perms)?;
155+
}
147156
}
148157
let sha512_cache_path = cache_path
149158
.join("static_dist")
@@ -159,15 +168,6 @@ impl StaticDistDownloader {
159168
"Downloading SHA512 checksum for {tool} version {ver_str} from {sha512_url}"
160169
);
161170
download(&sha512_url, &sha512_cache_path, 10).await?;
162-
#[cfg(unix)]
163-
{
164-
// Make the extracted binary executable on Unix-like systems.
165-
use std::os::unix::fs::PermissionsExt;
166-
let out = fs::OpenOptions::new().write(true).open(&download_path)?;
167-
let mut perms = out.metadata()?.permissions();
168-
perms.set_mode(0o755);
169-
out.set_permissions(perms)?;
170-
}
171171
}
172172
Self::verify_sha512(&download_path, &sha512_cache_path)?;
173173
Ok(download_path)

clang-installer/src/progress_bar.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl ProgressBar {
9696
write!(&mut self.stdout_handle, "{}", out)?;
9797
} else {
9898
// only write chars to line (without new line)
99-
let mut out = if self.current == 0 {
99+
let mut out = if self.steps == 0 {
100100
format!("{}{} ", Self::LOG_INDENT, self.prompt)
101101
} else {
102102
String::new()

clang-installer/src/version.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,22 @@ impl RequestedVersion {
101101
Ok(Some(ClangVersion { version, path }))
102102
}
103103
RequestedVersion::Requirement(version_req) => {
104+
if let Ok(path) =
105+
tool.get_exe_path(&RequestedVersion::Requirement(version_req.clone()))
106+
{
107+
let version = tool.capture_version(&path)?;
108+
if version_req.matches(&version) {
109+
log::info!(
110+
"Found {tool} version {version} at path: {:?}",
111+
path.to_string_lossy()
112+
);
113+
return Ok(Some(ClangVersion { version, path }));
114+
}
115+
}
104116
let bin = match PyPiDownloader::download_tool(tool, version_req).await {
105117
Ok(bin) => bin,
106118
Err(e) => {
107-
log::error!("Failed to download {tool} from PyPi: {e}");
119+
log::error!("Failed to download {tool} {version_req} from PyPi: {e}");
108120
if let Some(result) = try_install_package(tool, version_req)? {
109121
return Ok(Some(result));
110122
}

cpp-linter/src/clang_tools/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,15 @@ pub async fn capture_clang_tools_output(
108108
// info as debugging output.
109109
if clang_params.tidy_checks != "-*" {
110110
let tool = ClangTool::ClangTidy;
111-
let tool_info = version.eval_tool(&tool, true).await?.ok_or(anyhow!(
111+
let tool_info = version.eval_tool(&tool, false).await?.ok_or(anyhow!(
112112
"Failed to find {tool} or install a suitable version"
113113
))?;
114114
clang_versions.tidy_version = Some(tool_info.version);
115115
clang_params.clang_tidy_command = Some(tool_info.path);
116116
}
117117
if !clang_params.style.is_empty() {
118118
let tool = ClangTool::ClangFormat;
119-
let tool_info = version.eval_tool(&tool, true).await?.ok_or(anyhow!(
119+
let tool_info = version.eval_tool(&tool, false).await?.ok_or(anyhow!(
120120
"Failed to find {tool} or install a suitable version"
121121
))?;
122122
clang_versions.format_version = Some(tool_info.version);

cpp-linter/tests/comments.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,7 @@ async fn setup(lib_root: &Path, test_params: &TestParams) {
244244
if test_params.force_lgtm {
245245
args.push("-e=c".to_string());
246246
}
247-
let result = run_main(args).await;
248-
assert!(result.is_ok());
247+
run_main(args).await.unwrap();
249248
for mock in mocks {
250249
mock.assert();
251250
}

cpp-linter/tests/demo/.clang-tidy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,performance-*,bugprone-*,clang-analyzer-*,mpi-*,misc-*,readability-*'
33
WarningsAsErrors: '*'
44
HeaderFilterRegex: ''
5-
AnalyzeTemporaryDtors: false
65
FormatStyle: 'file'
76
CheckOptions:
87
- key: bugprone-argument-comment.CommentBoolLiterals

0 commit comments

Comments
 (0)