mirror of https://github.com/pyodide/pyodide.git
Provide a Docker image for building
This commit is contained in:
parent
6d76f25bd7
commit
4562841b61
|
@ -3,7 +3,7 @@ version: 2
|
|||
defaults: &defaults
|
||||
working_directory: ~/repo
|
||||
docker:
|
||||
- image: circleci/python:3.7.0-stretch-browsers
|
||||
- image: registry.hub.docker.com/mdboom/pyodide:0.1.1
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
@ -11,42 +11,9 @@ jobs:
|
|||
steps:
|
||||
- checkout
|
||||
|
||||
- run:
|
||||
name: dependencies
|
||||
command: |
|
||||
|
||||
# We need at least g++-8, but stretch comes with g++-6
|
||||
# Set up the Debian testing repo, and then install g++ from there...
|
||||
sudo bash -c "echo \"deb http://ftp.us.debian.org/debian testing main contrib non-free\" >> /etc/apt/sources.list"
|
||||
sudo apt-get update
|
||||
sudo apt-get install node-less cmake build-essential clang-format-6.0 uglifyjs chromium ccache
|
||||
sudo apt-get install -t testing g++-8
|
||||
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6
|
||||
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 80 --slave /usr/bin/g++ g++ /usr/bin/g++-8
|
||||
sudo update-alternatives --set gcc /usr/bin/gcc-8
|
||||
sudo ln -s /usr/bin/clang-format-6.0 /usr/bin/clang-format
|
||||
|
||||
# Install Python dependencies
|
||||
sudo pip install virtualenv
|
||||
virtualenv pyodide-env
|
||||
source pyodide-env/bin/activate
|
||||
pip install pytest pytest-xdist pytest-instafail selenium PyYAML flake8
|
||||
|
||||
# Get recent version of Firefox and geckodriver
|
||||
wget -O firefox.tar.bz2 https://download.mozilla.org/\?product\=firefox-latest-ssl\&os\=linux64\&lang\=en-US
|
||||
tar jxf firefox.tar.bz2
|
||||
wget https://github.com/mozilla/geckodriver/releases/download/v0.21.0/geckodriver-v0.21.0-linux64.tar.gz
|
||||
tar zxf geckodriver-v0.21.0-linux64.tar.gz -C firefox
|
||||
|
||||
# Get recent version of chromedriver
|
||||
wget https://chromedriver.storage.googleapis.com/2.41/chromedriver_linux64.zip
|
||||
unzip chromedriver_linux64.zip
|
||||
mv chromedriver pyodide-env/bin/
|
||||
|
||||
- run:
|
||||
name: lint
|
||||
command: |
|
||||
source pyodide-env/bin/activate
|
||||
make lint
|
||||
|
||||
- restore_cache:
|
||||
|
@ -57,7 +24,6 @@ jobs:
|
|||
name: build
|
||||
no_output_timeout: 1200
|
||||
command: |
|
||||
source pyodide-env/bin/activate
|
||||
ccache -z
|
||||
make
|
||||
ccache -s
|
||||
|
@ -76,9 +42,7 @@ jobs:
|
|||
root: .
|
||||
paths:
|
||||
- ./build
|
||||
- ./pyodide-env
|
||||
- ./cpython/build/3.7.0/host
|
||||
- ./firefox
|
||||
|
||||
- store_artifacts:
|
||||
path: /home/circleci/repo/build/
|
||||
|
@ -92,12 +56,6 @@ jobs:
|
|||
- run:
|
||||
name: test
|
||||
command: |
|
||||
# This Debian is so old, it doesn't know about wasm as a mime type, which then
|
||||
# causes Firefox to complain when loading it. Let's just add the new mime type.
|
||||
sudo bash -c "echo 'application/wasm wasm' >> /etc/mime.types"
|
||||
|
||||
source pyodide-env/bin/activate
|
||||
export PATH=$PWD/firefox:$PATH
|
||||
pytest test -v -k firefox
|
||||
|
||||
test-chrome:
|
||||
|
@ -109,11 +67,6 @@ jobs:
|
|||
- run:
|
||||
name: test
|
||||
command: |
|
||||
# This Debian is so old, it doesn't know about wasm as a mime type, which then
|
||||
# causes Firefox to complain when loading it. Let's just add the new mime type.
|
||||
sudo bash -c "echo 'application/wasm wasm' >> /etc/mime.types"
|
||||
|
||||
source pyodide-env/bin/activate
|
||||
pytest test -v -k chrome
|
||||
|
||||
benchmark:
|
||||
|
@ -122,22 +75,9 @@ jobs:
|
|||
- checkout
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- run:
|
||||
name: dependencies
|
||||
command: |
|
||||
sudo bash -c "echo \"deb http://ftp.us.debian.org/debian testing main contrib non-free\" >> /etc/apt/sources.list"
|
||||
sudo apt-get update
|
||||
sudo apt-get install -t testing g++-8
|
||||
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6
|
||||
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 80 --slave /usr/bin/g++ g++ /usr/bin/g++-8
|
||||
sudo update-alternatives --set gcc /usr/bin/gcc-8
|
||||
- run:
|
||||
name: benchmark
|
||||
command: |
|
||||
sudo bash -c "echo 'application/wasm wasm' >> /etc/mime.types"
|
||||
|
||||
source pyodide-env/bin/activate
|
||||
export PATH=$PWD/firefox:$PATH
|
||||
python benchmark/benchmark.py cpython/build/3.7.0/host/bin/python3 build/benchmarks.json
|
||||
- store_artifacts:
|
||||
path: /home/circleci/repo/build/benchmarks.json
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
FROM circleci/python:3.7.0-stretch-browsers
|
||||
|
||||
# We need at least g++-8, but stretch comes with g++-6
|
||||
# Set up the Debian testing repo, and then install g++ from there...
|
||||
RUN sudo bash -c "echo \"deb http://ftp.us.debian.org/debian testing main contrib non-free\" >> /etc/apt/sources.list"
|
||||
RUN sudo apt-get update
|
||||
RUN sudo apt-get install node-less cmake build-essential clang-format-6.0 uglifyjs chromium ccache
|
||||
RUN sudo apt-get install -t testing g++-8
|
||||
RUN sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6
|
||||
RUN sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 80 --slave /usr/bin/g++ g++ /usr/bin/g++-8
|
||||
RUN sudo update-alternatives --set gcc /usr/bin/gcc-8
|
||||
RUN sudo apt-get clean
|
||||
RUN sudo ln -s /usr/bin/clang-format-6.0 /usr/bin/clang-format
|
||||
|
||||
RUN sudo pip install pytest pytest-xdist pytest-instafail selenium PyYAML flake8
|
||||
|
||||
# Get recent version of Firefox and geckodriver
|
||||
RUN sudo wget --quiet -O firefox.tar.bz2 https://download.mozilla.org/\?product\=firefox-latest-ssl\&os\=linux64\&lang\=en-US
|
||||
RUN sudo tar jxf firefox.tar.bz2
|
||||
RUN sudo rm -f /usr/local/bin/firefox
|
||||
RUN sudo ln -s $PWD/firefox/firefox /usr/local/bin/firefox
|
||||
RUN sudo wget --quiet https://github.com/mozilla/geckodriver/releases/download/v0.21.0/geckodriver-v0.21.0-linux64.tar.gz
|
||||
RUN sudo tar zxf geckodriver-v0.21.0-linux64.tar.gz -C /usr/local/bin
|
||||
|
||||
# Get recent version of chromedriver
|
||||
RUN sudo wget --quiet https://chromedriver.storage.googleapis.com/2.41/chromedriver_linux64.zip
|
||||
RUN sudo unzip chromedriver_linux64.zip
|
||||
RUN sudo mv $PWD/chromedriver /usr/local/bin
|
||||
|
||||
RUN sudo bash -c "echo 'application/wasm wasm' >> /etc/mime.types"
|
||||
|
||||
WORKDIR /src
|
19
README.md
19
README.md
|
@ -15,7 +15,8 @@ See [the demo](https://iodide.io/pyodide-demo/python.html)
|
|||
|
||||
# Building
|
||||
|
||||
These instructions were tested on Linux. OSX should be mostly the same.
|
||||
Building is easiest on Linux. For other platforms, we recommend using
|
||||
the Docker image (described below) to build Pyodide.
|
||||
|
||||
Make sure the prerequisites for [emsdk](https://github.com/juj/emsdk) are
|
||||
installed. Pyodide will build a custom, patched version of emsdk, so there is no
|
||||
|
@ -33,6 +34,22 @@ Additional build prerequisites are:
|
|||
|
||||
`make`
|
||||
|
||||
## Using Docker
|
||||
|
||||
We provide a Debian-based Docker image on Docker Hub with the dependencies
|
||||
already installed to make it easier to build Pyodide.
|
||||
|
||||
1. Install Docker
|
||||
|
||||
2. From a git checkout of Pyodide, run `./run_docker`
|
||||
|
||||
3. cd `/src`
|
||||
|
||||
4. Run `make` to build.
|
||||
|
||||
You can edit the files in your source checkout on your host machine, and then
|
||||
repeatedly run `make` inside the Docker environment to test your changes.
|
||||
|
||||
# Testing
|
||||
|
||||
Install the following dependencies into the default Python installation:
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
docker run -v $PWD:/src --user root -e NB_UID=$UID -e NB_GID+$GID -it registry.hub.docker.com/mdboom/pyodide:0.1.1 /bin/bash
|
Loading…
Reference in New Issue