name: Setup TVM CI environment
description: Set up the cached conda build environment and install tvm-ffi.

runs:
 using: "composite"
 steps:
  - uses: actions/cache@v5.0.5
    env:
      CACHE_NUMBER: 2
    with:
      path: ~/conda_pkgs_dir
      key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('ci/scripts/package/build-environment.yaml') }}
  - uses: conda-incubator/setup-miniconda@v4.0.1
    continue-on-error: true
    id: conda1
    with:
      activate-environment: tvm-build
      channel-priority: strict
      environment-file: ci/scripts/package/build-environment.yaml
      auto-activate-base: false
      miniforge-version: latest
      python-version: "3.10"
      condarc-file: tests/conda/condarc
      conda-remove-defaults: true
  - uses: conda-incubator/setup-miniconda@v4.0.1
    if: steps.conda1.outcome == 'failure'
    with:
      activate-environment: tvm-build
      channel-priority: strict
      environment-file: ci/scripts/package/build-environment.yaml
      auto-activate-base: false
      miniforge-version: latest
      use-only-tar-bz2: true
      python-version: "3.10"
      condarc-file: tests/conda/condarc
      conda-remove-defaults: true
  - name: Conda info
    shell: pwsh
    run: |
      mamba info
      mamba list
      mamba info --envs
      mamba list --name base
  - name: Install tvm-ffi pip package
    shell: bash -l {0}
    run: |
      pip install -v ./3rdparty/tvm-ffi
