Skip to content

Commit

Permalink
Merge pull request #60 from isuruf/win
Browse files Browse the repository at this point in the history
  • Loading branch information
ocefpaf authored Nov 11, 2020
2 parents 72ad6c4 + e61b7da commit dc45523
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 14 deletions.
20 changes: 19 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ jobs:
fail-fast: false
matrix:
include:
- os: windows-latest
ARCH: x86_64
MINIFORGE_NAME: "Miniforge3"
OS_NAME: "Windows"

- os: macos-latest
ARCH: arm64
MINIFORGE_NAME: "Miniforge3"
Expand Down Expand Up @@ -70,6 +75,11 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
if: contains(matrix.OS_NAME, 'Windows')

- name: Build and test miniforge
env:
ARCH: ${{ matrix.ARCH }}
Expand All @@ -83,13 +93,21 @@ jobs:
fi
if [[ "$OS_NAME" == "Linux" ]]; then
bash build_miniforge.sh;
EXT=sh
fi
if [[ "$OS_NAME" == "MacOSX" ]]; then
bash build_miniforge_osx.sh;
EXT=sh
fi
if [[ "$OS_NAME" == "Windows" ]]; then
source /c/Miniconda3/Scripts/activate
bash build_miniforge_win.sh
EXT=exe
fi
# Copy for latest release
cp build/$MINIFORGE_NAME-*-$OS_NAME-$ARCH.sh build/$MINIFORGE_NAME-$OS_NAME-$ARCH.sh
cp build/$MINIFORGE_NAME-*-$OS_NAME-$ARCH.$EXT build/$MINIFORGE_NAME-$OS_NAME-$ARCH.$EXT
ls -alh build
shell: bash

- name: Upload miniforge to release
uses: svenstaro/upload-release-action@v2
Expand Down
1 change: 1 addition & 0 deletions Miniforge3/construct.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ channels:
# - https://conda.anaconda.org/conda-forge
- conda-forge # [not (osx and arm64)]
- https://conda-web.anaconda.org/conda-forge # [osx and arm64]
- msys2 # [win]

write_condarc: True
# keep pkgs for space-saving implications for hardlinks when create new environments
Expand Down
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Latest installers with python 3.8 in the base environment
- [linux-x86_64](https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh) (also called `amd64`)
- [osx-x86_64](https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-x86_64.sh)
- [osx-arm64](https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh) (Apple Silicon)
- [win-x86_64](https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Windows-x86_64.exe)

#### Miniforge-pypy3
Latest installers with pypy3.6 in the base environment
Expand All @@ -29,6 +30,24 @@ Latest installers with pypy3.6 in the base environment

Follow the aarch64 and ppc64le migration status here: https://conda-forge.org/status/

## Install

To install download the installer and run,

bash Miniforge3-Linux-x86_64.sh # or similar for other installers for unix platforms

or if you are on Windows, double click on the installer.

### Non-interactive install

For non-interactive usage, look at the options by running the following

bash Miniforge3-Linux-x86_64.sh -p # or similar for other installers for unix platforms

or if you are on windows, run:

start /wait "" build/Miniforge3-4.9.0-0-Windows-x86_64.exe /InstallationType=JustMe /RegisterPython=0 /S /D=%UserProfile%\Miniforge3

## Features

- [X] Automatic build of constructor.
Expand Down
5 changes: 3 additions & 2 deletions build_miniforge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set -ex
ARCH=${ARCH:-aarch64}
DOCKER_ARCH=${DOCKER_ARCH:arm64v8}
DOCKERIMAGE=${DOCKERIMAGE:-condaforge/linux-anvil-aarch64}
export CONSTRUCT_ROOT=/construct

echo "============= Create build directory ============="
mkdir -p build/
Expand All @@ -15,7 +16,7 @@ echo "============= Enable QEMU ============="
docker run --rm --privileged multiarch/qemu-user-static:register --reset --credential yes

echo "============= Build the installer ============="
docker run --rm -v $(pwd):/construct -e MINIFORGE_VERSION -e MINIFORGE_NAME $DOCKERIMAGE /construct/scripts/build.sh
docker run --rm -v $(pwd):/construct -e CONSTRUCT_ROOT -e MINIFORGE_VERSION -e MINIFORGE_NAME $DOCKERIMAGE /construct/scripts/build.sh

echo "============= Download QEMU static binaries ============="
bash scripts/get_qemu.sh
Expand All @@ -24,6 +25,6 @@ echo "============= Test the installer ============="
for TEST_IMAGE_NAME in "ubuntu:20.04" "ubuntu:19.10" "ubuntu:16.04" "ubuntu:18.04" "centos:7" "debian:buster"
do
echo "============= Test installer on $TEST_IMAGE_NAME ============="
docker run --rm -v $(pwd):/construct -v $(pwd)/build/qemu/qemu-${ARCH}-static:/usr/bin/qemu-${ARCH}-static ${DOCKER_ARCH}/$TEST_IMAGE_NAME /construct/scripts/test.sh
docker run --rm -v $(pwd):/construct -e CONSTRUCT_ROOT -v $(pwd)/build/qemu/qemu-${ARCH}-static:/usr/bin/qemu-${ARCH}-static ${DOCKER_ARCH}/$TEST_IMAGE_NAME /construct/scripts/test.sh
done

