Skip to content

Commit 38e5dd2

Browse files
committed
Add Nightly Build and Release
1 parent b0a7296 commit 38e5dd2

5 files changed

Lines changed: 427 additions & 149 deletions

File tree

.github/workflows/build-linux.yml

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ jobs:
1212
DEPS_INSTALL_DIR: /opt/AliceVision_install
1313
BUILD_TYPE: Release
1414
CTEST_OUTPUT_ON_FAILURE: 1
15+
buildDir: '${{ github.workspace }}/build/'
1516
ALICEVISION_ROOT: ${{ github.workspace }}/../AV_install
17+
ALICEVISION_BUNDLE: ${{ github.workspace }}/../AV_bundle
1618
ALICEVISION_SENSOR_DB: ${{ github.workspace }}/../AV_install/share/aliceVision/cameraSensors.db
1719
ALICEVISION_LENS_PROFILE_INFO: ""
1820
steps:
@@ -45,8 +47,9 @@ jobs:
4547
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
4648
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
4749
-DBUILD_SHARED_LIBS=ON \
48-
-DCMAKE_PREFIX_PATH="${DEPS_INSTALL_DIR}" \
49-
-DCMAKE_INSTALL_PREFIX="${ALICEVISION_ROOT}" \
50+
-DCMAKE_PREFIX_PATH:PATH="${DEPS_INSTALL_DIR}" \
51+
-DCMAKE_INSTALL_PREFIX:PATH="${ALICEVISION_ROOT}" \
52+
-DALICEVISION_BUNDLE_PREFIX:PATH="${ALICEVISION_BUNDLE}" \
5053
-DTARGET_ARCHITECTURE=core \
5154
-DALICEVISION_BUILD_TESTS=ON \
5255
-DALICEVISION_BUILD_SWIG_BINDING=ON \
@@ -56,12 +59,12 @@ jobs:
5659
-DALICEVISION_USE_POPSIFT=ON \
5760
-DALICEVISION_USE_ALEMBIC=ON \
5861
-DALICEVISION_USE_USD=ON \
59-
-DOpenCV_DIR="${DEPS_INSTALL_DIR}/share/OpenCV" \
60-
-DCeres_DIR="${DEPS_INSTALL_DIR}/share/Ceres" \
61-
-DAlembic_DIR="${DEPS_INSTALL_DIR}/lib/cmake/Alembic" \
62-
-DSWIG_DIR="${DEPS_INSTALL_DIR}/share/swig/4.3.0" \
63-
-DSWIG_EXECUTABLE="${DEPS_INSTALL_DIR}/bin-deps/swig" \
64-
-DPython3_EXECUTABLE=/usr/bin/python
62+
-DOpenCV_DIR:PATH="${DEPS_INSTALL_DIR}/share/OpenCV" \
63+
-DCeres_DIR:PATH="${DEPS_INSTALL_DIR}/share/Ceres" \
64+
-DAlembic_DIR:PATH="${DEPS_INSTALL_DIR}/lib/cmake/Alembic" \
65+
-DSWIG_DIR:PATH="${DEPS_INSTALL_DIR}/share/swig/4.3.0" \
66+
-DSWIG_EXECUTABLE:PATH="${DEPS_INSTALL_DIR}/bin-deps/swig" \
67+
-DPython3_EXECUTABLE:PATH=/usr/bin/python
6568
6669
- name: Build
6770
working-directory: ./build
@@ -177,4 +180,31 @@ jobs:
177180
sys.exit(0)
178181
sys.exit(1)
179182
" | tee test_templatesVersions.py
180-
python test_templatesVersions.py
183+
python test_templatesVersions.py
184+
185+
# ── Bundle, Archive & Upload for nightly release ────────
186+
187+
- name: CMake Bundle
188+
working-directory: ./build
189+
run: |
190+
cmake --build . --config Release --target bundle
191+
192+
# Only runs when called from nightly.yml; skipped on regular CI.
193+
- name: Create archive
194+
if: github.workflow == 'Nightly'
195+
id: archive
196+
run: |
197+
git config --global --add safe.directory ${GITHUB_WORKSPACE}
198+
COMMIT_SHORT=$(git rev-parse --short=8 HEAD)
199+
DATE=$(date -u +%Y%m%d)
200+
ARCHIVE="AliceVision-nightly-${DATE}-${COMMIT_SHORT}-linux.tar.gz"
201+
tar -czf "${ARCHIVE}" -C "$(dirname ${ALICEVISION_BUNDLE})" "$(basename ${ALICEVISION_BUNDLE})"
202+
echo "filename=${ARCHIVE}" >> $GITHUB_OUTPUT
203+
204+
- name: Upload archive artifact
205+
if: github.workflow == 'Nightly'
206+
uses: actions/upload-artifact@v4
207+
with:
208+
name: linux-package
209+
path: ${{ steps.archive.outputs.filename }}
210+
retention-days: 3

.github/workflows/build-windows.yml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ jobs:
1313
archivePath: '${{ github.workspace }}\dependencies\installed.zip'
1414
BUILD_TYPE: Release
1515
CTEST_OUTPUT_ON_FAILURE: 1
16-
ALICEVISION_ROOT: '${{ github.workspace }}\install'
16+
ALICEVISION_ROOT: '${{ github.workspace }}/install'
17+
ALICEVISION_BUNDLE: ${{ github.workspace }}/install/bundle
1718
ALICEVISION_LIBPATH: '${{ github.workspace }}/install/bundle/bin'
1819
PYTHONPATH: '${{ github.workspace }}/install/bundle/lib/python'
1920
SCCACHE_GHA_ENABLED: "true"
@@ -151,6 +152,7 @@ jobs:
151152
-DBUILD_SHARED_LIBS=ON
152153
-DTARGET_ARCHITECTURE=core
153154
-DCMAKE_INSTALL_PREFIX=${{ env.ALICEVISION_ROOT }}
155+
-DALICEVISION_BUNDLE_PREFIX:PATH=${{ env.ALICEVISION_BUNDLE }}
154156
-DALICEVISION_BUILD_TESTS=ON
155157
-DALICEVISION_USE_OPENCV=ON
156158
-DALICEVISION_USE_CUDA=ON
@@ -174,7 +176,7 @@ jobs:
174176
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
175177
buildDirectory: ${{ env.buildDir }}
176178
buildWithCMakeArgs: '--config Release --target bundle --parallel ${{ env.NUM_CORES }}'
177-
cmakeAppendedArgs: -DCMAKE_INSTALL_PREFIX:PATH=${{ env.ALICEVISION_ROOT }}
179+
cmakeAppendedArgs: -DBUNDLE_INSTALL_PREFIX:PATH=${{ env.ALICEVISION_BUNDLE }}
178180
cmakeBuildType: Release
179181
buildWithCMake: true
180182

@@ -196,3 +198,23 @@ jobs:
196198
useVcpkgToolchainFile: true
197199
buildWithCMake: true
198200

201+
# ── Archive & upload for nightly release ────────
202+
# Only runs when called from nightly.yml; skipped on regular CI.
203+
- name: Create archive
204+
if: github.workflow == 'Nightly'
205+
id: archive
206+
shell: pwsh
207+
run: |
208+
$commitShort = (git rev-parse --short=8 HEAD).Trim()
209+
$date = (Get-Date -Format "yyyyMMdd")
210+
$archive = "AliceVision-nightly-${date}-${commitShort}-windows.zip"
211+
Compress-Archive -Path "$env:ALICEVISION_BUNDLE\*" -DestinationPath $archive
212+
echo "filename=$archive" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
213+
214+
- name: Upload archive artifact
215+
if: github.workflow == 'Nightly'
216+
uses: actions/upload-artifact@v4
217+
with:
218+
name: windows-package
219+
path: ${{ steps.archive.outputs.filename }}
220+
retention-days: 3

