Skip to content

Commit 4831b8a

Browse files
committed
ci: consolidate MSVC code analysis into continuous integration workflow
1 parent 565ae5b commit 4831b8a

File tree

4 files changed

+63
-123
lines changed

4 files changed

+63
-123
lines changed

.github/workflows/continuous_integration.yml

Lines changed: 62 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,27 @@ run-name: ${{ github.actor }} is building OpenMVS
44
permissions:
55
contents: read
66

7+
concurrency:
8+
group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
9+
cancel-in-progress: true
10+
711
on:
812
push:
913
branches: [master, develop]
1014
pull_request:
1115
branches: [master, develop]
16+
schedule:
17+
- cron: '23 23 * * 5'
1218
# Allows to run this workflow manually from the Actions tab
1319
workflow_dispatch:
1420

1521
env:
22+
BUILD_DIR: make
1623
CTEST_OUTPUT_ON_FAILURE: 1
24+
CI_PARALLEL_JOBS: 2
25+
VCPKG_FEATURE_FLAGS: manifests,binarycaching,registries
26+
VCPKG_BINARY_SOURCES: clear;x-gha,readwrite
27+
VCPKG_COMMIT: 'c3867e714dd3a51c272826eea77267876517ed99'
1728

1829
defaults:
1930
run:
@@ -22,6 +33,7 @@ defaults:
2233
jobs:
2334
build-tests:
2435
name: Build on ${{ matrix.os }}
36+
if: github.event_name != 'schedule'
2537
runs-on: ${{ matrix.os }}
2638
strategy:
2739
fail-fast: false
@@ -30,31 +42,36 @@ jobs:
3042
- os: windows-latest
3143
triplet: x64-windows-release
3244
build-type: Release
45+
cmake-extra-args: -A x64
46+
artifact-name: OpenMVS_Windows_Release_x64
3347
- os: ubuntu-latest
3448
triplet: x64-linux-release
3549
build-type: Release
50+
cmake-extra-args: -G Ninja
51+
artifact-name: OpenMVS_Ubuntu_Release_x64
3652
- os: macos-latest
3753
triplet: arm64-osx
3854
build-type: Release
55+
cmake-extra-args: -G Ninja
56+
artifact-name: OpenMVS_macOS_Release_arm64
3957
env:
40-
# Turn on manifests and binary caching; use the GHA backend
41-
VCPKG_FEATURE_FLAGS: manifests,binarycaching,registries
42-
VCPKG_BINARY_SOURCES: clear;x-gha,readwrite
4358
VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }}
44-
VCPKG_COMMIT: 'ef7dbf94b9198bc58f45951adcf1f041fcbc5ea0'
4559

4660
steps:
47-
- name: Checkout
61+
- &checkout-step
62+
name: Checkout
4863
uses: actions/checkout@v4
4964

50-
- name: Export GitHub Actions cache environment variables
65+
- &export-cache-env-step
66+
name: Export GitHub Actions cache environment variables
5167
uses: actions/github-script@v7
5268
with:
5369
script: |
5470
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
5571
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
5672
57-
- name: Setup vcpkg and cache artifacts
73+
- &setup-vcpkg-step
74+
name: Setup vcpkg and cache artifacts
5875
uses: lukka/run-vcpkg@v11
5976
with:
6077
vcpkgGitCommitId: ${{ env.VCPKG_COMMIT }}
@@ -63,58 +80,64 @@ jobs:
6380
if: matrix.os == 'ubuntu-latest'
6481
run: |
6582
sudo apt-get update -y
66-
sudo apt-get install -y autoconf-archive libxmu-dev libdbus-1-dev libxtst-dev libxi-dev libxinerama-dev libxcursor-dev xorg-dev libgl-dev libglu1-mesa-dev autoconf automake bison libtool libltdl-dev pkg-config ninja-build
83+
sudo apt-get install -y autoconf-archive libxmu-dev libdbus-1-dev libxtst-dev libxi-dev libxinerama-dev libxcursor-dev xorg-dev libgl-dev libglu1-mesa-dev autoconf automake bison libtool libltdl-dev pkg-config nasm ninja-build
6784
6885
- name: Install macOS dependencies
6986
if: matrix.os == 'macos-latest'
7087
run: |
7188
brew install automake autoconf autoconf-archive libtool ninja
7289
73-
- name: Configure CMake for Windows
74-
if: matrix.os == 'windows-latest'
75-
run: |
76-
cmake -S . -B make -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} -DOpenMVS_USE_CUDA=OFF
77-
78-
- name: Configure CMake for Ubuntu and macOS
79-
if: matrix.os != 'windows-latest'
90+
- name: Configure CMake
8091
run: |
81-
cmake -S . -B make -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} -DOpenMVS_USE_CUDA=OFF -G Ninja
92+
cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DVCPKG_ROOT=${{ env.VCPKG_ROOT }} -DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} -DOpenMVS_USE_CUDA=OFF ${{ matrix.cmake-extra-args }}
8293
8394
- name: Build
84-
working-directory: ./make
95+
working-directory: ./${{ env.BUILD_DIR }}
8596
run: |
8697
rm -rf ../vcpkg/buildtrees
8798
rm -rf ../vcpkg/downloads
88-
cmake --build . --config ${{ matrix.build-type }} --parallel $(nproc)
99+
cmake --build . --config ${{ matrix.build-type }} --parallel ${{ env.CI_PARALLEL_JOBS }}
89100
90101
- name: Unit Tests
91-
working-directory: ./make
102+
working-directory: ./${{ env.BUILD_DIR }}
92103
run: |
93-
ctest -j$(nproc) --build-config ${{ matrix.build-type }}
104+
ctest --parallel ${{ env.CI_PARALLEL_JOBS }} --build-config ${{ matrix.build-type }}
94105
95-
- name: Deploy Windows release
96-
if: matrix.os == 'windows-latest'
106+
- name: Deploy release
97107
uses: actions/upload-artifact@v4
98108
with:
99-
name: OpenMVS_Windows_Release_x64
109+
name: ${{ matrix.artifact-name }}
100110
path: |
101-
${{ github.workspace }}/make/bin/**/x64
102-
!${{ github.workspace }}/make/bin/**/*.exp
111+
${{ github.workspace }}/${{ env.BUILD_DIR }}/bin/**
112+
!${{ github.workspace }}/${{ env.BUILD_DIR }}/bin/**/*.exp
113+
114+
msvc-code-analysis:
115+
name: MSVC Code Analysis
116+
runs-on: windows-latest
117+
permissions:
118+
contents: read
119+
security-events: write
120+
actions: read
121+
env:
122+
VCPKG_DEFAULT_TRIPLET: x64-windows-release
103123

104-
- name: Deploy Ubuntu release
105-
if: matrix.os == 'ubuntu-latest'
106-
uses: actions/upload-artifact@v4
124+
steps:
125+
- *checkout-step
126+
- *export-cache-env-step
127+
- *setup-vcpkg-step
128+
129+
- name: Configure CMake for MSVC analysis
130+
run: |
131+
cmake -S . -B ${{ env.BUILD_DIR }} -A x64 -DCMAKE_CONFIGURATION_TYPES=Release -DVCPKG_ROOT=${{ env.VCPKG_ROOT }} -DVCPKG_TARGET_TRIPLET=${{ env.VCPKG_DEFAULT_TRIPLET }} -DOpenMVS_USE_CUDA=OFF
132+
133+
- name: Initialize MSVC Code Analysis
134+
uses: microsoft/msvc-code-analysis-action@04825f6d9e00f87422d6bf04e1a38b1f3ed60d99
135+
id: run-analysis
107136
with:
108-
name: OpenMVS_Ubuntu_Release_x64
109-
path: |
110-
${{ github.workspace }}/make/bin/**
111-
!${{ github.workspace }}/make/bin/**/*.exp
137+
cmakeBuildDirectory: ${{ env.BUILD_DIR }}
138+
ruleset: NativeRecommendedRules.ruleset
112139

113-
- name: Deploy macOS release
114-
if: matrix.os == 'macos-latest'
115-
uses: actions/upload-artifact@v4
140+
- name: Upload SARIF to GitHub
141+
uses: github/codeql-action/upload-sarif@v3
116142
with:
117-
name: OpenMVS_macOS_Release_arm64
118-
path: |
119-
${{ github.workspace }}/make/bin/**
120-
!${{ github.workspace }}/make/bin/**/*.exp
143+
sarif_file: ${{ steps.run-analysis.outputs.sarif }}

.github/workflows/msvc.yml

Lines changed: 0 additions & 66 deletions
This file was deleted.

apps/Viewer/UI.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1509,7 +1509,7 @@ void UI::ShowCameraInfoDialog(Window& window) {
15091509
// Highlight and make the entire row clickable by using Selectable
15101510
const bool isSelected(window.selectedNeighborCamera == neighbor.ID);
15111511
String rowLabel = String::FormatString("%u/%u##neighbor_%u", neighbor.ID, neighborImage.ID, neighbor.ID);
1512-
bool rowClicked = ImGui::Selectable(rowLabel.c_str(), isSelected, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowItemOverlap);
1512+
bool rowClicked = ImGui::Selectable(rowLabel.c_str(), isSelected, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowOverlap);
15131513
// Handle row click
15141514
if (rowClicked) {
15151515
// Deselect if already selected, or select it otherwise

libs/MVS/Mesh.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -944,23 +944,6 @@ void Mesh::Clean(float fDecimate, float fSpurious, bool bRemoveSpikes, unsigned
944944
DEBUG_ULTIMATE("Mesh decimated: %d -> %d faces", OriginalFaceNum, (int)sm.number_of_faces());
945945
}
946946

947-
// decimate mesh
948-
if (fDecimate < 1) {
949-
ASSERT(fDecimate > 0);
950-
const int OriginalFaceNum((int)sm.number_of_faces());
951-
const int TargetFaceNum(ROUND2INT(fDecimate * OriginalFaceNum));
952-
Util::Progress progress(_T("Decimated faces"), OriginalFaceNum - TargetFaceNum);
953-
typedef CLEAN::SMS::GarlandHeckbert_triangle_policies<CLEAN::SurfaceMesh, CLEAN::K> GH_policies;
954-
GH_policies gh_policies(sm);
955-
CLEAN::SMS::Face_count_stop_predicate<CLEAN::SurfaceMesh> stop(TargetFaceNum);
956-
CLEAN::SMS::edge_collapse(sm, stop,
957-
CGAL::parameters::get_cost(gh_policies.get_cost())
958-
.get_placement(gh_policies.get_placement()));
959-
sm.collect_garbage();
960-
progress.close();
961-
DEBUG_ULTIMATE("Mesh decimated: %d -> %d faces", OriginalFaceNum, (int)sm.number_of_faces());
962-
}
963-
964947
// close holes
965948
if (nCloseHoles > 0) {
966949
std::vector<CLEAN::halfedge_descriptor> borderCycles;

0 commit comments

Comments
 (0)