Skip to content

Refactor CI and libamambapy tests (on Unix) #802

Refactor CI and libamambapy tests (on Unix)

Refactor CI and libamambapy tests (on Unix) #802

Workflow file for this run

name: Windows tests
on:
push:
branches:
- main
pull_request:
branches:
- main
paths-ignore:
- 'docs/**'
- '**.md'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
libmamba_tests_win:
name: libmamba tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2019]
steps:
- uses: actions/checkout@v3
- name: Create build environment
uses: mamba-org/setup-micromamba@v1
with:
environment-file: ./dev/environment-dev.yml
environment-name: build_env
cache-environment: true
init-shell: bash cmd.exe
- uses: hendrikmuhs/ccache-action@main
with:
variant: sccache
key: ${{ github.job }}-${{ matrix.os }}
restore-keys: |
libmamba-${{ matrix.os }}
- name: Build libmamba
shell: cmd /C call {0}
run: |
cmake -B build/ ^
-G Ninja ^
-D CMAKE_INSTALL_PREFIX=%CONDA_PREFIX%\Library ^
-D CMAKE_BUILD_TYPE="Release" ^
-D CMAKE_MSVC_RUNTIME_LIBRARY="MultiThreadedDLL" ^
-D BUILD_LIBMAMBA_TESTS=ON ^
-D BUILD_LIBMAMBA=ON ^
-D BUILD_LIBMAMBAPY=ON ^
-D BUILD_SHARED=ON ^
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache ^
-D CMAKE_C_COMPILER_LAUNCHER=sccache
if %errorlevel% neq 0 exit /b %errorlevel%
cmake --build build/ --parallel --target test_libmamba testing_libmamba_lock
if %errorlevel% neq 0 exit /b %errorlevel%
- name: Run libmamba tests
shell: cmd /C call {0}
run: |
cd build
ninja install
if %errorlevel% neq 0 exit /b %errorlevel%
@REM Interferes with tests
set CONDARC=
ninja test
if %errorlevel% neq 0 exit /b %errorlevel%
- name: Show build cache statistics
run: sccache --show-stats
umamba_build_win:
name: Build micromamba
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2019]
steps:
- uses: actions/checkout@v3
- name: create build environment
uses: mamba-org/setup-micromamba@v1
with:
environment-file: ./dev/environment-dev.yml
environment-name: build_env
cache-environment: true
init-shell: bash cmd.exe
- uses: hendrikmuhs/ccache-action@main
with:
variant: sccache
key: ${{ github.job }}-${{ matrix.os }}
restore-keys: |
libmamba-${{ matrix.os }}
- name: build micromamba
shell: cmd /C call {0}
run: |
cmake -B build/ ^
-G Ninja ^
-D CMAKE_INSTALL_PREFIX=%CONDA_PREFIX%\Library ^
-D CMAKE_BUILD_TYPE="Release" ^
-D CMAKE_MSVC_RUNTIME_LIBRARY="MultiThreadedDLL" ^
-D BUILD_MICROMAMBA=ON ^
-D BUILD_LIBMAMBA=ON ^
-D BUILD_SHARED=ON ^
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache ^
-D CMAKE_C_COMPILER_LAUNCHER=sccache
if %errorlevel% neq 0 exit /b %errorlevel%
cmake --build build/ --parallel
if %errorlevel% neq 0 exit /b %errorlevel%
cmake --install build/
- name: check that micromamba runs
shell: cmd /C call {0}
run: .\build\micromamba\micromamba.exe --help
- name: build cache statistics
run: sccache --show-stats
- name: tar micromamba artifact
shell: cmd /C call {0}
run: |
cp build/libmamba/libmamba.dll build/micromamba/
tar -cvf umamba.tar build/micromamba/micromamba.exe build/micromamba/libmamba.dll
- uses: actions/upload-artifact@v3
with:
name: _internal_micromamba_binary
path: umamba.tar
umamba_integration_tests_win:
name: Micromamba integration tests with PWSH
needs: [umamba_build_win]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2019]
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: _internal_micromamba_binary
- name: untar micromamba artifact
shell: bash -l -eo pipefail {0}
run: |
tar -xvf umamba.tar
- name: create build environment
uses: mamba-org/setup-micromamba@v1
with:
environment-file: ./dev/environment-dev.yml
environment-name: build_env
create-args: >-
menuinst
conda-build
curl
init-shell: bash cmd.exe powershell
- name: micromamba python based tests with pwsh
shell: pwsh
run: |
$env:PYTHONIOENCODING='UTF-8'
$env:MAMBA_ROOT_PREFIX = Join-Path -Path $pwd -ChildPath 'mambaroot'
$env:TEST_MAMBA_EXE = Join-Path -Path $pwd -ChildPath 'build\micromamba\micromamba.exe'
$env:MAMBA_TEST_SHELL_TYPE='powershell'
Remove-Item -Path "env:CONDARC"
pytest -v --capture=tee-sys micromamba/tests/
- name: micromamba local channel checks
shell: bash -l {0}
run: |
mkdir -p $MAMBA_ROOT_PREFIX/conda-bld/win-64
echo $PATH
micromamba list
micromamba info
curl --version
curl https://anaconda.org/conda-forge/xtensor/0.21.7/download/win-64/xtensor-0.21.7-h7ef1ec2_0.tar.bz2 -L -o $MAMBA_ROOT_PREFIX/conda-bld/win-64/xtensor-0.21.7-h7ef1ec2_0.tar.bz2
curl https://anaconda.org/conda-forge/xtl/0.6.21/download/win-64/xtl-0.6.21-h5362a0b_0.tar.bz2 -L -o $MAMBA_ROOT_PREFIX/conda-bld/win-64/xtl-0.6.21-h5362a0b_0.tar.bz2
conda index $MAMBA_ROOT_PREFIX/conda-bld
micromamba create -n l_o_cal_test xtensor -c local -c conda-forge -y
micromamba list -n l_o_cal_test
# cut first couple of lines to remove prefix path
micromamba list -n l_o_cal_test | tail -n +3 > list.txt
if [ "$(grep -c "conda-bld" list.txt)" -ne 2 ]; then
exit 1
fi