.github/workflows/nightly.yml

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
name: Nightly
2+
3+
on:
4+
schedule:
5+
# Every day at 02:00 UTC
6+
- cron: "0 2 * * *"
7+
workflow_dispatch:
8+
9+
# Cancel any in-progress nightly run if a new one is triggered
10+
concurrency:
11+
group: nightly
12+
cancel-in-progress: true
13+
14+
jobs:
15+
16+
# ───────────────────────────────────────────────
17+
# 1. Build & archive (archives created inside each build workflow)
18+
# ───────────────────────────────────────────────
19+
build-linux:
20+
uses: ./.github/workflows/build-linux.yml
21+
22+
build-windows:
23+
uses: ./.github/workflows/build-windows.yml
24+
25+
# ───────────────────────────────────────────────
26+
# 2. Publish to the "nightly" GitHub Release
27+
# ───────────────────────────────────────────────
28+
publish-nightly:
29+
needs: [build-linux, build-windows]
30+
runs-on: ubuntu-latest
31+
permissions:
32+
contents: write # required to create/edit releases and push tags
33+
34+
steps:
35+
- uses: actions/checkout@v4
36+
with:
37+
fetch-depth: 0 # full history for changelog
38+
39+
- name: Download Linux package
40+
uses: actions/download-artifact@v4
41+
with:
42+
name: linux-package
43+
path: dist
44+
45+
- name: Download Windows package
46+
uses: actions/download-artifact@v4
47+
with:
48+
name: windows-package
49+
path: dist
50+
51+
# ── Metadata ────────────────────────────────
52+
- name: Compute release metadata
53+
id: meta
54+
run: |
55+
SHORT_SHA=$(git rev-parse --short=8 HEAD)
56+
FULL_SHA=$(git rev-parse HEAD)
57+
NOW=$(date -u +'%Y-%m-%d %H:%M UTC')
58+
BUILD_LABEL=$(date -u +%Y%m%d)-${SHORT_SHA}
59+
echo "date=$(date -u +%Y-%m-%d)" >> $GITHUB_OUTPUT
60+
echo "short_sha=${SHORT_SHA}" >> $GITHUB_OUTPUT
61+
echo "full_sha=${FULL_SHA}" >> $GITHUB_OUTPUT
62+
echo "now=${NOW}" >> $GITHUB_OUTPUT
63+
echo "build_label=${BUILD_LABEL}" >> $GITHUB_OUTPUT
64+
65+
# ── Ensure release exists ────────────────────
66+
- name: Ensure nightly release exists
67+
env:
68+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69+
run: |
70+
if ! gh release view nightly --repo "${{ github.repository }}" > /dev/null 2>&1; then
71+
gh release create nightly \
72+
--repo "${{ github.repository }}" \
73+
--title "Nightly Build" \
74+
--notes "Nightly build — will be updated by CI." \
75+
--prerelease
76+
fi
77+
78+
# ── Delete stale assets ──────────────────────
79+
- name: Delete existing release assets
80+
env:
81+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82+
run: |
83+
gh release view nightly \
84+
--repo "$GITHUB_REPOSITORY" \
85+
--json assets \
86+
--jq '.assets[].name' \
87+
| while read -r ASSET; do
88+
echo " → Deleting asset: $ASSET"
89+
gh release delete-asset nightly "$ASSET" \
90+
--repo "$GITHUB_REPOSITORY" --yes
91+
done
92+
93+
# ── Upload fresh assets ──────────────────────
94+
- name: Upload release assets
95+
env:
96+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97+
run: |
98+
gh release upload nightly dist/* \
99+
--repo "${{ github.repository }}" \
100+
--clobber
101+
102+
# ── Write release notes to file ──────────────
103+
- name: Write release notes
104+
run: |
105+
NOW="${{ steps.meta.outputs.now }}"
106+
SHORT_SHA="${{ steps.meta.outputs.short_sha }}"
107+
BUILD_LABEL="${{ steps.meta.outputs.build_label }}"
108+
FULL_SHA="${{ steps.meta.outputs.full_sha }}"
109+
cat > nightly_release_notes.md << EOF
110+
> [!WARNING]
111+
> **Automated nightly build** from the \`develop\` branch. May be unstable.
112+
113+
| | |
114+
|---|---|
115+
| Date | ${NOW} |
116+
| Commit | [${SHORT_SHA}](https://github.com/${{ github.repository }}/commit/${{ github.sha }}) |
117+
| Branch | \`develop\` |
118+
119+
### Assets
120+
121+
| File | Platform |
122+
|------|----------|
123+
| \`AliceVision-nightly-${BUILD_LABEL}-linux.tar.gz\` | Linux (Rocky 9, CUDA 12.1.1) |
124+
| \`AliceVision-nightly-${BUILD_LABEL}-windows.zip\` | Windows |
125+
EOF
126+
127+
# ── Update release from file ──────────────────
128+
- name: Update release notes
129+
env:
130+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
131+
run: |
132+
gh release edit nightly \
133+
--repo "${{ github.repository }}" \
134+
--title "Nightly Build (${{ steps.meta.outputs.build_label }})" \
135+
--notes-file nightly_release_notes.md \
136+
--prerelease
137+

CMakeLists.txt

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ set(DEPS_CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type for all external li
4646
string(TOLOWER ${DEPS_CMAKE_BUILD_TYPE} DEPS_CMAKE_BUILD_TYPE_LOWERCASE)
4747
set(ALICEVISION_BUNDLE_PREFIX "${CMAKE_INSTALL_PREFIX}/bundle" CACHE STRING "Path for bundle installation")
4848
set(ALICEVISION_ROOT ${PROJECT_BINARY_DIR})
49+
option(ALICEVISION_BUNDLE_SEARCH_LIBS_PATHS "Extra paths to search for external libraries to create the bundle installation" "")
4950

5051
# ==============================================================================
5152
# GNUInstallDirs CMake module
@@ -123,15 +124,41 @@ endif()
123124
# Note: require that the install rule has been executed
124125
# Include VCPKG installed dir for runtime dependencies lookup
125126
set(BUNDLE_LIBS_PATHS "")
126-
if (_VCPKG_INSTALLED_DIR)
127-
set(BUNDLE_LIBS_PATHS ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$<CONFIG:Debug>:/debug>/bin)
127+
128+
if(_VCPKG_INSTALLED_DIR)
129+
set(_vcpkg_bin_dir_release "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin")
130+
set(_vcpkg_bin_dir_debug "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/bin")
131+
132+
# Generator expressions are not evaluated at install/bundle time,
133+
# so we resolve the config explicitly.
134+
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
135+
list(APPEND BUNDLE_LIBS_PATHS "${_vcpkg_bin_dir_debug}")
136+
else()
137+
list(APPEND BUNDLE_LIBS_PATHS "${_vcpkg_bin_dir_release}")
138+
endif()
139+
endif()
140+
141+
if(ALICEVISION_BUNDLE_SEARCH_LIBS_PATHS)
142+
list(APPEND BUNDLE_LIBS_PATHS ${ALICEVISION_BUNDLE_SEARCH_LIBS_PATHS})
143+
endif()
144+
145+
if(CMAKE_PREFIX_PATH)
146+
foreach(_prefix IN LISTS CMAKE_PREFIX_PATH)
147+
foreach(_libdir IN ITEMS bin lib lib64)
148+
set(_candidate "${_prefix}/${_libdir}")
149+
if(EXISTS "${_candidate}")
150+
list(APPEND BUNDLE_LIBS_PATHS "${_candidate}")
151+
endif()
152+
endforeach()
153+
endforeach()
128154
endif()
129155

130156
add_custom_target(bundle
131157
${CMAKE_COMMAND}
132158
-DBUNDLE_INSTALL_PREFIX=${ALICEVISION_BUNDLE_PREFIX}
133159
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
134160
-DBUNDLE_LIBS_PATHS=${BUNDLE_LIBS_PATHS}
161+
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
135162
-P ${CMAKE_CURRENT_SOURCE_DIR}/src/cmake/MakeBundle.cmake
136163
)
137164

0 commit comments

Comments
 (0)