Skip to content

Ensure requests is always patched by pyodide-http #107

Ensure requests is always patched by pyodide-http

Ensure requests is always patched by pyodide-http #107

Workflow file for this run

name: Build and Deploy
on:
push:
branches:
- main
jobs:
build:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Install nix
uses: cachix/install-nix-action@v27
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install the dependencies
run: |
python -m pip install -r requirements.txt
- name: Prepare Pyodide
run: |
git submodule init pyodide
git submodule update pyodide
- name: Check the Pyodide version
run: |
echo "PYODIDE_SHA_SHORT=$(git submodule status pyodide | cut -c 2-8)" >> $GITHUB_ENV
- name: Cache the Pyodide build
uses: actions/cache@v3
with:
path: ./pyodide
key: pyodide-${{ env.PYODIDE_SHA_SHORT }}-${{ hashFiles('patches/pyodide.patch') }}
restore-keys: |
pyodide-${{ env.PYODIDE_SHA_SHORT }}-${{ hashFiles('patches/pyodide.patch') }}
pyodide-${{ env.PYODIDE_SHA_SHORT }}
- name: Add a read-only SSH key to pull private dependencies
uses: webfactory/ssh-agent@v0.8.0
with:
ssh-private-key: ${{ secrets.FCBENCH_SSH_TOKEN }}
- name: Checkout and patch pyodide
run: |
cd pyodide
git apply --whitespace=nowarn ../patches/pyodide.patch
git clone git@github.com:juntyr/field-compression-benchmark.git \
packages/field-compression-benchmark/field-compression-benchmark
cd packages/field-compression-benchmark/field-compression-benchmark
git submodule update --init wasi/wit-deps/wasi-*
git apply ../patches/0001-codecs-build.patch
- name: Pre-build the wasm codecs for fcbench
run: |
cd pyodide/packages/field-compression-benchmark/field-compression-benchmark
# Build the codecs
cargo build -p codecs-build -vv
# Clean up after the build
cargo clean
grep '^channel\s*=\s*' rust-toolchain \
| sed 's/channel.*=.*\"\(.*\)\"/\1/' \
| xargs rustup toolchain uninstall
nix store gc
- name: Build Pyodide and all required packages
run: |
cd pyodide
PYODIDE_DOCKER_IMAGE=$(docker build . -q) \
./run_docker \
--non-interactive \
PYODIDE_PACKAGES="aiohttp,basemap,cdsapi,cfgrib,cmcrameri,dask,earthkit,ecmwf-api-client,field-compression-benchmark,fsspec,git2,ipyfilite,ipython,lzma,matplotlib,MetPy,netcdf4,numcodecs,numpy,pandas,pint,proplot,requests,scipy,xarray,xeofs,zarr" \
make
- name: Clean up the pyodide build
run: |
cd pyodide
git apply --whitespace=nowarn --reverse ../patches/pyodide.patch
rm -rf packages/field-compression-benchmark/field-compression-benchmark
rm -rf .docker_home
find . -name jupyter-lite.json -delete
find . -name jupyter_lite_config.json -delete
cd ..
mkdir -p static
cp -r pyodide/dist static/pyodide
rm -rf static/pyodide/*-tests.tar
rm -f static/pyodide/tsconfig.tsbuildinfo
- name: Build the JupyterLite site
run: |
rm -f files/README.md && cp ./README.md files/
jupyter lite build --output-dir dist
cp ./_headers dist/
cp -r data dist/
cp static/favicons/favicon.ico dist/
find dist/ -name favicon.ico | xargs -L1 cp -f static/favicons/favicon.ico
rm -rf static
- name: Deploy to dist branch
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: dist
publish_dir: ./dist
force_orphan: true