forked from streamlit/streamlit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Github workflow to produce Cypress snapshots
Merge pull request streamlit#6006 from sfc-gh-tteixeira/snapshots
- Loading branch information
Showing
1 changed file
with
82 additions
and
0 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,82 @@ | ||
name: Cypress update snapshots | ||
|
||
on: | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
inputs: | ||
testname: | ||
description: "Enter the test name to run (see e2e/specs/[testname].spec.js). For example: st_alert" | ||
default: "st_alert" | ||
type: "string" | ||
required: true | ||
|
||
# Avoid duplicate workflows on same branch | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.inputs.testname }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
defaults: | ||
run: | ||
shell: bash --login -eo pipefail {0} | ||
|
||
steps: | ||
- name: Checkout Streamlit code | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.ref_name }} | ||
persist-credentials: false | ||
submodules: 'recursive' | ||
- name: Set Python version vars | ||
uses: ./.github/actions/set_python_versions | ||
- name: Set up Python ${{ env.PYTHON_MAX_VERSION }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "${{ env.PYTHON_MAX_VERSION }}" | ||
- name: Setup virtual env | ||
uses: ./.github/actions/make_init | ||
- name: Install Cypress dependencies | ||
run: | | ||
sudo apt install -y xvfb libgtk2.0-0 libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 curl | ||
- name: Run make develop | ||
run: make develop | ||
- name: Register Streamlit User & Mapbox Token | ||
run: | | ||
if [ ! -d $HOME/.streamlit ] ; then | ||
mkdir $HOME/.streamlit | ||
fi | ||
echo '[mapbox]' > ~/.streamlit/config.toml | ||
MAPBOX_TOKEN=$(curl -sS https://data.streamlit.io/tokens.json | jq -r '.["mapbox-localhost"]') \ | ||
&& echo 'token = "'$MAPBOX_TOKEN'"' >> ~/.streamlit/config.toml | ||
echo '[general]' > ~/.streamlit/credentials.toml | ||
echo 'email = "test@streamlit.io"' >> ~/.streamlit/credentials.toml | ||
- name: Run Cypress test | ||
run: | | ||
scripts/run_e2e_tests.py -u "e2e/specs/${{ inputs.testname }}.spec.js" | ||
- name: Check that all screenshots have been committed | ||
run: | | ||
set -x; | ||
UNTRACKED_FILE_COUNT=$(git ls-files --others --exclude-standard | grep cypress | wc -l | bc -l || echo '0') | ||
echo "Untracked files count: ${UNTRACKED_FILE_COUNT}" | ||
if [[ "${UNTRACKED_FILE_COUNT}" -gt 0 ]]; then | ||
echo "Untracked files:"; | ||
git ls-files --others --exclude-standard | grep cypress; | ||
exit 1; | ||
fi | ||
- name: Store Snapshots | ||
uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: cypress_snapshots | ||
path: frontend/cypress/snapshots/linux/2x/${{ inputs.testname }}.spec.js | ||
- name: Store Videos | ||
uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: cypress_videos | ||
path: frontend/cypress/videos |