Feature/2158 cielim upgrade #2492
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "Pull Request Test" | |
| on: | |
| pull_request: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| defaults: | |
| run: | |
| shell: bash --noprofile --norc -euo pipefail {0} | |
| env: | |
| USERNAME: ${{ github.repository_owner }} | |
| FEED_URL: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json | |
| VCPKG_BINARY_SOURCES: "clear;nuget,https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json,readwrite" | |
| VCPKG_FEATURE_FLAGS: "manifests,registries,binarycaching" | |
| CMAKE_BUILD_PARALLEL_LEVEL: 4 | |
| CTEST_PARALLEL_LEVEL: 4 | |
| CTEST_OUTPUT_ON_FAILURE: 1 | |
| jobs: | |
| pre-commit: | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| cache: 'pip' | |
| cache-dependency-path: | | |
| requirements.txt | |
| **/pyproject.toml | |
| **/requirements*.txt | |
| - uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pre-commit | |
| key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }} | |
| - name: Install clang-format (Linux static binary) | |
| run: | | |
| sudo wget -qO /usr/local/bin/clang-format https://github.com/cpp-linter/clang-tools-static-binaries/releases/latest/download/clang-format-20_linux-amd64 | |
| sudo chmod a+x /usr/local/bin/clang-format | |
| clang-format --version | |
| - id: file_changes | |
| uses: tj-actions/changed-files@v46 | |
| - name: Run pre-commit (changed files) | |
| uses: pre-commit/action@v3.0.1 | |
| with: | |
| extra_args: --color always --files ${{ steps.file_changes.outputs.all_changed_files }} | |
| build-test: | |
| name: Build & Test (${{ matrix.os }} / py${{ matrix.python-version }}) | |
| runs-on: ${{ matrix.os }} | |
| if: ${{ github.event.pull_request.draft == false }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-24.04, macos-14] | |
| python-version: ["3.9", "3.14"] | |
| exclude: | |
| - os: macos-14 | |
| python-version: "3.9" | |
| permissions: | |
| contents: read | |
| packages: write | |
| actions: read | |
| security-events: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| cache-dependency-path: | | |
| requirements.txt | |
| **/pyproject.toml | |
| **/requirements*.txt | |
| - name: Install system dependencies (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| ninja-build build-essential \ | |
| pkg-config autoconf automake libtool \ | |
| zip unzip \ | |
| bison swig \ | |
| libdrm-dev \ | |
| libx11-dev libxkbcommon-x11-dev libx11-xcb-dev \ | |
| libxft-dev libxext-dev libgles2-mesa-dev \ | |
| libxi-dev libxtst-dev libxrandr-dev libltdl-dev \ | |
| libgtk2.0-dev \ | |
| python3-setuptools python3-jinja2 python3-tk \ | |
| mono-complete | |
| - name: Install system dependencies (macOS) | |
| if: runner.os == 'macOS' | |
| env: | |
| HOMEBREW_NO_AUTO_UPDATE: 1 | |
| HOMEBREW_NO_ANALYTICS: 1 | |
| run: | | |
| brew install ninja swig pkg-config mono || true | |
| swig -version | |
| mono --version || true | |
| - name: Setup CMake 3.28.3 | |
| uses: jwlawson/actions-setup-cmake@v2 | |
| with: | |
| cmake-version: '3.28.3' | |
| - name: Install vcpkg | |
| uses: lukka/run-vcpkg@v11 | |
| with: | |
| vcpkgDirectory: '${{ runner.workspace }}/b/vcpkg' | |
| vcpkgJsonGlob: "src/vcpkg.json" | |
| vcpkgConfigurationJsonGlob: "src/vcpkg-configuration.json" | |
| - name: Cache vcpkg build artifacts | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ${{ runner.workspace }}/b/vcpkg/installed | |
| ${{ runner.workspace }}/b/vcpkg/packages | |
| ${{ runner.workspace }}/b/vcpkg/buildtrees | |
| key: vcpkg-${{ runner.os }}-${{ hashFiles('src/vcpkg.json', 'src/vcpkg-configuration.json') }} | |
| - name: Add NuGet sources for vcpkg binary cache (portable) | |
| env: | |
| VCPKG_EXE: ${{ runner.workspace }}/b/vcpkg/vcpkg | |
| run: | | |
| set -euo pipefail | |
| NUGET="$(${VCPKG_EXE} fetch nuget | tail -n 1)" | |
| # Build the command invocation safely (handles paths with spaces) | |
| if [[ "$NUGET" == *.exe ]]; then | |
| NUGET_CMD=(mono "$NUGET") | |
| else | |
| # e.g., "nuget" shim from Mono on macOS, or a native path | |
| NUGET_CMD=("$NUGET") | |
| fi | |
| echo "Using NuGet CLI: ${NUGET_CMD[*]}" | |
| "${NUGET_CMD[@]}" sources add \ | |
| -Source "${FEED_URL}" \ | |
| -StorePasswordInClearText \ | |
| -Name GitHubPackages \ | |
| -UserName "${USERNAME}" \ | |
| -Password "${{ secrets.GH_VCPKG_PACKAGES_TOKEN }}" | |
| "${NUGET_CMD[@]}" setapikey "${{ secrets.GH_VCPKG_PACKAGES_TOKEN }}" \ | |
| -Source "${FEED_URL}" | |
| - name: Create virtual environment | |
| run: | | |
| python -m venv .venv | |
| source .venv/bin/activate | |
| python -V | |
| pip -V | |
| - name: Install required Python dependencies | |
| run: | | |
| source .venv/bin/activate | |
| python -m pip install -r requirements.txt | |
| - name: Configure (CMake preset) | |
| working-directory: src | |
| env: | |
| VCPKG_BINARY_SOURCES: "clear;nuget,${{ env.FEED_URL }},readwrite" | |
| run: | | |
| source ${{ github.workspace }}/.venv/bin/activate | |
| PY_PREFIX=${{ env.pythonLocation }} | |
| PY_VER=$(python -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')") | |
| if [[ "$RUNNER_OS" == "Linux" ]]; then | |
| PY_LIB_EXT="so" | |
| else | |
| PY_LIB_EXT="dylib" | |
| fi | |
| cmake --preset fuzz-smoke-test \ | |
| -DPython3_EXECUTABLE=$PY_PREFIX/bin/python3 \ | |
| -DPython3_LIBRARY=$PY_PREFIX/lib/libpython${PY_VER}.${PY_LIB_EXT} \ | |
| -DPython3_INCLUDE_DIR=$PY_PREFIX/include/python${PY_VER} \ | |
| -DPython3_FIND_FRAMEWORK=NEVER | |
| - name: Build | |
| working-directory: src | |
| run: cmake --build ../build --parallel | |
| - name: Install Xmera (editable) | |
| run: | | |
| source .venv/bin/activate | |
| cmake --install build --prefix $(pwd)/dist | |
| python -m pip install -e . | |
| - name: Run Python tests | |
| run: | | |
| source .venv/bin/activate | |
| cd src | |
| pytest -n auto -m "not scenarioTest" --junitxml=../junit/test-results-${{ matrix.python-version }}.xml | |
| - name: Upload pytest test results | |
| if: ${{ always() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pytest-${{ matrix.os }}-py${{ matrix.python-version }} | |
| path: junit/test-results-${{ matrix.python-version }}.xml | |
| retention-days: 7 | |
| - name: Run C/C++ unit tests (include fuzz-smoke) | |
| working-directory: ./build | |
| env: | |
| CTEST_PARALLEL_LEVEL: 1 | |
| run: ctest --output-on-failure -LE fuzz | |
| - name: Upload CMake & test logs on failure | |
| if: ${{ failure() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: cmake-logs-${{ matrix.os }}-py${{ matrix.python-version }} | |
| path: | | |
| dist3/CMakeCache.txt | |
| dist3/CMakeFiles/CMakeOutput.log | |
| dist3/CMakeFiles/CMakeError.log | |
| **/Testing/Temporary/LastTest.log | |
| retention-days: 7 |