name: GPU PyTest in Conda Work

on:
  push:
    tags:
      - test_gpu_linux.**

jobs:
  build-linux:
    runs-on: gpu

    steps:
      - uses: actions/checkout@v3
      - name: Add conda to system path
        run: |
          # $CONDA is an environment variable pointing to the root of the miniconda directory
          echo $CONDA/bin >> $GITHUB_PATH
      - name: Install dependencies
        run: |
          conda env update --file tests/workflows_conf/environment_linux_gpu.yml --name rapids-22.12 -q
      - name: Install Stereopy dependencies
        run: |
          conda init bash
          source ~/.bashrc
          conda activate rapids-22.12
          pip install -r requirements.txt -q
          pip install pathlib -q
          pip install pytest -q
          ~/anaconda3/envs/rapids-22.12/bin/python setup.py develop
      - name: Test with pytest
        run: |
          ~/anaconda3/envs/rapids-22.12/bin/python -m pytest -m "gpu"
