Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove hard coded mamba #3069

Merged
merged 8 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading