pyodide/.circleci/config.yml

475 lines
12 KiB
YAML
Raw Normal View History

version: 2.1
2018-06-01 13:07:15 +00:00
2018-08-17 08:29:10 +00:00
defaults: &defaults
working_directory: ~/repo
docker:
2021-07-20 08:48:27 +00:00
- image: pyodide/pyodide-env:19
environment:
- EMSDK_NUM_CORES: 3
EMCC_CORES: 3
PYODIDE_JOBS: 3
2021-09-11 12:22:13 +00:00
# Make sure the ccache dir is consistent between core and package builds
# (it's not the case otherwise)
CCACHE_DIR: /root/.ccache/
2018-06-01 13:07:15 +00:00
2018-08-17 08:29:10 +00:00
jobs:
lint:
2018-08-17 08:29:10 +00:00
<<: *defaults
resource_class: small
2018-06-01 13:07:15 +00:00
steps:
- checkout
2018-06-14 18:19:08 +00:00
- run:
name: lint
command: make lint
test-docs:
<<: *defaults
resource_class: small
steps:
- checkout
- run:
name: Test docs
command: |
mkdir test-results
pytest docs/sphinx_pyodide/tests --junitxml=test-results/junit.xml
- store_test_results:
path: test-results
build-core:
<<: *defaults
steps:
- checkout
2018-06-14 18:19:08 +00:00
2018-06-01 13:07:15 +00:00
- restore_cache:
keys:
- -core-{{ checksum "Makefile.envs" }}-{{ checksum "cpython/Makefile" }}-v20210910-
2018-06-01 13:07:15 +00:00
- run:
name: build emsdk
2018-06-01 13:07:15 +00:00
no_output_timeout: 1200
command: |
2021-09-11 12:22:13 +00:00
# This is necessary to use the ccache from emsdk
source pyodide_env.sh
2018-08-06 17:58:05 +00:00
ccache -z
make -C emsdk
ccache -s
2021-09-11 12:22:13 +00:00
# Set mtime for EM_CONFIG to avoid ccache cache misses
touch -m -d '1 Jan 2021 12:00' emsdk/emsdk/.emscripten
- run:
name: build cpython
no_output_timeout: 1200
command: |
2021-09-11 12:22:13 +00:00
# This is necessary to use the ccache from emsdk
source pyodide_env.sh
ccache -z
make -C cpython
ccache -s
- run:
name: build pyodide core
no_output_timeout: 1200
command: |
2021-09-11 12:22:13 +00:00
# This is necessary to use the ccache from emsdk
source pyodide_env.sh
ccache -z
PYODIDE_PACKAGES="core" make
2018-07-24 19:40:25 +00:00
ccache -s
2018-06-01 13:07:15 +00:00
2018-09-27 09:38:26 +00:00
- run:
name: check-size
command: ls -lh build/
2018-06-01 13:07:15 +00:00
- save_cache:
paths:
2021-09-11 12:22:13 +00:00
- /root/.ccache
key: -core-{{ checksum "Makefile.envs" }}-{{ checksum "cpython/Makefile" }}-v20210910-
2018-06-01 13:07:15 +00:00
- run:
name: Clean up workspace
command: |
rm -rf cpython/{build,downloads}
rm -rf emsdk/emsdk/binaryen
2018-08-17 08:29:10 +00:00
- persist_to_workspace:
root: .
paths:
- .
2018-08-17 08:29:10 +00:00
- store_artifacts:
path: /root/repo/build/
build-packages:
2020-05-08 23:46:59 +00:00
<<: *defaults
resource_class: large
2020-05-08 23:46:59 +00:00
steps:
- checkout
- attach_workspace:
at: .
2020-05-08 23:46:59 +00:00
- restore_cache:
keys:
2021-09-11 12:22:13 +00:00
- -pkg-{{ checksum "Makefile.envs" }}-v20210911-
2020-05-08 23:46:59 +00:00
- run:
name: build packages
no_output_timeout: 1800
2020-05-08 23:46:59 +00:00
command: |
2021-09-11 12:22:13 +00:00
source pyodide_env.sh
# Set mtime for EM_CONFIG to avoid ccache cache misses
touch -m -d '1 Jan 2021 12:00' emsdk/emsdk/.emscripten
2020-05-08 23:46:59 +00:00
ccache -z
PYODIDE_PACKAGES='*' make -C packages
2020-05-08 23:46:59 +00:00
ccache -s
environment:
PYODIDE_JOBS: 5
2020-05-08 23:46:59 +00:00
- run:
name: check-size
command: ls -lh build/
- save_cache:
paths:
2021-09-11 12:22:13 +00:00
- /root/.ccache
key: -pkg-{{ checksum "Makefile.envs" }}-v20210911-
- persist_to_workspace:
root: .
paths:
- ./packages/.artifacts
- ./build
- store_artifacts:
2020-12-25 08:46:57 +00:00
path: /root/repo/build/
- store_artifacts:
path: /root/repo/packages/build-logs
test-main:
parameters:
test-params:
description: The tests to run.
type: string
2018-08-17 08:29:10 +00:00
<<: *defaults
resource_class: medium+
2018-08-17 08:29:10 +00:00
steps:
- attach_workspace:
at: .
2018-06-01 13:07:15 +00:00
- run:
name: test
command: |
2021-06-26 17:31:00 +00:00
mkdir test-results
tools/pytest_wrapper.py \
--junitxml=test-results/junit.xml \
2021-07-16 21:33:05 +00:00
--verbose \
<< parameters.test-params >>
2021-06-26 17:31:00 +00:00
- store_test_results:
path: test-results
2018-06-19 17:36:14 +00:00
2021-07-09 20:37:28 +00:00
benchmark-stack-size:
<<: *defaults
steps:
- attach_workspace:
at: .
- run:
name: stack-size
command: |
pytest -s benchmark/stack_usage.py | sed -n 's/## //pg'
2021-07-09 20:37:28 +00:00
2020-12-21 03:20:11 +00:00
test-emsdk:
<<: *defaults
resource_class: small
2020-12-21 03:20:11 +00:00
steps:
- attach_workspace:
at: .
- run:
name: test
command: make -C emsdk test
2020-12-21 03:20:11 +00:00
2018-10-15 15:04:54 +00:00
test-python:
# Unlike test-main this uses "resource_class small" and doesn't use "pytest_wrapper."
2018-10-15 15:04:54 +00:00
<<: *defaults
resource_class: small
2018-10-15 15:04:54 +00:00
steps:
- checkout
- run:
name: test
command: |
2021-06-26 17:31:00 +00:00
mkdir test-results
pytest \
--junitxml=test-results/junit.xml \
--verbose \
2021-07-20 08:48:27 +00:00
-k 'not (chrome or firefox or node)' \
--cov=pyodide_build --cov=pyodide \
src pyodide-build packages/micropip/
2021-06-26 17:31:00 +00:00
- store_test_results:
path: test-results
2018-10-15 15:04:54 +00:00
2021-07-06 08:48:35 +00:00
test-js:
<<: *defaults
resource_class: small
steps:
- attach_workspace:
at: .
- run:
name: test
command: |
cd src/js
npx tsd
2021-07-09 20:26:58 +00:00
npm install
2021-07-06 08:48:35 +00:00
npm test
- run:
name: check if webpack cli works well with load-pyodide.js
command: |
git clone https://github.com/pyodide/pyodide-webpack-example.git
cd pyodide-webpack-example
npm install
cp ../src/js/load-pyodide.js node_modules/pyodide/load-pyodide.js
head -20 node_modules/pyodide/load-pyodide.js
npx webpack
benchmark:
<<: *defaults
resource_class: medium+
steps:
- checkout
- attach_workspace:
at: .
- run:
name: benchmark
command: |
2020-12-07 23:19:16 +00:00
python benchmark/benchmark.py /usr/local/bin/python3 build/benchmarks.json
2018-10-02 13:25:35 +00:00
- store_artifacts:
2020-12-25 08:46:57 +00:00
path: /root/repo/build/benchmarks.json
2019-05-31 18:39:52 +00:00
deploy-release:
# To reduce chance of deployment issues, try to keep the steps here as
# similar as possible to the steps in deploy-dev!
resource_class: small
2018-11-02 15:25:13 +00:00
docker:
- image: cibuilds/github:0.13
2018-11-02 15:25:13 +00:00
2018-06-19 17:36:14 +00:00
steps:
2018-08-24 14:31:28 +00:00
- checkout
- attach_workspace:
2018-11-02 15:30:36 +00:00
at: .
- run:
name: Install requirements
command: |
apk add --no-cache --update python3 make
python3 -m pip install awscli
2018-06-19 17:36:14 +00:00
- run:
2018-11-02 15:25:13 +00:00
name: Deploy Github Releases
2018-06-19 17:36:14 +00:00
command: |
cp -r build /tmp/pyodide
cd /tmp/
tar cjf pyodide-build-${CIRCLE_TAG}.tar.bz2 pyodide/
2018-11-07 17:17:03 +00:00
ghr -t "${GITHUB_TOKEN}" -u "${CIRCLE_PROJECT_USERNAME}" -r "${CIRCLE_PROJECT_REPONAME}" -c "${CIRCLE_SHA1}" -delete "${CIRCLE_TAG}" ./pyodide-build-${CIRCLE_TAG}.tar.bz2
2018-06-19 17:36:14 +00:00
- run:
name: Set PYODIDE_BASE_URL
2021-04-21 19:51:28 +00:00
command: PYODIDE_BASE_URL="https://cdn.jsdelivr.net/pyodide/v${CIRCLE_TAG}/full/" make update_base_url
- run:
name: Deploy to pyodide-cdn2.iodide.io
command: |
find build/ -type f -print0 | xargs -0 -n1 -I@ bash -c "echo \"Compressing @\"; gzip @; mv @.gz @;"
aws s3 sync build/ "s3://pyodide-cdn2.iodide.io/v${CIRCLE_TAG}/full/" --exclude '*.data' --cache-control 'max-age=30758400, immutable, public' --content-encoding 'gzip' # 1 year cache
aws s3 sync build/ "s3://pyodide-cdn2.iodide.io/v${CIRCLE_TAG}/full/" --exclude '*' --include '*.data' --cache-control 'max-age=30758400, immutable, public' --content-type 'application/wasm' --content-encoding 'gzip' # 1 year
# update 301 redirect for the /latest/* route.
aws s3api put-bucket-website --cli-input-json file://.circleci/s3-website-config.json
deploy-dev:
# To reduce chance of deployment issues, try to keep the steps here as
# similar as possible to the steps in deploy-release!
resource_class: small
2019-05-31 18:39:52 +00:00
docker:
- image: cibuilds/github:0.13
2019-05-31 18:39:52 +00:00
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Install requirements
2019-05-31 18:39:52 +00:00
command: |
apk add --no-cache --update python3 make
python3 -m pip install awscli
- run:
name: Set PYODIDE_BASE_URL
command: PYODIDE_BASE_URL="https://cdn.jsdelivr.net/pyodide/dev/full/" make update_base_url
2019-05-31 18:39:52 +00:00
- run:
name: Deploy to pyodide-cdn2.iodide.io
2019-05-31 18:39:52 +00:00
command: |
find build/ -type f -print0 | xargs -0 -n1 -I@ bash -c "echo \"Compressing @\"; gzip @; mv @.gz @;"
aws s3 rm --recursive "s3://pyodide-cdn2.iodide.io/dev/full/"
aws s3 sync build/ "s3://pyodide-cdn2.iodide.io/dev/full/" --exclude '*.data' --cache-control 'max-age=3600, public' --content-encoding 'gzip' # 1 hour cache
aws s3 sync build/ "s3://pyodide-cdn2.iodide.io/dev/full/" --exclude '*' --include '*.data' --cache-control 'max-age=3600, public' --content-type 'application/wasm' --content-encoding 'gzip' # 1 hour cache
2019-05-31 18:39:52 +00:00
2018-06-19 17:36:14 +00:00
workflows:
version: 2
build-and-deploy:
jobs:
2021-07-24 20:30:54 +00:00
- lint:
filters:
tags:
only: /.*/
- test-docs:
filters:
tags:
only: /.*/
- test-python:
filters:
tags:
only: /.*/
- build-core:
filters:
tags:
only: /.*/
- build-packages:
requires:
- build-core
2021-07-24 20:30:54 +00:00
filters:
tags:
only: /.*/
- test-main:
name: test-core-chrome
test-params: -k "chrome and not webworker" src packages/micropip
2018-06-19 17:36:14 +00:00
requires:
- build-core
2021-07-24 20:30:54 +00:00
filters:
tags:
only: /.*/
- test-main:
name: test-core-firefox
test-params: -k "firefox and not webworker" src packages/micropip
2018-08-17 08:29:10 +00:00
requires:
- build-core
2021-07-24 20:30:54 +00:00
filters:
tags:
only: /.*/
2021-07-20 08:48:27 +00:00
- test-main:
name: test-core-node
test-params: -k node src packages/micropip
requires:
- build-core
2021-07-24 20:30:54 +00:00
filters:
tags:
only: /.*/
- test-main:
name: test-core-chrome-webworker
test-params: -k chrome src/tests/test_webworker.py
requires:
- test-core-chrome
2021-07-24 20:30:54 +00:00
filters:
tags:
only: /.*/
- test-main:
name: test-core-firefox-webworker
test-params: -k firefox src/tests/test_webworker.py
requires:
- test-core-firefox
2021-07-24 20:30:54 +00:00
filters:
tags:
only: /.*/
- test-main:
name: test-packages-chrome
test-params: -k chrome packages/test* packages/*/test*
requires:
- build-packages
2021-07-24 20:30:54 +00:00
filters:
tags:
only: /.*/
- test-main:
name: test-packages-firefox
test-params: -k firefox packages/test* packages/*/test*
requires:
- build-packages
2021-07-24 20:30:54 +00:00
filters:
tags:
only: /.*/
2021-07-20 08:48:27 +00:00
- test-main:
name: test-packages-node
test-params: -k "node and not numpy" packages/test* packages/*/test*
requires:
- build-packages
2021-07-24 20:30:54 +00:00
filters:
tags:
only: /.*/
2020-12-21 03:20:11 +00:00
- test-emsdk:
requires:
- build-core
2021-07-24 20:30:54 +00:00
filters:
tags:
only: /.*/
2021-07-06 08:48:35 +00:00
- test-js:
requires:
- build-core
2021-07-24 20:30:54 +00:00
filters:
tags:
only: /.*/
2021-07-09 20:37:28 +00:00
- benchmark-stack-size:
requires:
- build-core
2021-07-24 20:30:54 +00:00
filters:
tags:
only: /.*/
- benchmark:
requires:
- build-packages
2021-07-24 20:30:54 +00:00
filters:
tags:
only: /.*/
2019-05-31 18:39:52 +00:00
- deploy-release:
requires:
- lint
- test-python
- test-core-firefox
- test-packages-firefox
- test-emsdk
2019-05-31 18:39:52 +00:00
filters:
branches:
ignore: /.*/
2019-05-31 18:39:52 +00:00
tags:
only: /^\d+\.\d+\.\w+$/
- deploy-dev:
2018-08-17 08:29:10 +00:00
requires:
- lint
- test-python
- test-core-firefox
- test-packages-firefox
- test-emsdk
2018-06-19 17:36:14 +00:00
filters:
2018-11-06 14:20:01 +00:00
branches:
only: main