Skip to content

Instantly share code, notes, and snippets.

@KPLauritzen
Created April 20, 2021 14:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KPLauritzen/0e4ed741d2bffe83d1fff8b10d680c61 to your computer and use it in GitHub Desktop.
Save KPLauritzen/0e4ed741d2bffe83d1fff8b10d680c61 to your computer and use it in GitHub Desktop.
Pipeline for using micromamba in a azure devops pipeline
jobs:
- job:
pool:
vmImage: 'vs2017-win2016'
variables:
- name: MAMBA_ROOT_PREFIX
value: $(Pipeline.Workspace)\micromambaenv
steps:
- powershell: |
Invoke-Webrequest -URI https://micro.mamba.pm/api/micromamba/win-64/latest -OutFile micromamba.tar.bz2
C:\PROGRA~1\7-Zip\7z.exe x micromamba.tar.bz2 -aoa
C:\PROGRA~1\7-Zip\7z.exe x micromamba.tar -ttar -aoa -r Library\bin\micromamba.exe
MOVE -Force Library\bin\micromamba.exe micromamba.exe
displayName: install micromamba
- powershell: |
.\micromamba.exe shell hook -s powershell | Out-String | Invoke-Expression
micromamba create --yes --name myenv python=3.8 geopandas==0.8 -c conda-forge
displayName: Install required packages
- powershell: |
.\micromamba.exe shell hook -s powershell | Out-String | Invoke-Expression
micromamba activate myenv
python -m pip install --upgrade pip
pip install pytest pytest-azurepipelines
pytest -o junit_family=xunit2 --junitxml=junit/unit-test.xml
displayName: pytest
@melund
Copy link

melund commented Aug 2, 2021

7-zip is not always available on self-hosted agents The following is bit shorter and robust.

jobs:
 - job:
   pool:
     vmImage: 'vs2017-win2016'
   steps:
     - powershell: |
         Invoke-Webrequest -URI https://micro.mamba.pm/api/micromamba/win-64/latest -OutFile ~\micromamba.tar.bz2
         $env:Path = "C:\PROGRA~1\Git\usr\bin;" + $env:Path
         tar.exe -xvjf ~/micromamba.tar.bz2 --strip-components 2 -C ~ Library/bin/micromamba.exe
         echo "MAMBA_ROOT_PREFIX=~\micromamba" >> $GITHUB_ENV
       displayName: install micromamba

     - powershell: |
       run: | 
         ~\micromamba.exe shell hook -s powershell | Out-String | Invoke-Expression
         micromamba create --yes --name myenv python=3.8 geopandas==0.8 -c conda-forge
       displayName: Install required packages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment