|
| 1 | +name: Run Streamlit Folium Tests |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + |
| 9 | +jobs: |
| 10 | + run: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + |
| 13 | + steps: |
| 14 | + - name: Checkout Folium |
| 15 | + uses: actions/checkout@v4 |
| 16 | + |
| 17 | + - name: Setup Micromamba env |
| 18 | + uses: mamba-org/setup-micromamba@v2 |
| 19 | + with: |
| 20 | + environment-name: TEST |
| 21 | + create-args: >- |
| 22 | + python=3 |
| 23 | + --file requirements.txt |
| 24 | +
|
| 25 | + - name: Checkout Streamlit Folium |
| 26 | + uses: actions/checkout@v4 |
| 27 | + with: |
| 28 | + repository: randyzwitch/streamlit-folium |
| 29 | + ref: master |
| 30 | + path: streamlit_folium # Checkout into a subdirectory |
| 31 | + |
| 32 | + - name: Build streamlit_folium javascript |
| 33 | + shell: bash -l {0} |
| 34 | + run: | |
| 35 | + cd streamlit_folium/streamlit_folium/frontend/ |
| 36 | + npm install |
| 37 | + npm run build |
| 38 | +
|
| 39 | + - name: Install streamlit-folium |
| 40 | + shell: bash -l {0} |
| 41 | + run: | |
| 42 | + cd streamlit_folium |
| 43 | + pip install -e . |
| 44 | +
|
| 45 | + - name: Install streamlit_folium dev dependencies |
| 46 | + shell: bash -l {0} |
| 47 | + run: | |
| 48 | + pip install -r streamlit_folium/tests/requirements.txt |
| 49 | +
|
| 50 | + - name: Install playwright dependencies |
| 51 | + shell: bash -l {0} |
| 52 | + run: | |
| 53 | + playwright install --with-deps |
| 54 | +
|
| 55 | + - name: Install annotate-failures-plugin |
| 56 | + run: pip install pytest-github-actions-annotate-failures |
| 57 | + |
| 58 | + - name: Install folium from source |
| 59 | + shell: bash -l {0} |
| 60 | + run: | |
| 61 | + python -m pip install -e . --no-deps --force-reinstall |
| 62 | +
|
| 63 | + - name: Test with pytest and retry flaky tests up to 3 times |
| 64 | + shell: bash -l {0} |
| 65 | + run: | |
| 66 | + cd streamlit_folium |
| 67 | + pytest tests/test_frontend.py --browser chromium -s --reruns 3 --junit-xml=test-results.xml |
| 68 | +
|
| 69 | + - name: Surface failing tests |
| 70 | + if: always() |
| 71 | + uses: pmeier/pytest-results-action@main |
| 72 | + with: |
| 73 | + path: streamlit_folium/test-results.xml |
| 74 | + fail-on-empty: false |
0 commit comments