Remove hard coded mamba (#3069)

* Remove hard-coded micromamba

* Revert test_env

* Fix Taskfile

* Put mamba inside the feedstock

* Fix permission error

* Move git safe dir

* Restore micromamba-feedstock main branch

* Try chown
This commit is contained in:
Antoine Prouvost 2023-12-19 08:54:50 +01:00 committed by GitHub
parent 29a19e1ef5
commit 212d1e9ad2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 15 deletions

View File

@ -39,14 +39,19 @@ jobs:
# Running a fork until we can merge the changes in micromamba-feedstock
# https://github.com/conda-forge/micromamba-feedstock/pull/154
repository: AntoinePrv/micromamba-feedstock
ref: tmp-mamba-ci
path: micromamba-feedstock
- name: Clear micromamba-feedstock git directory
run: rm -rf "micromamba-feedstock/.git"
- name: Checkout mamba branch
uses: actions/checkout@v3
with:
path: micromamba-feedstock/source
path: mamba
- name: Clear mamba git directory and link source
# `source` subfolder is the special location looked-up by our feedstock.
# Due to Docker, we can only put it as a subfolder of `micromamba-feedstock`,
run: |
rm -rf "mamba/.git"
mv mamba/ micromamba-feedstock/source
# Prevent irrelevant file permission error
git -C micromamba-feedstock/ config --local --add safe.directory '*'
- uses: mamba-org/setup-micromamba@v1
with:
environment-name: mambabuild
@ -77,6 +82,8 @@ jobs:
apt-get install -y python3 docker.io
run: |
cd micromamba-feedstock/
# Prevent irrelevant file permission error
chown -R $(whoami) .
# Special values for running the feedstock with a local source
export FEEDSTOCK_ROOT="${PWD}"
export CI="local"

View File

@ -11,6 +11,9 @@ vars:
CMAKE_PRESET: 'mamba-unix-shared-debug-dev'
CACHE_DIR: '{{.BUILD_DIR}}/pkgs'
DOCS_DIR: '{{.BUILD_DIR}}/docs'
MAMBA_NAME: 'mamba' # Depend on preset...
TEST_MAMBA_EXE:
sh: 'realpath {{.CMAKE_BUILD_DIR}}/micromamba/{{.MAMBA_NAME}}'
CPU_PERCENTAGE: 75
CPU_TOTAL:
sh: >-
@ -147,9 +150,9 @@ tasks:
An example run could look like:
task micromamba -- create -n env -c conda-forge python=3.11
deps: [{task: '_build', vars: {target: 'micromamba'}}]
deps: [{task: '_build', vars: {target: '{{.MAMBA_NAME}}'}}]
cmds:
- '"{{.CMAKE_BUILD_DIR}}/micromamba/micromamba" {{.CLI_ARGS}}'
- '"{{.TEST_MAMBA_EXE}}" {{.CLI_ARGS}}'
_test-libmamba:
internal: true
@ -169,10 +172,9 @@ tasks:
_test-micromamba:
internal: true
deps: [{task: '_build', vars: {target: 'micromamba'}}]
deps: [{task: '_build', vars: {target: '{{.MAMBA_NAME}}'}}]
env:
TEST_MAMBA_EXE:
sh: 'realpath {{.CMAKE_BUILD_DIR}}/micromamba/micromamba'
TEST_MAMBA_EXE: '{{.TEST_MAMBA_EXE}}'
cmds:
- >-
{{.DEV_RUN}} python -m pytest micromamba/tests/
@ -197,10 +199,9 @@ tasks:
_test-reposerver:
internal: true
deps: [{task: '_build', vars: {target: 'micromamba'}}]
deps: [{task: '_build', vars: {target: '{{.MAMBA_NAME'}}]
env:
TEST_MAMBA_EXE:
sh: 'realpath {{.CMAKE_BUILD_DIR}}/micromamba/micromamba'
TEST_MAMBA_EXE: '{{.TEST_MAMBA_EXE}}'
# Explicitly using this as var since env does not override shell environment
vars:
GNUPGHOME: '{{.BUILD_DIR}}/gnupg'

View File

@ -71,7 +71,7 @@ def get_umamba(cwd=os.getcwd()):
umamba_bin = "micromamba"
umamba = os.path.join(cwd, "build", "micromamba", umamba_bin)
if not Path(umamba).exists():
print("MICROMAMBA NOT FOUND!")
raise RuntimeError("Micromamba not found! Set TEST_MAMBA_EXE env variable")
return umamba

View File

@ -222,8 +222,9 @@ def test_init(tmp_home, tmp_root_prefix, shell_type, prefix_selector, multiple_t
def test_dash(tmp_home, tmp_root_prefix):
skip_if_shell_incompat("dash")
subprocess.check_call(["dash", "-c", "eval $(micromamba shell hook -s dash)"])
subprocess.check_call(["dash", "-c", "eval $(micromamba shell hook -s posix)"])
umamba = helpers.get_umamba()
subprocess.check_call(["dash", "-c", f"eval $({umamba} shell hook -s dash)"])
subprocess.check_call(["dash", "-c", f"eval $({umamba} shell hook -s posix)"])
def test_implicitly_created_environment(tmp_home, tmp_root_prefix):