-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable running E2E tests from streamlit/streamlit (#72)
- Loading branch information
1 parent
c1b48ea
commit 6a95382
Showing
7 changed files
with
276 additions
and
110 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: 'Build component wheels' | ||
description: 'Action for building all components wheels' | ||
inputs: | ||
custom_streamlit_component_lib_file: | ||
required: false | ||
description: | | ||
Path to local Streamlit Component Library package. | ||
To generate a package, run the npm pack command in the directory with the Streamlit component library. | ||
default: '' | ||
|
||
outputs: | ||
output_directory: | ||
description: 'The directory where the built wheel packages of all the components are located' | ||
value: ${{ steps.final_step.outputs.output_directory }} | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Link develop version of streamlit-component-lib | ||
if: inputs.custom_streamlit_component_lib_file != '' | ||
working-directory: ${{ github.action_path }}/../../../ | ||
shell: bash | ||
env: | ||
STREAMLIT_COMPONENT_LIB_FILE: ${{ inputs.custom_streamlit_component_lib_file }} | ||
run: | | ||
find examples template template-reactless -name frontend -maxdepth 3 | while IFS= read -r line; do | ||
( | ||
cd "${line}"; | ||
npm install "${STREAMLIT_COMPONENT_LIB_FILE}" | ||
) | ||
done | ||
- name: Install node dependencies | ||
working-directory: ${{ github.action_path }}/../../../ | ||
shell: bash | ||
run: ./dev.py all-npm-install | ||
|
||
- name: Build frontend code | ||
working-directory: ${{ github.action_path }}/../../../ | ||
shell: bash | ||
run: ./dev.py all-npm-build | ||
|
||
- name: Build wheel packages | ||
working-directory: ${{ github.action_path }}/../../../ | ||
shell: bash | ||
run: | | ||
find examples template template-reactless -maxdepth 3 -name '__init__.py' |\ | ||
xargs -n 1 sed -i 's/_RELEASE = False/_RELEASE = True/'; | ||
./dev.py all-python-build-package | ||
- name: Set outputs | ||
working-directory: ${{ github.action_path }}/../../../ | ||
shell: bash | ||
id: final_step | ||
run: | | ||
output_dir="$(readlink -e dist)" | ||
echo "output_directory=${output_dir}" >> $GITHUB_OUTPUT |
54 changes: 54 additions & 0 deletions
54
.github/actions/pack_streamlit_component_library/action.yaml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: 'Pack Streamlit Component Library' | ||
description: 'Packing Streamlit Component Library' | ||
inputs: | ||
working_directory: | ||
required: false | ||
description: 'Directory where the streamlit/streamlit repository will be checked out' | ||
default: 'streamlit' | ||
|
||
outputs: | ||
output_file: | ||
description: 'Packed Streamlit Component Library file' | ||
value: ${{ steps.final_step.outputs.output_file }} | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Check prerequisite | ||
shell: bash | ||
run: | | ||
if ! command -v node > /dev/null | ||
then | ||
echo "Node is required to use this action" | ||
exit 1 | ||
fi | ||
- name: Checkout streamlit/streamlit | ||
uses: actions/checkout@v3 | ||
with: | ||
persist-credentials: false | ||
repository: streamlit/streamlit | ||
ref: develop | ||
path: ${{ inputs.working_directory }} | ||
|
||
- name: Install node dependencies for streamlit-component-lib | ||
working-directory: ${{ inputs.working_directory }}/component-lib/ | ||
shell: bash | ||
run: | | ||
npm install -g yarn | ||
yarn install | ||
- name: Pack streamlit-component-lib package | ||
working-directory: ${{ inputs.working_directory }}/component-lib/ | ||
shell: bash | ||
run: yarn run build && npm pack | ||
|
||
- name: Link develop version of streamlit-component-lib | ||
if: inputs.custom_streamlit_component_lib_file != '' | ||
working-directory: ${{ inputs.working_directory }}/component-lib/ | ||
id: final_step | ||
shell: bash | ||
run: | | ||
component_lib_tar_gz=$(find "./" -maxdepth 1 -name 'streamlit-component-lib-*.tgz') | ||
component_lib_tar_gz=$(readlink -e "${component_lib_tar_gz}") | ||
echo "output_file=${component_lib_tar_gz}" >> $GITHUB_OUTPUT |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: E2E tests | ||
description: Run e2e tests for templates and examples in separate docker images | ||
|
||
inputs: | ||
python_version: | ||
description: 'A Python version used to create a Docker Image' | ||
required: true | ||
default: '3.8' | ||
streamlit_version: | ||
description: 'Streamlit version to be installed in a Docker Image' | ||
required: false | ||
default: '' | ||
streamlit_wheel_file: | ||
description: 'Wheel file of a development version Streamlit to be installed in a Docker Image' | ||
required: false | ||
default: '' | ||
|
||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Build docker images | ||
run: | | ||
if [ -n "${{ env.STREAMLIT_VERSION }}" ]; then | ||
./dev.py e2e-build-images "--streamlit-version=${{ env.STREAMLIT_VERSION }}" "--python-version=${{ env.PYTHON_VERSION }}" | ||
elif [ -n "${{ env.STREAMLIT_WHEEL_FILE }}" ]; then | ||
./dev.py e2e-build-images "--streamlit-wheel-file=${{ env.STREAMLIT_WHEEL_FILE }}" "--python-version=${{ env.PYTHON_VERSION }}" | ||
else | ||
echo "One and exactly one input is required: streamlit_version, streamlit_wheel_file". | ||
exit 1 | ||
fi | ||
shell: bash | ||
working-directory: ${{ github.action_path }}/../../../ | ||
env: | ||
STREAMLIT_VERSION: ${{ inputs.streamlit_version }} | ||
STREAMLIT_WHEEL_FILE: ${{ inputs.streamlit_wheel_file }} | ||
PYTHON_VERSION: ${{ inputs.python_version }} | ||
|
||
|
||
- name: Run e2e tests | ||
run: ./dev.py e2e-run-tests "--streamlit-version=${{ env.STREAMLIT_VERSION }}" "--python-version=${{ env.PYTHON_VERSION }}" | ||
shell: bash | ||
working-directory: ${{ github.action_path }}/../../../ | ||
env: | ||
STREAMLIT_VERSION: ${{ inputs.streamlit_wheel_file == '' && inputs.streamlit_version || 'custom' }} | ||
PYTHON_VERSION: ${{ inputs.python_version }} |
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
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
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
Oops, something went wrong.