mirror of https://github.com/mamba-org/mamba.git
add cpp tests installed through micromamba
This commit is contained in:
parent
3127f0f981
commit
aca55168ca
|
@ -9,13 +9,61 @@ on:
|
||||||
- master
|
- master
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
test_cpp_micromamba:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macos-latest]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: free disk space
|
||||||
|
if: matrix.os == 'ubuntu-latest'
|
||||||
|
run: |
|
||||||
|
sudo swapoff -a
|
||||||
|
sudo rm -f /swapfile
|
||||||
|
sudo apt clean
|
||||||
|
docker rmi $(docker image ls -aq)
|
||||||
|
df -h
|
||||||
|
- name: install micromamba
|
||||||
|
run: |
|
||||||
|
if [ "$RUNNER_OS" == "Linux" ]; then
|
||||||
|
wget -qO- https://api.anaconda.org/download/conda-forge/micromamba/0.4.0/linux-64/micromamba-0.4.0-hc2cb875_0.tar.bz2 | tar -xvj bin/micromamba --strip-components=1
|
||||||
|
else
|
||||||
|
wget -qO- https://anaconda.org/conda-forge/micromamba/0.4.0/download/osx-64/micromamba-0.4.0-h8680c10_1.tar.bz2 | tar -xvj bin/micromamba
|
||||||
|
mv bin/micromamba ./micromamba
|
||||||
|
fi
|
||||||
|
./micromamba shell init -s bash -p ~/micromamba
|
||||||
|
- name: install deps
|
||||||
|
shell: bash -l {0}
|
||||||
|
run: |
|
||||||
|
export MAMBA_ROOT_PREFIX=~/micromamba
|
||||||
|
export MAMBA_EXE=$(pwd)/micromamba
|
||||||
|
. $MAMBA_ROOT_PREFIX/etc/profile.d/mamba.sh
|
||||||
|
micromamba create -y -p ~/build_env pybind11 libsolv libarchive libcurl nlohmann_json cxx-compiler cmake gtest "cpp-tabulate>=1.2" -c conda-forge
|
||||||
|
env:
|
||||||
|
PYTHON_VERSION: ${{ matrix.python-version }}
|
||||||
|
- name: build tests
|
||||||
|
shell: bash -l {0}
|
||||||
|
run: |
|
||||||
|
export MAMBA_ROOT_PREFIX=~/micromamba
|
||||||
|
export MAMBA_EXE=$(pwd)/micromamba
|
||||||
|
. $MAMBA_ROOT_PREFIX/etc/profile.d/mamba.sh
|
||||||
|
micromamba activate ~/build_env
|
||||||
|
mkdir -p ~/.conda
|
||||||
|
touch ~/.conda/environments.txt
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake .. -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DENABLE_TESTS=ON
|
||||||
|
make test -j2
|
||||||
|
|
||||||
build_unix:
|
build_unix:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, macos-latest]
|
os: [ubuntu-latest, macos-latest]
|
||||||
python-version: [ '3.6', '3.8' ]
|
python-version: [ '3.8' ]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
@ -57,18 +105,6 @@ jobs:
|
||||||
py.test test
|
py.test test
|
||||||
mamba create -n test_env xtensor -c conda-forge -y
|
mamba create -n test_env xtensor -c conda-forge -y
|
||||||
mamba env create -f test.yml
|
mamba env create -f test.yml
|
||||||
- name: Run C++ tests OS X and Linux
|
|
||||||
shell: bash -l {0}
|
|
||||||
run: |
|
|
||||||
if [ "$(uname)" == "Darwin" ]; then
|
|
||||||
exit 0;
|
|
||||||
fi
|
|
||||||
source "$CONDA/etc/profile.d/conda.sh"
|
|
||||||
conda activate mamba-tests
|
|
||||||
mkdir cmake_build
|
|
||||||
cd cmake_build
|
|
||||||
cmake .. -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DENABLE_TESTS=ON
|
|
||||||
make test -j2
|
|
||||||
build_win:
|
build_win:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
|
|
|
@ -80,7 +80,7 @@ if (LINK_STATIC)
|
||||||
endforeach(LIB)
|
endforeach(LIB)
|
||||||
set (MAMBA_STATIC_LIBS "${FINAL_LIBS}")
|
set (MAMBA_STATIC_LIBS "${FINAL_LIBS}")
|
||||||
elseif (UNIX)
|
elseif (UNIX)
|
||||||
set(MAMBA_FORCE_DYNAMIC_LIBS rt dl c resolv)
|
set(MAMBA_FORCE_DYNAMIC_LIBS rt dl resolv)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_link_options(-static-libstdc++ -static-libgcc)
|
add_link_options(-static-libstdc++ -static-libgcc)
|
||||||
|
|
|
@ -8,6 +8,14 @@ namespace fs = ghc::filesystem;
|
||||||
|
|
||||||
namespace mamba
|
namespace mamba
|
||||||
{
|
{
|
||||||
|
#ifdef __linux__
|
||||||
|
std::string platform("linux-64");
|
||||||
|
#elif __APPLE__
|
||||||
|
std::string platform("osx-64");
|
||||||
|
#elif _WIN32
|
||||||
|
std::string platform("win-64");
|
||||||
|
#endif
|
||||||
|
|
||||||
TEST(ChannelContext, init)
|
TEST(ChannelContext, init)
|
||||||
{
|
{
|
||||||
// ChannelContext builds its custom channels with
|
// ChannelContext builds its custom channels with
|
||||||
|
@ -49,19 +57,19 @@ namespace mamba
|
||||||
EXPECT_EQ(c.name(), "conda-forge");
|
EXPECT_EQ(c.name(), "conda-forge");
|
||||||
EXPECT_EQ(c.platform(), "");
|
EXPECT_EQ(c.platform(), "");
|
||||||
|
|
||||||
std::string value2 = "https://repo.anaconda.com/pkgs/main/linux-64";
|
std::string value2 = "https://repo.anaconda.com/pkgs/main/" + platform;
|
||||||
Channel& c2 = make_channel(value2);
|
Channel& c2 = make_channel(value2);
|
||||||
EXPECT_EQ(c2.scheme(), "https");
|
EXPECT_EQ(c2.scheme(), "https");
|
||||||
EXPECT_EQ(c2.location(), "repo.anaconda.com");
|
EXPECT_EQ(c2.location(), "repo.anaconda.com");
|
||||||
EXPECT_EQ(c2.name(), "pkgs/main");
|
EXPECT_EQ(c2.name(), "pkgs/main");
|
||||||
EXPECT_EQ(c2.platform(), "linux-64");
|
EXPECT_EQ(c2.platform(), platform);
|
||||||
|
|
||||||
std::string value3 = "https://conda.anaconda.org/conda-forge/linux-64";
|
std::string value3 = "https://conda.anaconda.org/conda-forge/" + platform;
|
||||||
Channel& c3 = make_channel(value3);
|
Channel& c3 = make_channel(value3);
|
||||||
EXPECT_EQ(c3.scheme(), c.scheme());
|
EXPECT_EQ(c3.scheme(), c.scheme());
|
||||||
EXPECT_EQ(c3.location(), c.location());
|
EXPECT_EQ(c3.location(), c.location());
|
||||||
EXPECT_EQ(c3.name(), c.name());
|
EXPECT_EQ(c3.name(), c.name());
|
||||||
EXPECT_EQ(c3.platform(), "linux-64");
|
EXPECT_EQ(c3.platform(), platform);
|
||||||
|
|
||||||
std::string value4 = "/home/mamba/test/channel_b";
|
std::string value4 = "/home/mamba/test/channel_b";
|
||||||
Channel& c4 = make_channel(value4);
|
Channel& c4 = make_channel(value4);
|
||||||
|
@ -70,12 +78,12 @@ namespace mamba
|
||||||
EXPECT_EQ(c4.name(), "channel_b");
|
EXPECT_EQ(c4.name(), "channel_b");
|
||||||
EXPECT_EQ(c4.platform(), "");
|
EXPECT_EQ(c4.platform(), "");
|
||||||
|
|
||||||
std::string value5 = "/home/mamba/test/channel_b/linux-64";
|
std::string value5 = "/home/mamba/test/channel_b/" + platform;
|
||||||
Channel& c5 = make_channel(value5);
|
Channel& c5 = make_channel(value5);
|
||||||
EXPECT_EQ(c5.scheme(), "file");
|
EXPECT_EQ(c5.scheme(), "file");
|
||||||
EXPECT_EQ(c5.location(), "/home/mamba/test");
|
EXPECT_EQ(c5.location(), "/home/mamba/test");
|
||||||
EXPECT_EQ(c5.name(), "channel_b");
|
EXPECT_EQ(c5.name(), "channel_b");
|
||||||
EXPECT_EQ(c5.platform(), "linux-64");
|
EXPECT_EQ(c5.platform(), platform);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Channel, urls)
|
TEST(Channel, urls)
|
||||||
|
@ -103,11 +111,11 @@ namespace mamba
|
||||||
std::vector<std::string> urls = { "conda-forge", "defaults" };
|
std::vector<std::string> urls = { "conda-forge", "defaults" };
|
||||||
std::vector<std::string> res = calculate_channel_urls(urls, true);
|
std::vector<std::string> res = calculate_channel_urls(urls, true);
|
||||||
EXPECT_EQ(res.size(), 6u);
|
EXPECT_EQ(res.size(), 6u);
|
||||||
EXPECT_EQ(res[0], "https://conda.anaconda.org/conda-forge/linux-64");
|
EXPECT_EQ(res[0], "https://conda.anaconda.org/conda-forge/" + platform);
|
||||||
EXPECT_EQ(res[1], "https://conda.anaconda.org/conda-forge/noarch");
|
EXPECT_EQ(res[1], "https://conda.anaconda.org/conda-forge/noarch");
|
||||||
EXPECT_EQ(res[2], "https://repo.anaconda.com/pkgs/main/linux-64");
|
EXPECT_EQ(res[2], "https://repo.anaconda.com/pkgs/main/" + platform);
|
||||||
EXPECT_EQ(res[3], "https://repo.anaconda.com/pkgs/main/noarch");
|
EXPECT_EQ(res[3], "https://repo.anaconda.com/pkgs/main/noarch");
|
||||||
EXPECT_EQ(res[4], "https://repo.anaconda.com/pkgs/r/linux-64");
|
EXPECT_EQ(res[4], "https://repo.anaconda.com/pkgs/r/" + platform);
|
||||||
EXPECT_EQ(res[5], "https://repo.anaconda.com/pkgs/r/noarch");
|
EXPECT_EQ(res[5], "https://repo.anaconda.com/pkgs/r/noarch");
|
||||||
|
|
||||||
std::vector<std::string> res2 = calculate_channel_urls(urls, false);
|
std::vector<std::string> res2 = calculate_channel_urls(urls, false);
|
||||||
|
@ -123,9 +131,9 @@ namespace mamba
|
||||||
std::vector<std::string> local_res = calculate_channel_urls(local_urls, false);
|
std::vector<std::string> local_res = calculate_channel_urls(local_urls, false);
|
||||||
std::string current_dir = "file://" + fs::current_path().string() + '/';
|
std::string current_dir = "file://" + fs::current_path().string() + '/';
|
||||||
EXPECT_EQ(local_res.size(), 4u);
|
EXPECT_EQ(local_res.size(), 4u);
|
||||||
EXPECT_EQ(local_res[0], current_dir + "channel_b/linux-64");
|
EXPECT_EQ(local_res[0], current_dir + "channel_b/" + platform);
|
||||||
EXPECT_EQ(local_res[1], current_dir + "channel_b/noarch");
|
EXPECT_EQ(local_res[1], current_dir + "channel_b/noarch");
|
||||||
EXPECT_EQ(local_res[2], current_dir + "channel_a/linux-64");
|
EXPECT_EQ(local_res[2], current_dir + "channel_a/" + platform);
|
||||||
EXPECT_EQ(local_res[3], current_dir + "channel_a/noarch");
|
EXPECT_EQ(local_res[3], current_dir + "channel_a/noarch");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue