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

Run tests on all platforms #208

Draft
wants to merge 5 commits into
base: 1.x
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 3 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
25 changes: 23 additions & 2 deletions .gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions .scripts/build_steps.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .scripts/run_docker_build.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 16 additions & 9 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,25 @@ outputs:
requires:
- pip
commands:
- mamba --help
- if exist %PREFIX%\condabin\mamba.bat (exit 0) else (exit 1) # [win]
- test -f ${PREFIX}/etc/profile.d/mamba.sh # [linux]
# these tests work when run on win, but for some reason not during conda build
- mamba create -n test_py2 python=2.7 --dry-run # [unix]
- mamba clean --all --dry-run # [unix]
- mamba repoquery whoneeds conda # [unix]
- mamba install xtensor xsimd -c conda-forge --dry-run # [linux and x86_64]
- test -f ${PREFIX}/condabin/mamba # [unix]
- test -f ${PREFIX}/etc/profile.d/mamba.sh # [unix]
- if not exist %PREFIX%\condabin\mamba.bat exit 1 # [win]

# Ensure we run the executable from the prefix and not from the base installation.
- test "$(command -v mamba)" = "${PREFIX}/bin/mamba" # [unix]
- cmd /q /c "for /f "delims=" %%f in ('C:\Windows\System32\where mamba.bat') do if "%%~dpf"=="%LIBRARY_BIN%\" (exit 0) else (exit 1)" # [win]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This cryptic Batch nonsense should be equivalent to the POSIX shell test above it and checks that the first entry on PATH with the executable is the one we want to test.
It's wrapped in a cmd /c call since we have an exit 0 in there (to only check the first entry) which would exit the whole test script if it wasn't wrapped in a subprocess.
I tried to use findstr "/C:%PREFIX%" in there, but it turns out that the search strings for findstr are length-limited far below the PREFIX' lengths we use.

- cmd /q /c "for /f "delims=" %%f in ('C:\Windows\System32\where mamba.exe') do if "%%~dpf"=="%SCRIPTS%\" (exit 0) else (exit 1)" # [win]

# We need to run with "call" on Windows since "mamba" runs the batch file; make "call" a passthrough function on Unixes.
- call() { "${@}" ; } # [unix]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defining this pass-through function here allows us to have the test below uniform on all platform so we can avoid duplication and overall maintenance burden.

- call mamba --help
- call mamba create -n test_py37 python=3.7 --dry-run
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

python=2.7 can't be installed on Windows anymore since vc=9 is on the cf201901 label.
We'd have to use that label (or defaults, I guess) in there to make it work.
But... we could also just not care too much about python=2.7 anymore and use another (by now old) version.

- call mamba clean --all --dry-run
- call mamba repoquery whoneeds conda
- call mamba install xtensor xsimd -c conda-forge --dry-run
# for some reason tqdm doesn't have a proper colorama dependency so pip check fails
# but that's completely unrelated to mamba
- python -c "import mamba._version; assert mamba._version.__version__ == '{{ mamba_version }}'"
- test -f ${PREFIX}/condabin/mamba # [unix]

about:
home: https://github.com/mamba-org/mamba
Expand Down