|
6 | 6 | - "release/*"
|
7 | 7 |
|
8 | 8 | jobs:
|
9 |
| - build_and_test: |
10 |
| - name: "Build & Test" |
11 |
| - runs-on: ubuntu-latest |
| 9 | + run-playwright-tests: |
| 10 | + uses: ./.github/workflows/playwright.yml |
| 11 | + with: |
| 12 | + ref: ${{ inputs.ref }} |
12 | 13 |
|
| 14 | + release: |
| 15 | + needs: run-playwright-tests |
| 16 | + environment: release |
13 | 17 | steps:
|
14 |
| - - name: Check out repository |
15 |
| - uses: actions/checkout@v3 |
16 |
| - |
17 |
| - - name: Set up Node |
18 |
| - uses: actions/setup-node@v3 |
| 18 | + - name: Checkout Streamlit code |
| 19 | + uses: actions/checkout@v4 |
19 | 20 | with:
|
20 |
| - node-version: "18" |
21 |
| - |
22 |
| - - name: Install dependencies |
23 |
| - run: | |
24 |
| - cd streamlit_bokeh_chart/frontend |
25 |
| - npm ci |
26 |
| -
|
27 |
| - - name: Build component |
| 21 | + ref: ${{ inputs.ref }} |
| 22 | + persist-credentials: false |
| 23 | + submodules: "recursive" |
| 24 | + fetch-depth: 2 |
| 25 | + - name: Set up Python 3.12 |
| 26 | + uses: actions/setup-python@v5 |
| 27 | + with: |
| 28 | + python-version: "3.12" |
| 29 | + - name: Setup Node |
| 30 | + uses: actions/setup-node@v4 |
| 31 | + with: |
| 32 | + node-version-file: ".nvmrc" |
| 33 | + cache: "npm" |
| 34 | + cache-dependency-path: "**/package-lock.json" |
| 35 | + - name: Make frontend |
28 | 36 | run: |
|
29 |
| - cd streamlit_bokeh_chart/frontend |
| 37 | + cd streamlit_bokeh/frontend |
| 38 | + npm install |
30 | 39 | npm run build
|
31 |
| -
|
32 |
| - - name: Install Playwright |
33 |
| - # If your project doesn't already install Playwright as a devDependency, do so here: |
34 |
| - run: npm install -D @playwright/test |
35 |
| - |
36 |
| - - name: Run Playwright E2E tests |
37 |
| - run: npx playwright test e2e_playwright |
38 |
| - # ^ Adjust path or script as needed: |
39 |
| - # Example: `npm run test:e2e` if you have it defined in package.json |
40 |
| - |
41 |
| - release: |
42 |
| - name: "Create a Release" |
43 |
| - runs-on: ubuntu-latest |
44 |
| - needs: build_and_test # Only run if build_and_test succeeds |
45 |
| - |
46 |
| - steps: |
47 |
| - - name: Check out repository |
48 |
| - uses: actions/checkout@v3 |
49 |
| - |
50 |
| - - name: Create GitHub Release |
51 |
| - id: create_release |
52 |
| - uses: actions/create-release@v1 |
53 |
| - env: |
54 |
| - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 40 | + # Combine hashes of the Python interpreter, Pipfile, and today's |
| 41 | + # date into a file whose hash will key the Python virtualenv. |
| 42 | + # |
| 43 | + # This means that our virtualenv cache will expire each day. We do |
| 44 | + # this because we are not using a lockfile to pin dependencies - |
| 45 | + # instead, each time Github Actions rebuilds the virtualenv, it uses the |
| 46 | + # latest compatible version of each dependency (which mirrors what |
| 47 | + # happens when a user installs Streamlit locally). So we expire our |
| 48 | + # virtualenv cache daily to prevent it from getting far out of sync |
| 49 | + # with what a fresh Streamlit installation would look like. |
| 50 | + - name: Create Python environment cache key |
| 51 | + run: | |
| 52 | + md5sum $(which python) > $GITHUB_WORKSPACE/python_cache_key.md5 |
| 53 | + md5sum e2e_playwright/test-requirements.txt >> $GITHUB_WORKSPACE/python_cache_key.md5 |
| 54 | + md5sum setup.py >> $GITHUB_WORKSPACE/python_cache_key.md5 |
| 55 | + date +%F >> $GITHUB_WORKSPACE/python_cache_key.md5 |
| 56 | + shell: bash |
| 57 | + - name: Restore virtualenv from cache |
| 58 | + id: cache-virtualenv |
| 59 | + uses: actions/cache@v4 |
| 60 | + with: |
| 61 | + path: venv |
| 62 | + key: v1-python-venv-${{ hashFiles('**/python_cache_key.md5') }} |
| 63 | + - name: Build the package |
| 64 | + run: | |
| 65 | + python -m venv venv |
| 66 | + source venv/bin/activate |
| 67 | + pip install setuptools |
| 68 | + python setup.py sdist bdist_wheel |
| 69 | + - name: Store Package |
| 70 | + uses: actions/upload-artifact@v4 |
| 71 | + with: |
| 72 | + name: Release |
| 73 | + path: dist |
| 74 | + - name: Upload to PyPI |
| 75 | + uses: pypa/gh-action-pypi-publish@release/v1 |
55 | 76 | with:
|
56 |
| - tag_name: ${{ github.ref_name }} # For example "release/1.2.3" |
57 |
| - release_name: "Release ${{ github.ref_name }}" |
58 |
| - draft: false |
59 |
| - prerelease: false |
| 77 | + packages-dir: dist/ |
| 78 | + - name: Merge to Main |
| 79 | + if: ${{ success() }} |
| 80 | + steps: | |
| 81 | + git checkout main |
| 82 | + git merge ${{ inputs.ref }} |
| 83 | + git push origin main |
0 commit comments