name: Setup conan
description: Setup conan profile and artifactory

inputs:
  conan_profile:
    description: Conan profile name
    required: true

runs:
  using: composite
  steps:
    - name: Create conan profile on macOS
      if: ${{ runner.os == 'macOS' }}
      shell: bash
      env:
        CONAN_PROFILE: ${{ inputs.conan_profile }}
      run: |
        echo "Creating $CONAN_PROFILE conan profile"
        conan profile new $CONAN_PROFILE --detect --force
        conan profile update settings.compiler.libcxx=libc++ $CONAN_PROFILE
        conan profile update settings.compiler.cppstd=20 $CONAN_PROFILE
        conan profile update env.CXXFLAGS=-DBOOST_ASIO_DISABLE_CONCEPTS $CONAN_PROFILE
        conan profile update "conf.tools.build:cxxflags+=[\"-DBOOST_ASIO_DISABLE_CONCEPTS\"]" $CONAN_PROFILE

    - name: Add conan-non-prod artifactory
      shell: bash
      run: |
        if [[ -z $(conan remote list | grep conan-non-prod) ]]; then
            echo "Adding conan-non-prod"
            conan remote add --insert 0 conan-non-prod http://18.143.149.228:8081/artifactory/api/conan/conan-non-prod
        else
            echo "Conan-non-prod is available"
        fi
