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

Build installer on Docker #2

Merged
merged 58 commits into from
Nov 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
684b7d7
Build installer on Docker
hadim Nov 15, 2019
25c31cb
add docker config
hadim Nov 15, 2019
df24f54
fix matrix
hadim Nov 15, 2019
47e4625
fix release
hadim Nov 15, 2019
381b2d9
add build directory
hadim Nov 15, 2019
06a4686
simplify travis
hadim Nov 15, 2019
17ac046
add license in readme
hadim Nov 15, 2019
97e214f
add test
hadim Nov 15, 2019
158ec5c
rename to amd64
hadim Nov 15, 2019
7bcc051
enable test
hadim Nov 15, 2019
53223de
fix travix
hadim Nov 15, 2019
d5399c5
rename conda to miniforge
hadim Nov 15, 2019
8a24ce6
use comp7
hadim Nov 15, 2019
1d72fd2
add tqdm dep (needed by conda)
hadim Nov 15, 2019
06a92db
remove version
hadim Nov 15, 2019
c4a344d
dont edit construct.yaml + add test for conda update command (current…
hadim Nov 15, 2019
46afdfd
typo
hadim Nov 15, 2019
a24bc27
disable other arch than aarch64
hadim Nov 15, 2019
051b305
Add LICENSE to build/
hadim Nov 15, 2019
7ad47ac
try conda-package-handling
hadim Nov 15, 2019
b5d240c
remove useless dep
hadim Nov 15, 2019
3a44d24
fix test.sh
hadim Nov 15, 2019
1fc5249
Remove useless docker images + update readme
hadim Nov 15, 2019
99d9a9d
remove build files
hadim Nov 15, 2019
33fe0e1
add temp file to gitignore
hadim Nov 15, 2019
526e70f
better readme
hadim Nov 15, 2019
6e1e3c5
display conda list during build
hadim Nov 15, 2019
1e5b378
remove anaconda channel
hadim Nov 15, 2019
88c24af
remove useless build dir
hadim Nov 15, 2019
3e45f9d
reintegrate the build dir (needed because of permission issue) + use …
hadim Nov 15, 2019
a22f9d7
fix typo in build.sh
hadim Nov 15, 2019
c0ac3f7
fix typo in build.sh v2
hadim Nov 15, 2019
21d417e
use base image for testing
hadim Nov 15, 2019
3de013a
fix gitignore
hadim Nov 15, 2019
91a51e7
use --volume instead of --mount cuz it's easier to read
hadim Nov 15, 2019
6088eb6
custom test images
hadim Nov 16, 2019
1b7ba47
add info in readme about testing
hadim Nov 16, 2019
82e4d6c
remove set -x and add echo during build and test
hadim Nov 16, 2019
2c90a0f
fix conda init + various things
hadim Nov 16, 2019
d93a683
typo
hadim Nov 16, 2019
aac93c9
consolidate scripts
hadim Nov 16, 2019
330f43d
format
hadim Nov 16, 2019
36ebc02
Ran through a full build
hmaarrfk Nov 17, 2019
90db74e
Stated that Ubuntu 16.04 isn't tested on
hmaarrfk Nov 17, 2019
5cdd77b
Remove the before_install section
hmaarrfk Nov 17, 2019
aa7f49a
Added back Unbut 16.04 and Debian Buster
hmaarrfk Nov 17, 2019
727b924
remove mark channel
hmaarrfk Nov 17, 2019
7a491c7
fix constructor conda selector
hadim Nov 18, 2019
b59b419
various rename
hadim Nov 18, 2019
61943d0
install correct conda version
hadim Nov 18, 2019
ee73659
cd before checking conda version
hadim Nov 18, 2019
2431366
define conda version in construct.yaml
hadim Nov 18, 2019
f79ff6d
set conda version
hadim Nov 18, 2019
0726710
specify python version
hadim Nov 18, 2019
f4f8dc5
use Miniforge3
hadim Nov 18, 2019
1608db2
use CONSTRUCT_ROOT
hadim Nov 19, 2019
bc0bc8b
add instruuctions for releasing
hadim Nov 19, 2019
ce594e6
generate sha256 hash of the installer and upload it
hadim Nov 19, 2019
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Miniforge3-*
build/
18 changes: 14 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
language: minimal
language: generic

install:
- ./build.sh
matrix:
include:
- os: linux
env:
- ARCH=aarch64
- DOCKERIMAGE=condaforge/linux-anvil-aarch64
hadim marked this conversation as resolved.
Show resolved Hide resolved
- QEMU_BINARY=qemu-aarch64-static

script:
- bash build_miniforge.sh

deploy:
provider: releases
file: Miniconda3-*.sh
file:
- "build/Miniforge*.sh"
- "build/Miniforge*.sha256"
skip_cleanup: true
api_key:
secure: APK2p2eTV4YxOrQzwm+GnJs32V1MplI4VG8Lslr/y7qky8Cpl91o7pUAYOEs5dL2RZlPrDNiWNsPP5JYRiO7YjTv5lPXjSyoAavf/JcLIC1OgjNqn029wdITrOLXAPGtL3OM+K70CYdzbLc/X0VlC0mWSOUlxox7hoKKUhXY/EF29lneRjNhUM+Wb4utn61K70YzXvSGMnmHyti0KhOG7ACfZlJY99wwgQVBaAfKCCgFj+J1aeorifu6FgOu13cPfvnfnC9qJnd7mL9tTQl9ZjLTG8k8fvlyyqkEoExhSXpPzgp1a7q11uxT/ys8rR/2ivOMpYyGUgA848Eswiy9+w581An2TRMbm0zYdqzFG0kYTCcG22TGdZukKq1rXO6TDLCYT3V44L7s72VxfI4tNDCVDcfeQVOEUwlUmyC/O9CslKyZewf9gB5OT5IQ8eSDsrwoiGvQC7r2oxsm7zL4oOkC4mDpdRqOFeQOw3AkoRcrTSkw+eQALfhGEtGkJAOqEEHlsStSCBBkfokmRRksD+l6mSJKR426kDKDr3/69Taq5WiEzbTSGZyRk+5l7+GlNnolKXMrceA9sUHlMLSKvePmiPRdqq1jJLZHtlxEGRZyc7QolgRMpQGdQYxucearmM0BBPGahVsx+V4Mq5Jufom//P0isH9MJzk4p9npSIk=
Expand Down
8 changes: 4 additions & 4 deletions Miniforge3/construct.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: Miniforge3
version: 4.7.11-0
hadim marked this conversation as resolved.
Show resolved Hide resolved

hadim marked this conversation as resolved.
Show resolved Hide resolved
channels:
- https://conda.anaconda.org/conda-forge
- https://conda.anaconda.org/anaconda
# This will continue to be a dependency until the compilers are
# moved to conda-forge or to anaconda
# moved to conda-forge.
- https://conda.anaconda.org/c4aarch64 [linux-aarch64]

write_condarc: True
license_file: ../LICENSE

specs:
- python >=3,<3.8
- conda
- python 3.7
- conda 4.7.11
- pip
80 changes: 64 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,69 @@
This repository holds a minimal installer for conda on platforms that
conda-forge supports but that aren't supported by Miniconda
# miniforge
[![Build Status](https://travis-ci.org/conda-forge/miniforge.svg?branch=master)](https://travis-ci.org/conda-forge/miniforge)

This repository holds a minimal installer for conda on platforms that conda-forge supports but that aren't supported by [Miniconda]((https://docs.conda.io/en/latest/miniconda.html).

This work is still very experimental
**Important: This work is still very experimental.**

Relevant conversations
* https://github.com/conda-forge/conda-forge.github.io/issues/871#issue-496677528
* https://github.com/conda-forge/conda-forge.github.io/pull/922
Relevant conversations:

- https://github.com/conda-forge/conda-forge.github.io/issues/871#issue-496677528
- https://github.com/conda-forge/conda-forge.github.io/pull/922

Features of this repository to implement:
- [ ] Automatic build of constructor
- [ ] aarch64 -- https://github.com/conda-forge/miniforge/pull/1
- [ ] Other architectures???
- [ ] Automatic upload of constructor results
- [ ] Test: https://github.com/conda-forge/miniforge/pull/1
- [ ] Automatic testing of constructor on Ubuntu 18.04 docker image
- [ ] Integration with conda-forge's developer documentation
- [ ] Integration with conda-forge's official site
- [ ] Upstream to Anaconda???
## Download

Miniforge installers are available here: https://github.com/conda-forge/miniforge/releases.

## Supported architectures

- `aarch64` (also called `arm64`)

## Features

- [X] Automatic build of constructor.
- [X] Automatic upload of constructor results.
- [X] Automatic testing of constructor.
- [ ] Integration with conda-forge's developer documentation.
- [ ] Integration with conda-forge's official site.
- [ ] Upstream to Anaconda ?

## Testing

After construction on Travis, the installer is tested against a range of distribution that match the installer architecture (`$ARCH`). For example when architecture is `aarch64`, the constructed installer is tested against:

- Centos 7
- Debian Buster (10)
- Ubuntu 16.04
- Ubuntu 18.04
- Ubuntu 19.10

## Usage

Installers are built and uploaded via Travis but if you want to construct your own Miniforge installer, here is how:

```bash
hadim marked this conversation as resolved.
Show resolved Hide resolved
# Configuration
export ARCH=aarch64
export DOCKERIMAGE=condaforge/linux-anvil-aarch64
export QEMU_BINARY=qemu-aarch64-static

bash build_miniforge.sh
```

## Release

To release a new version of Miniforge:

- Open a new PR.
- Edit [`Miniforge3/construct.yaml`](./Miniforge3/construct.yaml).
- Update the `version` tag to: `$CONDA_VERSION-$BUILD_NUMBER`. For example, `4.7.11-0`.
- Update `conda` version in the `specs` section to `$CONDA_VERSION`.
- Update `python` version in the `specs` section to the Python version used in [Miniconda](https://repo.anaconda.com/miniconda/).
- Once CI is happy, merge into `master`.
- Tag `HEAD` to `$CONDA_VERSION-$BUILD_NUMBER` and push the tag:
- `git tag $CONDA_VERSION-$BUILD_NUMBER`
- `git push origin master --tags`

## License

[BDS 3-clause](./LICENSE)
27 changes: 0 additions & 27 deletions build.sh

This file was deleted.

34 changes: 34 additions & 0 deletions build_miniforge.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash

set -e

# Check parameters
ARCH=${ARCH:-aarch64}
DOCKERIMAGE=${DOCKERIMAGE:-condaforge/linux-anvil-aarch64}
QEMU_BINARY=${QEMU_BINARY:-qemu-aarch64-static}

echo "============= Create build directory ============="
mkdir -p build/
chmod 777 build/

echo "============= Enable QEMU ============="
docker run --rm --privileged multiarch/qemu-user-static:register --reset --credential yes

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

echo "============= Download QEMU static binaries ============="
bash scripts/get_qemu.sh

echo "============= Test the installer ============="
for DOCKERFILE_PATH in $(find test_images/ -name "*.$ARCH")
do
TEST_IMAGE_SUFFIX=$(echo $DOCKERFILE_PATH | cut -d'.' -f2-)
TEST_IMAGE_NAME="miniforge_test_image.$TEST_IMAGE_SUFFIX"

echo "============= Building $TEST_IMAGE_NAME ============="
docker build -t $TEST_IMAGE_NAME -f $DOCKERFILE_PATH .

echo "============= Test installer on $TEST_IMAGE_NAME ============="
docker run --rm -ti -v $(pwd):/construct $TEST_IMAGE_NAME /construct/scripts/test.sh
done
38 changes: 38 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash

set -e

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

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

cd $CONSTRUCT_ROOT

# Constructor should be >= 3.0.1 for aarch64.
# See https://github.com/conda-forge/miniforge/pull/2#issuecomment-554394343
echo "***** Install constructor *****"
conda install -y "constructor>=3.0.1"
conda list

echo "***** Make temp directory *****"
TEMP_DIR=$(mktemp -d)

echo "***** Copy file for installer construction *****"
cp -R Miniforge3/ $TEMP_DIR/
hadim marked this conversation as resolved.
Show resolved Hide resolved
cp LICENSE $TEMP_DIR

echo "***** Construct the installer *****"
constructor $TEMP_DIR/Miniforge3/ --output-dir $TEMP_DIR
hadim marked this conversation as resolved.
Show resolved Hide resolved

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)
HASH_PATH="$INSTALLER_PATH.sha256"
sha256sum $INSTALLER_PATH > $HASH_PATH

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

echo "***** Done: Building Miniforge installer *****"
26 changes: 26 additions & 0 deletions scripts/get_qemu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash

CURRENT_DIR=$(pwd)
QEMU_STATIC_VERSION=v3.1.0-3
QEMU_DIR="./build/qemu/"

qemu_ppc64le_sha256=d018b96e20f7aefbc50e6ba93b6cabfd53490cdf1c88b02e7d66716fa09a7a17
qemu_aarch64_sha256=a64b39b8ce16e2285cb130bcba7143e6ad2fe19935401f01c38325febe64104b
qemu_arm_sha256=f4184c927f78d23d199056c5b0b6d75855e298410571d65582face3159117901

mkdir -p $QEMU_DIR/
cd $QEMU_DIR/

wget https://github.com/multiarch/qemu-user-static/releases/download/${QEMU_STATIC_VERSION}/qemu-ppc64le-static
wget https://github.com/multiarch/qemu-user-static/releases/download/${QEMU_STATIC_VERSION}/qemu-aarch64-static
wget https://github.com/multiarch/qemu-user-static/releases/download/${QEMU_STATIC_VERSION}/qemu-arm-static

sha256sum qemu-ppc64le-static | grep -F "${qemu_ppc64le_sha256}"
sha256sum qemu-aarch64-static | grep -F "${qemu_aarch64_sha256}"
sha256sum qemu-arm-static | grep -F "${qemu_aarch64_sha256}"

chmod +x qemu-ppc64le-static
chmod +x qemu-aarch64-static
chmod +x qemu-arm-static

cd $CURRENT_DIR
48 changes: 48 additions & 0 deletions scripts/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env bash

set -e

echo "***** Start: Testing Miniforge installer *****"

export CONDA_PATH="$HOME/miniforge"

echo "***** Install dependencies *****"
if [ -f /etc/redhat-release ]; then
yum install -y bzip2
fi

if [ -f /etc/debian_version ]; then
apt update -y
apt install -y bzip2
fi

cd /construct

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

echo "***** Run the installer *****"
chmod +x $INSTALLER_PATH
bash $INSTALLER_PATH -b -p $CONDA_PATH

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

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

echo "***** Run conda update *****"
conda update --all -y

echo "***** Python path *****"
python -c "import sys; print(sys.executable)"
python -c "import sys; assert 'miniforge' in sys.executable"

echo "***** Print system informations from Python *****"
python -c "print('Hello Miniforge !')"
python -c "import platform; print(platform.architecture())"
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 *****"
3 changes: 3 additions & 0 deletions test_images/Docker.centos7.aarch64
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM arm64v8/centos:7
hadim marked this conversation as resolved.
Show resolved Hide resolved
ADD build/qemu/qemu-aarch64-static /usr/bin/qemu-aarch64-static
ENV ARCH=aarch64
3 changes: 3 additions & 0 deletions test_images/Docker.debian_buster.aarch64
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM arm64v8/debian:buster
ADD build/qemu/qemu-aarch64-static /usr/bin/qemu-aarch64-static
ENV ARCH=aarch64
3 changes: 3 additions & 0 deletions test_images/Docker.ubuntu1604.aarch64
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM arm64v8/ubuntu:16.04
ADD build/qemu/qemu-aarch64-static /usr/bin/qemu-aarch64-static
ENV ARCH=aarch64
3 changes: 3 additions & 0 deletions test_images/Docker.ubuntu1804.aarch64
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM arm64v8/ubuntu:18.04
ADD build/qemu/qemu-aarch64-static /usr/bin/qemu-aarch64-static
ENV ARCH=aarch64
3 changes: 3 additions & 0 deletions test_images/Docker.ubuntu1910.aarch64
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM arm64v8/ubuntu:19.10
ADD build/qemu/qemu-aarch64-static /usr/bin/qemu-aarch64-static
ENV ARCH=aarch64