Skip to content

Commit

Permalink
Remove hard coded mamba (mamba-org#3069)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
AntoinePrv committed Dec 19, 2023
1 parent 29a19e1 commit 212d1e9
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 15 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/static_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
17 changes: 9 additions & 8 deletions Taskfile.dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: >-
Expand Down Expand Up @@ -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
Expand All @@ -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/
Expand All @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion micromamba/tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
5 changes: 3 additions & 2 deletions micromamba/tests/test_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 212d1e9

Please sign in to comment.