@@ -4,16 +4,27 @@ run-name: ${{ github.actor }} is building OpenMVS
44permissions :
55 contents : read
66
7+ concurrency :
8+ group : ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
9+ cancel-in-progress : true
10+
711on :
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
1521env :
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;files,${{ github.workspace }}/vcpkg-cache,readwrite
27+ VCPKG_COMMIT : ' c3867e714dd3a51c272826eea77267876517ed99'
1728
1829defaults :
1930 run :
@@ -22,6 +33,7 @@ defaults:
2233jobs :
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,39 @@ 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'
59+ BUILD_CONFIG : ${{ matrix.build-type }}
60+ CMAKE_EXTRA_ARGS : ${{ matrix.cmake-extra-args }}
4561
4662 steps :
47- - name : Checkout
63+ - &checkout-step
64+ name : Checkout
4865 uses : actions/checkout@v4
4966
50- - name : Export GitHub Actions cache environment variables
51- uses : actions/github-script@v7
67+ - &cache-vcpkg-step
68+ name : Cache vcpkg binary packages
69+ uses : actions/cache@v4
5270 with :
53- script : |
54- core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
55- core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
71+ path : ${{ github.workspace }}/vcpkg-cache
72+ key : vcpkg-${{ env.VCPKG_DEFAULT_TRIPLET }}-${{ env.VCPKG_COMMIT }}-${{ hashFiles('vcpkg.json') }}
73+ restore-keys : |
74+ vcpkg-${{ env.VCPKG_DEFAULT_TRIPLET }}-${{ env.VCPKG_COMMIT }}-
5675
57- - name : Setup vcpkg and cache artifacts
76+ - &setup-vcpkg-step
77+ name : Setup vcpkg and cache artifacts
5878 uses : lukka/run-vcpkg@v11
5979 with :
6080 vcpkgGitCommitId : ${{ env.VCPKG_COMMIT }}
@@ -63,58 +83,66 @@ jobs:
6383 if : matrix.os == 'ubuntu-latest'
6484 run : |
6585 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
86+ 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
6787
6888 - name : Install macOS dependencies
6989 if : matrix.os == 'macos-latest'
7090 run : |
7191 brew install automake autoconf autoconf-archive libtool ninja
7292
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'
93+ - &configure-step
94+ name : Configure CMake
8095 run : |
81- cmake -S . -B make -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} -DOpenMVS_USE_CUDA=OFF -G Ninja
96+ cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_BUILD_TYPE=${{ env.BUILD_CONFIG }} -DVCPKG_ROOT=${{ env.VCPKG_ROOT }} -DVCPKG_TARGET_TRIPLET=${{ env.VCPKG_DEFAULT_TRIPLET }} -DOpenMVS_USE_CUDA=OFF ${{ env.CMAKE_EXTRA_ARGS }}
8297
83- - name : Build
84- working-directory : ./make
98+ - &build-step
99+ name : Build
100+ working-directory : ./${{ env.BUILD_DIR }}
85101 run : |
86102 rm -rf ../vcpkg/buildtrees
87103 rm -rf ../vcpkg/downloads
88- cmake --build . --config ${{ matrix.build-type }} --parallel $(nproc)
104+ cmake --build . --config ${{ env.BUILD_CONFIG }} --parallel ${{ env.CI_PARALLEL_JOBS }}
89105
90106 - name : Unit Tests
91- working-directory : ./make
107+ working-directory : ./${{ env.BUILD_DIR }}
92108 run : |
93- ctest -j$(nproc) --build-config ${{ matrix.build-type }}
109+ ctest --parallel ${{ env.CI_PARALLEL_JOBS }} --build-config ${{ env.BUILD_CONFIG }}
94110
95- - name : Deploy Windows release
96- if : matrix.os == 'windows-latest'
111+ - name : Deploy release
97112 uses : actions/upload-artifact@v4
98113 with :
99- name : OpenMVS_Windows_Release_x64
114+ name : ${{ matrix.artifact-name }}
100115 path : |
101- ${{ github.workspace }}/make/bin/**/x64
102- !${{ github.workspace }}/make/bin/**/*.exp
116+ ${{ github.workspace }}/${{ env.BUILD_DIR }}/bin/**
117+ !${{ github.workspace }}/${{ env.BUILD_DIR }}/bin/**/*.exp
118+
119+ msvc-code-analysis :
120+ name : MSVC Code Analysis
121+ runs-on : windows-latest
122+ permissions :
123+ contents : read
124+ security-events : write
125+ actions : read
126+ env :
127+ VCPKG_DEFAULT_TRIPLET : x64-windows-release
128+ BUILD_CONFIG : Release
129+ CMAKE_EXTRA_ARGS : -A x64
103130
104- - name : Deploy Ubuntu release
105- if : matrix.os == 'ubuntu-latest'
106- uses : actions/upload-artifact@v4
131+ steps :
132+ - *checkout-step
133+ - *cache-vcpkg-step
134+ - *setup-vcpkg-step
135+ - *configure-step
136+ - *build-step
137+
138+ - name : Initialize MSVC Code Analysis
139+ uses : microsoft/msvc-code-analysis-action@04825f6d9e00f87422d6bf04e1a38b1f3ed60d99
140+ id : run-analysis
107141 with :
108- name : OpenMVS_Ubuntu_Release_x64
109- path : |
110- ${{ github.workspace }}/make/bin/**
111- !${{ github.workspace }}/make/bin/**/*.exp
142+ cmakeBuildDirectory : ${{ env.BUILD_DIR }}
143+ ruleset : NativeRecommendedRules.ruleset
112144
113- - name : Deploy macOS release
114- if : matrix.os == 'macos-latest'
115- uses : actions/upload-artifact@v4
145+ - name : Upload SARIF to GitHub
146+ uses : github/codeql-action/upload-sarif@v3
116147 with :
117- name : OpenMVS_macOS_Release_arm64
118- path : |
119- ${{ github.workspace }}/make/bin/**
120- !${{ github.workspace }}/make/bin/**/*.exp
148+ sarif_file : ${{ steps.run-analysis.outputs.sarif }}
0 commit comments