diff --git a/.github/workflows/static_build.yml b/.github/workflows/static_build.yml index 4349471a46..b4795eb363 100644 --- a/.github/workflows/static_build.yml +++ b/.github/workflows/static_build.yml @@ -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" diff --git a/Taskfile.dist.yml b/Taskfile.dist.yml index f930c978f2..63f1a91b00 100644 --- a/Taskfile.dist.yml +++ b/Taskfile.dist.yml @@ -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' diff --git a/micromamba/tests/helpers.py b/micromamba/tests/helpers.py index 0707f3c98c..5774d8ca3a 100644 --- a/micromamba/tests/helpers.py +++ b/micromamba/tests/helpers.py @@ -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 diff --git a/micromamba/tests/test_shell.py b/micromamba/tests/test_shell.py index 1cd5ed54d1..318704f325 100644 --- a/micromamba/tests/test_shell.py +++ b/micromamba/tests/test_shell.py @@ -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):