Use Parquet to bypass Arrow #1592
Workflow file for this run
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 GitHub Pages | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
concurrency: | |
# https://stackoverflow.com/a/72408109 | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
env: | |
GITHUB_PAGES_SUBDIR_MOUNTABLE: lib/mountable | |
USE_CONSTRAINT_FILE: false # https://github.com/streamlit/streamlit/blob/1.23.1/.github/workflows/release.yml#L61-L62 | |
jobs: | |
build: | |
strategy: | |
matrix: | |
target: ["mountable"] | |
env: | |
python-version: "3.11.2" | |
# To avoid an error like "FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory". | |
# See https://github.com/actions/virtual-environments/issues/70#issuecomment-653886422 | |
# The Linux VM has 7GB RAM (https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources), | |
# so we set the max memory size as 6.5 GiB like https://nodejs.org/api/cli.html#--max-old-space-sizesize-in-megabytes | |
NODE_OPTIONS: "--max-old-space-size=6656" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
## Set up Python and Poetry environment | |
- name: Set up Python ${{ env.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.python-version }} | |
# The following steps are based on https://github.com/python-poetry/poetry/blob/def1ee8f3ae00c307ca028da53d2347615c5c32b/.github/workflows/main.yml#L51-L84 | |
- name: Get full Python version | |
id: full-python-version | |
run: echo version=$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))") >> $GITHUB_OUTPUT | |
- name: Bootstrap poetry | |
run: | | |
curl -sL https://install.python-poetry.org | python - -y | |
- name: Update PATH | |
run: echo "$HOME/.local/bin" >> $GITHUB_PATH | |
- name: Configure poetry | |
run: poetry config virtualenvs.in-project true | |
- name: Set up cache | |
uses: actions/cache@v3 | |
id: cache | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}-${{ hashFiles('requirements*.txt') }} | |
- name: Ensure cache is healthy | |
if: steps.cache.outputs.cache-hit == 'true' | |
run: timeout 10s pip --version || rm -rf .venv | |
## Set up Node environment | |
- uses: actions/setup-node@v3 | |
with: | |
node-version-file: .nvmrc | |
cache: 'yarn' | |
# We require protoc >= 3.20, but Ubuntu 22.04 - the OS that these Github | |
# Actions are running as of 2023.05.03 - doesn't have recent versions | |
# of protoc in its package repository. | |
# Ref: https://github.com/streamlit/streamlit/blob/1.23.1/.github/actions/make_init/action.yml#L47-L56 | |
# So we download the precompiled binary from the release page and install it, | |
# following https://grpc.io/docs/protoc-installation/#install-pre-compiled-binaries-any-os | |
- name: Install protoc | |
run: | | |
curl -LO $PB_REL/download/v3.20.3/protoc-3.20.3-linux-x86_64.zip | |
unzip protoc-3.20.3-linux-x86_64.zip -d $HOME/.local | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
env: | |
PB_REL: "https://github.com/protocolbuffers/protobuf/releases" | |
- name: Set up | |
run: make init | |
## Build and deploy @stlite/mountable | |
# PUBLIC_URL here is set as a relative path, which is possible to the trick introduced at https://github.com/whitphx/stlite/pull/143. | |
- if: matrix.target == 'mountable' | |
name: Set PUBLIC_URL | |
run: echo "PUBLIC_URL=." >> $GITHUB_ENV | |
- if: matrix.target == 'mountable' | |
name: Build @stlite/mountable | |
run: make mountable | |
- if: matrix.target == 'mountable' | |
name: Upload the built files as an artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: stlite-mountable | |
path: packages/mountable/build | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
# Settings for GitHub pages deployment, ref: https://github.com/peaceiris/actions-gh-pages#getting-started | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: stlite-mountable | |
path: mountable | |
- name: Configure redirect | |
run: | | |
mkdir -p /tmp/website/ | |
cat << _EOT_ > /tmp/website/_config.yml | |
plugins: | |
- jekyll-redirect-from | |
_EOT_ | |
cat << _EOT_ > /tmp/website/index.html | |
--- | |
redirect_to: "https://edit.share.stlite.net/" | |
--- | |
_EOT_ | |
cp /tmp/website/index.html /tmp/website/404.html | |
- name: Set the build artifact paths | |
run: | | |
mkdir -p /tmp/website/${GITHUB_PAGES_SUBDIR_MOUNTABLE} | |
cp -r ./mountable/* /tmp/website/${GITHUB_PAGES_SUBDIR_MOUNTABLE}/. | |
- name: Upload the website files as an artifact | |
uses: actions/upload-artifact@v3 | |
if: ${{ github.ref != 'refs/heads/main' }} | |
with: | |
name: website | |
path: /tmp/website | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
if: ${{ github.ref == 'refs/heads/main' }} | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: /tmp/website | |
enable_jekyll: true |