Try cleaning up after us more #69
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: 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/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.FCBENCH_SSH_TOKEN }} | |
- name: Build Pyodide | |
run: | | |
cd pyodide | |
git apply --whitespace=nowarn ../patches/pyodide.patch | |
cp -r ../fcpy packages/fcpy/fcpy | |
git clone [email protected]:juntyr/field-compression-benchmark.git packages/field-compression-benchmark/field-compression-benchmark | |
PYODIDE_DOCKER_IMAGE=$(docker build . -q) ./run_docker --non-interactive PYODIDE_PACKAGES="basemap,fcpy,field-compression-benchmark,ipyfilite,ipyloglite,pyodide-http,ipython" make | |
git apply --whitespace=nowarn --reverse ../patches/pyodide.patch | |
rm -rf packages/fcpy/fcpy | |
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: | | |
jupyter lite build --output-dir dist | |
cp ./_headers dist/ | |
cp -r data dist/ | |
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 |