pyodide/.circleci/config.yml

248 lines
6.8 KiB
YAML
Raw Normal View History

2018-06-01 13:07:15 +00:00
version: 2
2018-08-17 08:29:10 +00:00
defaults: &defaults
working_directory: ~/repo
docker:
- image: iodide/pyodide-env:0.16.1
environment:
- EMSDK_NUM_CORES: 4
EMCC_CORES: 4
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
2018-06-01 13:07:15 +00:00
steps:
- checkout
2018-06-14 18:19:08 +00:00
- run:
name: lint
command: |
pip install black mypy
2020-09-24 10:28:10 +00:00
# TODO: investigate why clang-format without version is not available
sudo ln -s /usr/bin/clang-format-6.0 /usr/bin/clang-format
2018-06-14 18:19:08 +00:00
make lint
black --check --exclude tools/file_packager.py .
mypy --ignore-missing-imports pyodide_build/ src/ packages/micropip/micropip/ packages/*/test*
build:
<<: *defaults
steps:
- checkout
2018-06-14 18:19:08 +00:00
2018-06-01 13:07:15 +00:00
- restore_cache:
keys:
- v1-emsdk-{{ checksum "emsdk/Makefile" }}-v20201203-
- run:
name: dependencies
command: sudo apt install -y libtinfo5
2018-06-01 13:07:15 +00:00
- run:
name: build
no_output_timeout: 1200
command: |
2018-08-06 17:58:05 +00:00
ccache -z
2018-06-01 13:07:15 +00:00
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:
- ./emsdk/emsdk
2018-07-24 15:27:58 +00:00
- ~/.ccache
key: v1-emsdk-{{ checksum "emsdk/Makefile" }}-v20201203-{{ .BuildNum }}
2018-06-01 13:07:15 +00:00
2018-08-17 08:29:10 +00:00
- persist_to_workspace:
root: .
paths:
2018-08-24 14:31:28 +00:00
- ./build
- ./cpython/build/3.8.2/host
2018-08-17 08:29:10 +00:00
- store_artifacts:
path: /home/circleci/repo/build/
2020-05-08 23:46:59 +00:00
build-test-minimal:
<<: *defaults
steps:
- checkout
# this cache is generated by the main build job, we never store it here
- restore_cache:
keys:
- v1-emsdk-{{ checksum "emsdk/Makefile" }}-v20201203-
- run:
name: dependencies
command: sudo apt install -y libtinfo5
2020-05-08 23:46:59 +00:00
- run:
name: build
no_output_timeout: 1200
command: |
ccache -z
PYODIDE_PACKAGES='micropip' make
ccache -s
- run:
name: check-size
command: ls -lh build/
- run:
name: test
command: |
export PYODIDE_PACKAGES='micropip'
# only check common tests, all other are checked in the main test jobs
pytest src/tests/test_common.py -v -k firefox
2020-05-08 23:46:59 +00:00
- store_artifacts:
path: /home/circleci/repo/build/
2018-08-17 08:29:10 +00:00
test-firefox:
<<: *defaults
steps:
2018-08-24 14:31:28 +00:00
- checkout
2018-08-17 08:29:10 +00:00
- attach_workspace:
at: .
2018-06-01 13:07:15 +00:00
- run:
name: test
command: |
pytest src packages/*/test* packages/micropip/micropip/ pyodide_build -v -k firefox
2018-08-17 08:29:10 +00:00
test-chrome:
<<: *defaults
steps:
2018-08-24 14:31:28 +00:00
- checkout
2018-08-17 08:29:10 +00:00
- attach_workspace:
2018-08-24 14:31:28 +00:00
at: .
2018-08-17 08:29:10 +00:00
- run:
name: test
command: |
pytest src packages/*/test* packages/micropip/micropip/ pyodide_build -v -k chrome
2018-06-19 17:36:14 +00:00
2018-10-15 15:04:54 +00:00
test-python:
<<: *defaults
steps:
- checkout
2018-10-16 13:31:00 +00:00
- run:
name: deps
command: |
sudo pip install pytest-cov
2018-10-15 15:04:54 +00:00
- run:
name: test
command: |
pytest src pyodide_build packages/micropip/test_micropip.py -v -k 'not (chrome or firefox)' --cov=pyodide_build --cov=pyodide
2018-10-15 15:04:54 +00:00
benchmark:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: .
- run:
name: benchmark
command: |
python benchmark/benchmark.py cpython/build/3.8.2/host/bin/python3 build/benchmarks.json
2018-10-02 13:25:35 +00:00
- store_artifacts:
2018-10-04 12:05:22 +00:00
path: /home/circleci/repo/build/benchmarks.json
2019-05-31 18:39:52 +00:00
deploy-release:
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
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: Deploy to pyodide-cdn2.iodide.io
command: |
find build/ -type f -exec sh -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-s3:
2019-05-31 18:39:52 +00:00
docker:
- image: circleci/python:3.7.7
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: |
sudo apt-get update
sudo apt-get install -y groff
python3 -m pip install awscli
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 -exec sh -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:
- lint
2018-11-06 14:59:54 +00:00
- build:
requires:
- lint
2018-11-06 14:59:54 +00:00
filters:
tags:
only: /.*/
- build-test-minimal:
requires:
- lint
2018-08-17 08:29:10 +00:00
- test-chrome:
2018-06-19 17:36:14 +00:00
requires:
- build
2018-08-17 08:29:10 +00:00
- test-firefox:
requires:
- build
2018-11-06 15:53:48 +00:00
filters:
tags:
only: /.*/
2018-11-06 14:59:54 +00:00
- test-python:
filters:
tags:
only: /.*/
- benchmark:
requires:
- build
2019-05-31 18:39:52 +00:00
- deploy-release:
requires:
- test-firefox
- test-python
filters:
branches:
ignore: /.*/
tags:
only: /^\d+\.\d+\.\d+$/
- deploy-s3:
2018-08-17 08:29:10 +00:00
requires:
- test-firefox
2018-10-15 15:04:54 +00:00
- test-python
2018-06-19 17:36:14 +00:00
filters:
2018-11-06 14:20:01 +00:00
branches:
only: master