name: "Dev env instructions"
on:
  pull_request:
  push:
    branches: [latest]
concurrency:
  group: ${{ github.ref }}
  cancel-in-progress: ${{ github.ref != 'refs/heads/latest' }}
jobs:
  nix:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, macos-14]
    steps:
    - uses: actions/checkout@v6
      with:
        fetch-depth: 0

    - name: Install Nix
      uses: DeterminateSystems/nix-installer-action@v21

    - run: nix run .# -- --version

    - run: nix develop --command bash -c "tox -e py311"

  pixi:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, macos-14]
    steps:
    - uses: actions/checkout@v6
      with:
        fetch-depth: 0

    - name: set up pixi
      uses: prefix-dev/setup-pixi@v0.9.4
      with:
        pixi-version: v0.63.2
        cache: true
        frozen: true

    - name: run tests for 3.12
      shell: pixi run bash {0}
      run: tox -e py312

  mamba:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, macos-14]
    steps:
    - uses: actions/checkout@v6
      with:
        fetch-depth: 0

    - name: cache conda
      uses: actions/cache@v5
      env:
        CACHE_NUMBER: 0
      with:
        path: ~/conda_pkgs_dir
        key:
          ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.yml') }}

    - name: setup conda
      uses: conda-incubator/setup-miniconda@fc2d68f6413eb2d87b895e92f8584b5b94a10167
      with:
        python-version: "3.12"
        miniforge-version: latest
        environment-file: dev.yml
        activate-environment: sourmash_dev
        auto-activate-base: false

    - name: run tests for 3.12
      shell: bash -l {0}
      run: tox -e py312
