Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 39 additions & 9 deletions .github/workflows/build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ jobs:
DEPS_INSTALL_DIR: /opt/AliceVision_install
BUILD_TYPE: Release
CTEST_OUTPUT_ON_FAILURE: 1
buildDir: '${{ github.workspace }}/build/'
ALICEVISION_ROOT: ${{ github.workspace }}/../AV_install
ALICEVISION_BUNDLE: ${{ github.workspace }}/../AV_bundle
ALICEVISION_SENSOR_DB: ${{ github.workspace }}/../AV_install/share/aliceVision/cameraSensors.db
ALICEVISION_LENS_PROFILE_INFO: ""
steps:
Expand Down Expand Up @@ -45,8 +47,9 @@ jobs:
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_PREFIX_PATH="${DEPS_INSTALL_DIR}" \
-DCMAKE_INSTALL_PREFIX="${ALICEVISION_ROOT}" \
-DCMAKE_PREFIX_PATH:PATH="${DEPS_INSTALL_DIR}" \
-DCMAKE_INSTALL_PREFIX:PATH="${ALICEVISION_ROOT}" \
-DALICEVISION_BUNDLE_PREFIX:PATH="${ALICEVISION_BUNDLE}" \
-DTARGET_ARCHITECTURE=core \
-DALICEVISION_BUILD_TESTS=ON \
-DALICEVISION_BUILD_SWIG_BINDING=ON \
Expand All @@ -56,12 +59,12 @@ jobs:
-DALICEVISION_USE_POPSIFT=ON \
-DALICEVISION_USE_ALEMBIC=ON \
-DALICEVISION_USE_USD=ON \
-DOpenCV_DIR="${DEPS_INSTALL_DIR}/share/OpenCV" \
-DCeres_DIR="${DEPS_INSTALL_DIR}/share/Ceres" \
-DAlembic_DIR="${DEPS_INSTALL_DIR}/lib/cmake/Alembic" \
-DSWIG_DIR="${DEPS_INSTALL_DIR}/share/swig/4.3.0" \
-DSWIG_EXECUTABLE="${DEPS_INSTALL_DIR}/bin-deps/swig" \
-DPython3_EXECUTABLE=/usr/bin/python
-DOpenCV_DIR:PATH="${DEPS_INSTALL_DIR}/share/OpenCV" \
-DCeres_DIR:PATH="${DEPS_INSTALL_DIR}/share/Ceres" \
-DAlembic_DIR:PATH="${DEPS_INSTALL_DIR}/lib/cmake/Alembic" \
-DSWIG_DIR:PATH="${DEPS_INSTALL_DIR}/share/swig/4.3.0" \
-DSWIG_EXECUTABLE:PATH="${DEPS_INSTALL_DIR}/bin-deps/swig" \
-DPython3_EXECUTABLE:PATH=/usr/bin/python

- name: Build
working-directory: ./build
Expand Down Expand Up @@ -177,4 +180,31 @@ jobs:
sys.exit(0)
sys.exit(1)
" | tee test_templatesVersions.py
python test_templatesVersions.py
python test_templatesVersions.py

# ── Bundle, Archive & Upload for nightly release ────────

- name: CMake Bundle
working-directory: ./build
run: |
cmake --build . --config Release --target bundle

# Only runs when called from nightly.yml; skipped on regular CI.
- name: Create archive
if: github.workflow == 'Nightly'
id: archive
run: |
git config --global --add safe.directory ${GITHUB_WORKSPACE}
COMMIT_SHORT=$(git rev-parse --short=8 HEAD)
DATE=$(date -u +%Y%m%d)
ARCHIVE="AliceVision-nightly-${DATE}-${COMMIT_SHORT}-linux.tar.gz"
tar -czf "${ARCHIVE}" -C "$(dirname ${ALICEVISION_BUNDLE})" "$(basename ${ALICEVISION_BUNDLE})"
echo "filename=${ARCHIVE}" >> $GITHUB_OUTPUT

