version: 2 defaults: &defaults working_directory: ~/repo docker: - image: pyodide/pyodide-env:18 environment: - EMSDK_NUM_CORES: 3 EMCC_CORES: 3 PYODIDE_JOBS: 3 jobs: lint: <<: *defaults resource_class: small steps: - checkout - run: name: lint command: make lint test-docs: <<: *defaults resource_class: small steps: - checkout - run: name: Install prerequisites command: | pip install -r docs/requirements-doc.txt - run: name: Test docs command: pytest docs/sphinx_pyodide/tests build-core: <<: *defaults steps: - checkout - restore_cache: keys: - -{{ checksum "Makefile.envs" }}-v20201205- - run: name: build emsdk no_output_timeout: 1200 command: | ccache -z make -C emsdk ccache -s - run: name: build cpython no_output_timeout: 1200 command: | ccache -z make -C cpython ccache -s - run: name: build pyodide core no_output_timeout: 1200 command: | ccache -z # The following packages are currently used in the main pyodide test suite PYODIDE_PACKAGES="micropip,pyparsing,pytz,packaging,Jinja2" make ccache -s - run: name: check-size command: ls -lh build/ - save_cache: paths: - ~/.ccache key: -{{ checksum "Makefile.envs" }}-v20201205-{{ .BuildNum }} - run: name: Clean up workspace command: | rm -rf cpython/{build,downloads} rm -rf emsdk/emsdk/binaryen - persist_to_workspace: root: . paths: - . - store_artifacts: path: /root/repo/build/ build-packages: <<: *defaults steps: - checkout - attach_workspace: at: . - restore_cache: keys: - -{{ checksum "Makefile.envs" }}-v20201205- - run: name: build packages no_output_timeout: 1800 command: | ccache -z make -C packages ccache -s - run: name: check-size command: ls -lh build/ - save_cache: paths: - ~/.ccache key: -{{ checksum "Makefile.envs" }}-v20201205-{{ .BuildNum }} - persist_to_workspace: root: . paths: - ./packages/.artifacts - ./build - store_artifacts: path: /root/repo/build/ - store_artifacts: path: /root/repo/packages/build-logs test-core-firefox: <<: *defaults steps: - attach_workspace: at: . - run: name: test command: | mkdir test-results tools/pytest_wrapper.py --junitxml=test-results/junit.xml src packages/micropip/ -v -k firefox -n 3 - store_test_results: path: test-results test-core-chrome: <<: *defaults steps: - attach_workspace: at: . - run: name: test command: | mkdir test-results tools/pytest_wrapper.py --junitxml=test-results/junit.xml src packages/micropip/ -v -k chrome - store_test_results: path: test-results test-packages-firefox: <<: *defaults steps: - attach_workspace: at: . - run: name: test command: | mkdir test-results tools/pytest_wrapper.py --junitxml=test-results/junit.xml packages/test* packages/*/test* -v -k firefox - store_test_results: path: test-results test-packages-chrome: <<: *defaults steps: - attach_workspace: at: . - run: name: test command: | mkdir test-results tools/pytest_wrapper.py --junitxml=test-results/junit.xml packages/test* packages/*/test* -v -k chrome -n 2 - store_test_results: path: test-results test-emsdk: <<: *defaults resource_class: small steps: - attach_workspace: at: . - run: name: test command: make -C emsdk test test-python: <<: *defaults resource_class: small steps: - checkout - run: name: test command: | mkdir test-results pytest --junitxml=test-results/junit.xml src pyodide-build packages/micropip/ -v -k 'not (chrome or firefox)' --cov=pyodide_build --cov=pyodide - store_test_results: path: test-results test-js-types: <<: *defaults resource_class: small steps: - attach_workspace: at: . - run: name: test command: | cd src/js npx tsd benchmark: <<: *defaults steps: - checkout - attach_workspace: at: . - run: name: benchmark command: | python benchmark/benchmark.py /usr/local/bin/python3 build/benchmarks.json - store_artifacts: path: /root/repo/build/benchmarks.json 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 docker: - image: cibuilds/github:0.13 steps: - checkout - attach_workspace: at: . - run: name: Install requirements command: | apk add --no-cache --update python3 make python3 -m pip install awscli - run: name: Deploy Github Releases command: | cp -r build /tmp/pyodide cd /tmp/ tar cjf pyodide-build-${CIRCLE_TAG}.tar.bz2 pyodide/ ghr -t "${GITHUB_TOKEN}" -u "${CIRCLE_PROJECT_USERNAME}" -r "${CIRCLE_PROJECT_REPONAME}" -c "${CIRCLE_SHA1}" -delete "${CIRCLE_TAG}" ./pyodide-build-${CIRCLE_TAG}.tar.bz2 - run: name: Set PYODIDE_BASE_URL 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 -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-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 docker: - image: cibuilds/github:0.13 steps: - checkout - attach_workspace: at: . - run: name: Install requirements 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 - run: name: Deploy to pyodide-cdn2.iodide.io 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 workflows: version: 2 build-and-deploy: jobs: - lint - test-docs - test-python - build-core - build-packages: requires: - build-core - test-core-chrome: requires: - build-core - test-core-firefox: requires: - build-core - test-packages-chrome: requires: - build-packages - test-packages-firefox: requires: - build-packages - test-emsdk: requires: - build-core - test-js-types: requires: - build-core - benchmark: requires: - build-packages - deploy-release: requires: - lint - test-python - test-core-firefox - test-packages-firefox - test-emsdk filters: branches: ignore: /.*/ tags: only: /^\d+\.\d+\.\w+$/ - deploy-dev: requires: - lint - test-python - test-core-firefox - test-packages-firefox - test-emsdk filters: branches: only: main