Skip to content

Revert "Use different cache key for conan" #2657

Revert "Use different cache key for conan"

Revert "Use different cache key for conan" #2657

Workflow file for this run

name: CI
on: [push]
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
env:
# Packman
PM_PACKAGES_ROOT: ${{ github.workspace }}/packman-repo
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Windows - MSVC",
artifact: "windows-msvc.tar.xz",
os: windows-latest,
cc: "cl",
cxx: "cl",
build-type: "Release",
build-code: "Windows",
cache-type: "Windows",
generator: "Ninja Multi-Config",
coverage: "false",
}
- {
name: "Ubuntu - GCC",
artifact: "linux-gcc.tar.xz",
os: ubuntu-latest,
cc: "gcc-13",
cxx: "g++-13",
build-type: "Release",
build-code: "Ubuntu",
cache-type: "Linux",
generator: "Unix Makefiles",
coverage: "false",
}
- {
name: "AlmaLinux 8 - GCC",
artifact: "linux-gcc.tar.xz",
os: ubuntu-latest,
cc: "gcc-13",
cxx: "g++-13",
build-type: "Release",
build-code: "AlmaLinux8",
cache-type: "Linux",
generator: "Unix Makefiles",
coverage: "false",
}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: ilammy/msvc-dev-cmd@v1
- uses: SimenB/github-actions-cpu-cores@v1
id: cpu-cores
# Tell Conan to look for or create its build folder (.conan) in the repository's root directory
# This is partly done to make the directory easily accessible to Docker builds
- name: Conan Set build directory (Unix)
if: runner.os != 'Windows'
run: echo "CONAN_USER_HOME=$GITHUB_WORKSPACE" >> $GITHUB_ENV
# Disable short paths so that all packages are built in the same .conan directory
# This is safe to do since long paths are enabled on Windows Server 2022 in GitHub Actions
# See https://docs.conan.io/en/latest/reference/env_vars.html#conan-user-home-short
# See https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#maximum-path-length-limitation
# See https://github.com/actions/runner-images/issues/1052#issuecomment-644212560
- name: Conan Set build directory (Windows)
if: runner.os == 'Windows'
run: |
echo "CONAN_USER_HOME=$env:GITHUB_WORKSPACE" >> $env:GITHUB_ENV
echo "CONAN_USER_HOME_SHORT=None" >> $env:GITHUB_ENV
# The -v{num} is a cache key buster because we were starting to use the same cache keys from previous tests
# Unfortunately github actions doesn't let you delete old caches so we have to work around it like this
- name: Conan Check cache
id: conan-cache
uses: actions/cache@v3
with:
path: ${{ env.CONAN_USER_HOME }}/.conan
key: conan-${{ matrix.config.name }}-${{ hashFiles('cmake/AddConanDependencies.cmake') }}-v3
# Tell ezvcpkg to look for or create its build folder (.ezvcpkg) in the repository's root directory
# This is partly done to make the directory easily accessible to Docker builds
# We only need a release build of vcpkg dependencies
- name: vcpkg Set build directory (Unix)
if: runner.os != 'Windows'
run: |
echo "EZVCPKG_BASEDIR=$GITHUB_WORKSPACE/.ezvcpkg" >> $GITHUB_ENV
echo "CESIUM_VCPKG_RELEASE_ONLY=TRUE" >> $GITHUB_ENV
- name: vcpkg Set build directory (Windows)
if: runner.os == 'Windows'
run: |
echo "EZVCPKG_BASEDIR=$env:GITHUB_WORKSPACE/.ezvcpkg" >> $env:GITHUB_ENV
echo "CESIUM_VCPKG_RELEASE_ONLY=TRUE" >> $env:GITHUB_ENV
- name: vcpkg Check cache
id: vcpkg-cache
uses: actions/cache@v3
with:
path: ${{ env.EZVCPKG_BASEDIR }}
key: vcpkg-${{ matrix.config.name }}-${{ hashFiles('vcpkg/ports/**/*', 'vcpkg/triplets/**/*') }}-${{ hashFiles('extern/cesium-native/CMakeLists.txt', 'CMakeLists.txt') }}
- name: Packman Check cache
id: packman-cache
uses: actions/cache@v3
with:
path: ${{ env.PM_PACKAGES_ROOT }}
key: packman-${{ matrix.config.cache-type }}-${{ hashFiles('extern/nvidia/deps/kit-sdk.packman.xml', 'extern/nvidia/deps/target-deps.packman.xml') }}
- name: AlmaLinux Build with Docker
uses: ./.github/actions
if: matrix.config.name == 'AlmaLinux 8 - GCC'
with:
build-type: ${{ matrix.config.build-type }}
# Change the ownership from root to user for all files created by Docker in
# the Conan build directory so that the files can be cached without permission
# denied errors
- name: AlmaLinux Change Conan, vcpkg, and Packman directory permissions
if: matrix.config.name == 'AlmaLinux 8 - GCC'
run: |
sudo chown -R $USER:$USER $CONAN_USER_HOME/.conan
sudo chown -R $USER:$USER $PM_PACKAGES_ROOT
sudo chown -R $USER:$USER $EZVCPKG_BASEDIR
- name: Install Linux dependencies
if: ${{ runner.os == 'Linux' && matrix.config.name != 'AlmaLinux 8 - GCC' }}
run: |
sudo apt update
sudo apt install -y doxygen clang-tidy-15 gcovr
sudo pip3 install conan==1.63.0 black==23.1.0 flake8==7.1.1 --break-system-packages --ignore-installed
# Could not figure out how to add Chocolatey libraries to the PATH automatically with refreshenv, so
# hardcoding their locations instead. Followed these instructions for adding to the PATH on PowerShell:
# https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#environment-files
# Note that this is only a problem on CI, not with local builds
# Also requests is not installed by default on windows, but is expected by scripts/update_certs.py
- name: Install Windows dependencies
if: runner.os == 'Windows'
run: |
choco install -y conan --version 1.63.0
choco install -y llvm --version=15.0.7 --allow-downgrade
pip3 install black==23.1.0 flake8==7.1.1 requests
echo "C:/Program Files/conan/conan" >> $env:GITHUB_PATH
# Note: CMAKE_BUILD_TYPE is only used by Linux. It is ignored for Windows.
# Note: CMAKE_CONFIGURATION_TYPES is used by Windows to generate a single configuration for Release since we don't need Debug, RelWithDebugInfo, and MinSizeRel on CI. It is ignored for Linux.
- name: Configure
if: matrix.config.name != 'AlmaLinux 8 - GCC'
run: cmake -B build -D Python3_EXECUTABLE=python3 -D CESIUM_OMNI_ENABLE_TESTS=OFF -D CESIUM_OMNI_ENABLE_COVERAGE=${{ matrix.config.coverage}} -D CMAKE_C_COMPILER=${{ matrix.config.cc }} -D CMAKE_CXX_COMPILER=${{ matrix.config.cxx }} -D CMAKE_BUILD_TYPE=${{ matrix.config.build-type }} -D CMAKE_CONFIGURATION_TYPES=${{ matrix.config.build-type }} -G "${{ matrix.config.generator }}"
# Change the ownership from root to user for all files in the Conan cache so
# that DLLs can be used without permission denied errors
- name: Windows Change Conan directory permissions
if: runner.os == 'Windows'
run: |
$Path = "${{ env.CONAN_USER_HOME }}/.conan"
$Username = "$env:UserName"
$Acl = Get-Acl -Path $Path
$Ar = New-Object System.Security.AccessControl.FileSystemAccessRule($Username, 'FullControl', 'ContainerInherit,ObjectInherit', 'None', 'Allow')
$Acl.SetAccessRule($Ar)
- name: Check C/C++ Formatting
if: matrix.config.name != 'AlmaLinux 8 - GCC'
run: cmake --build build --target clang-format-check-all --config ${{ matrix.config.build-type }}
- name: Check Python Formatting
if: matrix.config.name != 'AlmaLinux 8 - GCC'
run: black --check --diff .
- name: Check Python Linting
if: matrix.config.name != 'AlmaLinux 8 - GCC'
run: flake8
- name: Build
if: matrix.config.name != 'AlmaLinux 8 - GCC'
run: cmake --build build --config ${{ matrix.config.build-type }} --parallel ${{ steps.cpu-cores.outputs.count }}
- name: Coverage
if: matrix.config.coverage == 'true'
run: cmake --build build --target generate-coverage --config ${{ matrix.config.build-type }}
- name: Documentation
# Currently disabled for Windows because `choco install doxygen.install` is flaky
if: ${{ matrix.config.name != 'AlmaLinux 8 - GCC' && runner.os != 'Windows' }}
run: cmake --build build --target generate-documentation --config ${{ matrix.config.build-type }}
- name: Install (Default/Kit)
if: matrix.config.name != 'AlmaLinux 8 - GCC'
run: cmake --install build --config ${{ matrix.config.build-type }}
- name: Install (Library)
if: matrix.config.name != 'AlmaLinux 8 - GCC'
run: cmake --install build --config ${{ matrix.config.build-type }} --prefix install-library --component library
- name: Package
if: matrix.config.name != 'AlmaLinux 8 - GCC'
run: cmake --build build --target package --config ${{ matrix.config.build-type }}
- name: Capture Git info (not Windows)
if: runner.os != 'Windows'
shell: bash
run: |
echo "branch=${{ github.ref_name }}" >> $GITHUB_ENV
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "us_date=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
echo "zip_name=$(find . -maxdepth 2 -type f -name "CesiumGS-cesium-omniverse*.zip" -exec basename {} \;)" >> $GITHUB_ENV
- name: Capture Git info (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
echo "branch=${{ github.ref_name }}" >> $env:GITHUB_ENV
echo "sha_short=$(git rev-parse --short HEAD)" >> $env:GITHUB_ENV
echo "us_date=$(Get-Date -Format "yyyy-MM-dd")" >> $env:GITHUB_ENV
echo "zip_name=$(Get-ChildItem -Path build/CesiumGS-cesium-omniverse*.zip -Name)" >> $env:GITHUB_ENV
- name: Capture AWS secrets
uses: aws-actions/configure-aws-credentials@v2
env:
AWS_S3_USERNAME: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_S3_PASSWORD: ${{ secrets.AWS_SECRET_KEY_ID }}
with:
aws-access-key-id: ${{ env.AWS_S3_USERNAME }}
aws-secret-access-key: ${{ env.AWS_S3_PASSWORD }}
aws-region: us-east-1
- name: Upload to S3
if: ${{ matrix.config.name == 'AlmaLinux 8 - GCC' || runner.os == 'Windows' }}
run: |
aws s3 cp build/${{ env.zip_name }} s3://cesium-builds/cesium-omniverse/${{ env.branch }}/${{ env.us_date }}/${{ env.sha_short }}/${{ matrix.config.build-code }}/