- name: Upload archive artifact
if: github.workflow == 'Nightly'
uses: actions/upload-artifact@v4
with:
name: linux-package
path: ${{ steps.archive.outputs.filename }}
retention-days: 3
26 changes: 24 additions & 2 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ jobs:
archivePath: '${{ github.workspace }}\dependencies\installed.zip'
BUILD_TYPE: Release
CTEST_OUTPUT_ON_FAILURE: 1
ALICEVISION_ROOT: '${{ github.workspace }}\install'
ALICEVISION_ROOT: '${{ github.workspace }}/install'
ALICEVISION_BUNDLE: ${{ github.workspace }}/install/bundle
ALICEVISION_LIBPATH: '${{ github.workspace }}/install/bundle/bin'
PYTHONPATH: '${{ github.workspace }}/install/bundle/lib/python'
SCCACHE_GHA_ENABLED: "true"
Expand Down Expand Up @@ -151,6 +152,7 @@ jobs:
-DBUILD_SHARED_LIBS=ON
-DTARGET_ARCHITECTURE=core
-DCMAKE_INSTALL_PREFIX=${{ env.ALICEVISION_ROOT }}
-DALICEVISION_BUNDLE_PREFIX:PATH=${{ env.ALICEVISION_BUNDLE }}
-DALICEVISION_BUILD_TESTS=ON
-DALICEVISION_USE_OPENCV=ON
-DALICEVISION_USE_CUDA=ON
Expand All @@ -174,7 +176,7 @@ jobs:
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
buildDirectory: ${{ env.buildDir }}
buildWithCMakeArgs: '--config Release --target bundle --parallel ${{ env.NUM_CORES }}'
cmakeAppendedArgs: -DCMAKE_INSTALL_PREFIX:PATH=${{ env.ALICEVISION_ROOT }}
cmakeAppendedArgs: -DBUNDLE_INSTALL_PREFIX:PATH=${{ env.ALICEVISION_BUNDLE }}
cmakeBuildType: Release
buildWithCMake: true

Expand All @@ -196,3 +198,23 @@ jobs:
useVcpkgToolchainFile: true
buildWithCMake: true

# ── Archive & upload for nightly release ────────
# Only runs when called from nightly.yml; skipped on regular CI.
- name: Create archive
if: github.workflow == 'Nightly'
id: archive
shell: pwsh
run: |
$commitShort = (git rev-parse --short=8 HEAD).Trim()
$date = (Get-Date -Format "yyyyMMdd")
$archive = "AliceVision-nightly-${date}-${commitShort}-windows.zip"
Compress-Archive -Path "$env:ALICEVISION_BUNDLE\*" -DestinationPath $archive
echo "filename=$archive" | Out-File -FilePath $env:GITHUB_OUTPUT -Append

- name: Upload archive artifact
if: github.workflow == 'Nightly'
uses: actions/upload-artifact@v4
with:
name: windows-package
path: ${{ steps.archive.outputs.filename }}
retention-days: 3
137 changes: 137 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: Nightly

on:
schedule:
# Every day at 02:00 UTC
- cron: "0 2 * * *"
workflow_dispatch:

# Cancel any in-progress nightly run if a new one is triggered
concurrency:
group: nightly
cancel-in-progress: true

jobs:

# ───────────────────────────────────────────────
# 1. Build & archive (archives created inside each build workflow)
# ───────────────────────────────────────────────
build-linux:
uses: ./.github/workflows/build-linux.yml

build-windows:
uses: ./.github/workflows/build-windows.yml

# ───────────────────────────────────────────────
# 2. Publish to the "nightly" GitHub Release
# ───────────────────────────────────────────────
publish-nightly:
needs: [build-linux, build-windows]
runs-on: ubuntu-latest
permissions:
contents: write # required to create/edit releases and push tags

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # full history for changelog

- name: Download Linux package
uses: actions/download-artifact@v4
with:
name: linux-package
path: dist

- name: Download Windows package
uses: actions/download-artifact@v4
with:
name: windows-package
path: dist

# ── Metadata ────────────────────────────────
- name: Compute release metadata
id: meta
run: |
SHORT_SHA=$(git rev-parse --short=8 HEAD)
FULL_SHA=$(git rev-parse HEAD)
NOW=$(date -u +'%Y-%m-%d %H:%M UTC')
BUILD_LABEL=$(date -u +%Y%m%d)-${SHORT_SHA}
echo "date=$(date -u +%Y-%m-%d)" >> $GITHUB_OUTPUT
echo "short_sha=${SHORT_SHA}" >> $GITHUB_OUTPUT
echo "full_sha=${FULL_SHA}" >> $GITHUB_OUTPUT
echo "now=${NOW}" >> $GITHUB_OUTPUT
echo "build_label=${BUILD_LABEL}" >> $GITHUB_OUTPUT

# ── Ensure release exists ────────────────────
- name: Ensure nightly release exists
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if ! gh release view nightly --repo "${{ github.repository }}" > /dev/null 2>&1; then
gh release create nightly \
--repo "${{ github.repository }}" \
--title "Nightly Build" \
--notes "Nightly build — will be updated by CI." \
--prerelease
fi

# ── Delete stale assets ──────────────────────
- name: Delete existing release assets
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release view nightly \
--repo "$GITHUB_REPOSITORY" \
--json assets \
--jq '.assets[].name' \
| while read -r ASSET; do
echo " → Deleting asset: $ASSET"
gh release delete-asset nightly "$ASSET" \
--repo "$GITHUB_REPOSITORY" --yes
done

# ── Upload fresh assets ──────────────────────
- name: Upload release assets
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload nightly dist/* \
--repo "${{ github.repository }}" \
--clobber

# ── Write release notes to file ──────────────
- name: Write release notes
run: |
NOW="${{ steps.meta.outputs.now }}"
SHORT_SHA="${{ steps.meta.outputs.short_sha }}"
BUILD_LABEL="${{ steps.meta.outputs.build_label }}"
FULL_SHA="${{ steps.meta.outputs.full_sha }}"
cat > nightly_release_notes.md << EOF
> [!WARNING]
> **Automated nightly build** from the \`develop\` branch. May be unstable.

| | |
|---|---|
| Date | ${NOW} |
| Commit | [${SHORT_SHA}](https://github.com/${{ github.repository }}/commit/${{ github.sha }}) |
| Branch | \`develop\` |

### Assets

| File | Platform |
|------|----------|
| \`AliceVision-nightly-${BUILD_LABEL}-linux.tar.gz\` | Linux (Rocky 9, CUDA 12.1.1) |
| \`AliceVision-nightly-${BUILD_LABEL}-windows.zip\` | Windows |
EOF

# ── Update release from file ──────────────────
- name: Update release notes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release edit nightly \
--repo "${{ github.repository }}" \
--title "Nightly Build (${{ steps.meta.outputs.build_label }})" \
--notes-file nightly_release_notes.md \
--prerelease

31 changes: 29 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ set(DEPS_CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type for all external li
string(TOLOWER ${DEPS_CMAKE_BUILD_TYPE} DEPS_CMAKE_BUILD_TYPE_LOWERCASE)
set(ALICEVISION_BUNDLE_PREFIX "${CMAKE_INSTALL_PREFIX}/bundle" CACHE STRING "Path for bundle installation")
set(ALICEVISION_ROOT ${PROJECT_BINARY_DIR})
option(ALICEVISION_BUNDLE_SEARCH_LIBS_PATHS "Extra paths to search for external libraries to create the bundle installation" "")

# ==============================================================================
# GNUInstallDirs CMake module
Expand Down Expand Up @@ -123,15 +124,41 @@ endif()
# Note: require that the install rule has been executed
# Include VCPKG installed dir for runtime dependencies lookup
set(BUNDLE_LIBS_PATHS "")
if (_VCPKG_INSTALLED_DIR)
set(BUNDLE_LIBS_PATHS ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$<CONFIG:Debug>:/debug>/bin)

if(_VCPKG_INSTALLED_DIR)
set(_vcpkg_bin_dir_release "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin")
set(_vcpkg_bin_dir_debug "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/bin")

# Generator expressions are not evaluated at install/bundle time,
# so we resolve the config explicitly.
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
list(APPEND BUNDLE_LIBS_PATHS "${_vcpkg_bin_dir_debug}")
else()
list(APPEND BUNDLE_LIBS_PATHS "${_vcpkg_bin_dir_release}")
endif()
endif()

if(ALICEVISION_BUNDLE_SEARCH_LIBS_PATHS)
list(APPEND BUNDLE_LIBS_PATHS ${ALICEVISION_BUNDLE_SEARCH_LIBS_PATHS})
endif()

if(CMAKE_PREFIX_PATH)
foreach(_prefix IN LISTS CMAKE_PREFIX_PATH)
foreach(_libdir IN ITEMS bin lib lib64)
set(_candidate "${_prefix}/${_libdir}")
if(EXISTS "${_candidate}")
list(APPEND BUNDLE_LIBS_PATHS "${_candidate}")
endif()
endforeach()
endforeach()
endif()

add_custom_target(bundle
${CMAKE_COMMAND}
-DBUNDLE_INSTALL_PREFIX=${ALICEVISION_BUNDLE_PREFIX}
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
-DBUNDLE_LIBS_PATHS=${BUNDLE_LIBS_PATHS}
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
-P ${CMAKE_CURRENT_SOURCE_DIR}/src/cmake/MakeBundle.cmake
)

Expand Down
Loading
Loading