Skip to content

Use composite actions #4

Use composite actions

Use composite actions #4

Workflow file for this run

name: __conda_cpp_tests

Check failure on line 1 in .github/workflows/conda_cpp_tests.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/conda_cpp_tests.yml

Invalid workflow file

(Line: 96, Col: 16): Unrecognized named-value: 'inputs'. Located at position 1 within expression: inputs.platform == 'win_64' && 'cmd /C call {0}' || 'bash -l {0}'
permissions:
contents: read
on:
workflow_call:
inputs:
platform:
required: true
type: string
description: 'Platform identifier (linux_64, osx_arm64, win_64)'
artifact_name:
required: true
type: string
description: 'Name of the build artifact to download'
cmake_preset:
required: true
type: string
description: 'CMake preset name'
build_dir:
required: true
type: string
description: 'Build directory path'
free_disk_space:
required: false
type: boolean
default: false
description: 'Whether to free disk space (Linux only)'
skip_tests:
required: false
type: boolean
default: false
description: 'Skip running the tests (for Windows where tests are disabled)'
jobs:
cpp_tests:
runs-on: ${{ inputs.platform == 'linux_64' && 'ubuntu-22.04' || (inputs.platform == 'osx_arm64' && 'macos-14' || 'windows-latest') }}
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: ${{ inputs.platform != 'win_64' && 'true' || '' }}
ACTIONS_ALLOW_UNSECURE_COMMANDS: ${{ inputs.platform == 'win_64' && 'true' || '' }}
SCCACHE_GHA_VERSION: ${{vars.SCCACHE_GHA_VERSION || 1}}
steps:
- uses: actions/checkout@v6.0.1
# Do not use recursive submodules checkout to simulate conda feedstock build
# with:
# submodules: recursive
- name: Free Disk Space (Ubuntu)
if: inputs.free_disk_space
uses: jlumbroso/free-disk-space@v1.3.1
with:
tool-cache: false
large-packages: false
docker-images: false
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: ${{ inputs.artifact_name }}
path: .
- name: Configure sccache
uses: mozilla-actions/sccache-action@v0.0.9
with:
sccache-version: ${{vars.SCCACHE_GHA_VERSION || 1}}
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v2.0.0
id: cpu-cores
- name: Install Conda environment from environment-dev.yml
uses: mamba-org/setup-micromamba@v2.0.6
with:
environment-file: environment-dev.yml
environment-name: ${{ inputs.platform == 'win_64' && '' || 'arcticdb' }}
init-shell: ${{ inputs.platform == 'win_64' && 'bash cmd.exe' || 'bash' }}
cache-environment: true
post-cleanup: 'all'
- name: Configure C++ Tests (${{ inputs.platform }})
if: inputs.skip_tests == false
run: |
${{ inputs.platform == 'win_64' && 'REM' || '#' }} Some `CMAKE_*` variables (in particular CMAKE_GENERATOR_{PLATFORM,TOOLSET}) are set by mamba / micromamba / conda
${{ inputs.platform == 'win_64' && 'REM' || '#' }} when the environment is activated.
${{ inputs.platform == 'win_64' && 'REM' || '#' }} See: https://github.com/conda-forge/vc-feedstock/blob/c6bb71096319ff21ac8b75f7d91183be914c3d6b/recipe/activate.bat#L87-L131
${{ inputs.platform == 'win_64' && 'REM' || '#' }} The values which are chosen prevent Ninja to be used as a generator with MSVC.
${{ inputs.platform == 'win_64' && 'REM' || '#' }} We override those values so that we can.
${{ inputs.platform == 'win_64' && 'set CMAKE_GENERATOR_PLATFORM=' || '' }}
${{ inputs.platform == 'win_64' && 'set CMAKE_GENERATOR_TOOLSET=' || '' }}
cd cpp
cmake --preset ${{ inputs.cmake_preset }} -DTEST=ON
env:
ARCTICDB_USING_CONDA: 1
ARCTICDB_BUILD_CPP_TESTS: 1
ARCTIC_CMAKE_PRESET: ${{ inputs.cmake_preset }}
- name: Build C++ Tests (${{ inputs.platform }})
shell: ${{ inputs.platform == 'win_64' && 'cmd /C call {0}' || 'bash -l {0}' }}
run: |
${{ inputs.platform == 'win_64' && 'REM' || '#' }} Some `CMAKE_*` variables (in particular CMAKE_GENERATOR_{PLATFORM,TOOLSET}) are set by mamba / micromamba / conda
${{ inputs.platform == 'win_64' && 'REM' || '#' }} when the environment is activated.
${{ inputs.platform == 'win_64' && 'REM' || '#' }} See: https://github.com/conda-forge/vc-feedstock/blob/c6bb71096319ff21ac8b75f7d91183be914c3d6b/recipe/activate.bat#L87-L131
${{ inputs.platform == 'win_64' && 'REM' || '#' }} The values which are chosen prevent Ninja to be used as a generator with MSVC.
${{ inputs.platform == 'win_64' && 'REM' || '#' }} We override those values so that we can.
${{ inputs.platform == 'win_64' && 'set CMAKE_GENERATOR_PLATFORM=' || '' }}
${{ inputs.platform == 'win_64' && 'set CMAKE_GENERATOR_TOOLSET=' || '' }}
cd cpp
cmake --build --preset ${{ inputs.cmake_preset }} --target arcticdb_rapidcheck_tests -j ${{ steps.cpu-cores.outputs.count }}
cmake --build --preset ${{ inputs.cmake_preset }} --target test_unit_arcticdb -j ${{ steps.cpu-cores.outputs.count }}
env:
ARCTICDB_USING_CONDA: 1
- name: Run C++ Tests (${{ inputs.platform }})
if: inputs.skip_tests == false
run: |
cd ${{ inputs.build_dir }}
ctest --output-on-failure
env:
ARCTICDB_USING_CONDA: 1