3 changes: 3 additions & 0 deletions build_miniforge_win.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
conda install posix --yes
scripts/build.sh
scripts/test.sh
12 changes: 9 additions & 3 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@ set -xe

echo "***** Start: Building Miniforge installer *****"

CONSTRUCT_ROOT="${CONSTRUCT_ROOT:-/construct}"
CONSTRUCT_ROOT="${CONSTRUCT_ROOT:-$PWD}"

cd $CONSTRUCT_ROOT

# Constructor should be latest for non-native building
# See https://github.com/conda/constructor
echo "***** Install constructor *****"
conda install -y "constructor>=3.1.0" jinja2 coreutils
conda install -y "constructor>=3.1.0" jinja2 -c conda-forge -c defaults --override-channels
if [[ "$(uname)" == "Darwin" ]]; then
conda install -y coreutils -c conda-forge -c defaults --override-channels
elif [[ "$(uname)" == MINGW* ]]; then
conda install -y "nsis=3.01" -c conda-forge -c defaults --override-channels
fi
pip install git+git://github.com/conda/constructor@8c0121d3b81846de42973b52f13135f0ffeaddda#egg=constructor --force --no-deps
conda list

Expand All @@ -37,11 +42,12 @@ constructor $TEMP_DIR/Miniforge3/ --output-dir $TEMP_DIR $EXTRA_CONSTRUCTOR_ARGS
echo "***** Generate installer hash *****"
cd $TEMP_DIR
# This line ill break if there is more than one installer in the folder.
INSTALLER_PATH=$(find . -name "Miniforge*.sh" | head -n 1)
INSTALLER_PATH=$(find . -name "Miniforge*.sh" -or -name "Miniforge*.exe" | head -n 1)
HASH_PATH="$INSTALLER_PATH.sha256"
sha256sum $INSTALLER_PATH > $HASH_PATH

echo "***** Move installer and hash to build folder *****"
mkdir -p $CONSTRUCT_ROOT/build
mv $INSTALLER_PATH $CONSTRUCT_ROOT/build/
mv $HASH_PATH $CONSTRUCT_ROOT/build/

Expand Down
39 changes: 31 additions & 8 deletions scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,45 @@ echo "***** Start: Testing Miniforge installer *****"

export CONDA_PATH="$HOME/miniforge"

CONSTRUCT_ROOT="${CONSTRUCT_ROOT:-/construct}"
CONSTRUCT_ROOT="${CONSTRUCT_ROOT:-$PWD}"

cd ${CONSTRUCT_ROOT}

echo "***** Get the installer *****"
INSTALLER_PATH=$(find build/ -name "Miniforge*$ARCH.sh" | head -n 1)
INSTALLER_PATH=$(find build/ -name "Miniforge*.sh" -or -name "Miniforge*.exe"| head -n 1)

echo "***** Run the installer *****"
chmod +x $INSTALLER_PATH
bash $INSTALLER_PATH -b -p $CONDA_PATH
if [[ "$(uname)" == MINGW* ]]; then
echo "start /wait \"\" build/Miniforge3-4.9.0-0-Windows-x86_64.exe /InstallationType=JustMe /RegisterPython=0 /S /D=$(cygpath -w $CONDA_PATH)" > install.bat
cmd.exe /c install.bat

echo "***** Setup conda *****"
source $CONDA_PATH/bin/activate
echo "***** Setup conda *****"
source $CONDA_PATH/Scripts/activate
conda.exe config --set show_channel_urls true

echo "***** Print conda info *****"
conda.exe info
conda.exe list

echo "***** Check if we are bundling packages from msys2 or defaults *****"
conda.exe list | grep defaults && exit 1
conda.exe list | grep msys2 && exit 1

echo "***** Check if we can install a package which requires msys2 *****"
conda.exe install r-base --yes --quiet
conda.exe list
else
bash $INSTALLER_PATH -b -p $CONDA_PATH

echo "***** Setup conda *****"
source $CONDA_PATH/bin/activate

echo "***** Print conda info *****"
conda info
conda list
fi

echo "***** Print conda info *****"
conda info

# 2020/09/15: Running conda update switches from pypy to cpython. Not sure why
# echo "***** Run conda update *****"
Expand All @@ -38,4 +61,4 @@ python -c "import platform; print(platform.system())"
python -c "import platform; print(platform.machine())"
python -c "import platform; print(platform.release())"

echo "***** Done: Building Testing installer *****"
echo "***** Done: Testing installer *****"

0 comments on commit dc45523

Please sign in to comment.