pyodide/.circleci/config.yml

171 lines
5.0 KiB
YAML

version: 2
defaults: &defaults
working_directory: ~/repo
docker:
- image: circleci/python:3.7.0-stretch-browsers
jobs:
build:
<<: *defaults
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:
keys:
- v1-emsdk-{{ checksum "emsdk/Makefile" }}-v7-
- run:
name: build
no_output_timeout: 1200
command: |
source pyodide-env/bin/activate
ccache -z
make
ccache -s
- run:
name: check-size
command: ls -lh build/
- save_cache:
paths:
- ./emsdk/emsdk
- ~/.ccache
key: v1-emsdk-{{ checksum "emsdk/Makefile" }}-v7-{{ .BuildNum }}
- persist_to_workspace:
root: .
paths:
- ./build
- ./pyodide-env
- ./cpython/build/3.7.0/host
- ./firefox
- store_artifacts:
path: /home/circleci/repo/build/
test-firefox:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: .
- 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:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: .
- 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:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: .
- 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
python benchmark/plot_benchmark.py build/benchmarks.json build/benchmarks.png
- store_artifacts:
path: /home/circleci/repo/build
deploy:
machine:
enabled: true
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Deploy to Github Pages
command: |
.circleci/deploy.sh
workflows:
version: 2
build-and-deploy:
jobs:
- build
- test-chrome:
requires:
- build
- test-firefox:
requires:
- build
- benchmark:
requires:
- build
- deploy:
requires:
- test-chrome
- test-firefox
filters:
branches:
only: master