Skip to content

Commit f22945a

Browse files
authored
Merge pull request #1246 from mito-ds/main-pr-tests
Release
2 parents fd9f98d + 8f30c64 commit f22945a

File tree

168 files changed

+4289
-893
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

168 files changed

+4289
-893
lines changed
+164
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
name: Pre-release tests
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
test-jupyterlab-demos:
10+
runs-on: ubuntu-20.04
11+
timeout-minutes: 60
12+
strategy:
13+
matrix:
14+
python-version: ['3.7', '3.8', '3.10']
15+
fail-fast: false
16+
17+
steps:
18+
- name: Cancel Previous Runs
19+
uses: styfle/cancel-workflow-action@0.7.0
20+
with:
21+
access_token: ${{ github.token }}
22+
- uses: actions/checkout@v2
23+
- name: Set up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@v2
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
cache: pip
28+
cache-dependency-path: |
29+
mitosheet/setup.py
30+
tests/requirements.txt
31+
- uses: actions/setup-node@v3
32+
with:
33+
node-version: 16
34+
cache: 'npm'
35+
cache-dependency-path: mitosheet/package-lock.json
36+
- name: Install dependencies
37+
run: |
38+
cd tests
39+
python3 -m venv venv
40+
source venv/bin/activate
41+
pip install mitosheet
42+
pip install --upgrade -i https://test.pypi.org/simple/ mitosheet
43+
# Install necessary node packages
44+
npm install
45+
npx playwright install chromium webkit firefox chrome
46+
47+
- name: Start a server and run tests
48+
run: |
49+
cd tests
50+
source venv/bin/activate
51+
jupyter lab --config jupyter_server_test_config.py &
52+
npm run test:jupyterlab
53+
- name: Upload test-results
54+
uses: actions/upload-artifact@v3
55+
if: failure()
56+
with:
57+
name: jupyterlab-playwright-report-${{ matrix.python-version }}
58+
path: tests/playwright-report/
59+
retention-days: 14
60+
61+
test-streamlit-demos:
62+
timeout-minutes: 60
63+
strategy:
64+
matrix:
65+
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
66+
python-version: ['3.10']
67+
demo: ['vanguard-fund-performance']
68+
project: ['chromium', 'firefox', 'webkit', 'Google Chrome', 'Microsoft Edge']
69+
exclude:
70+
- os: 'windows-latest'
71+
project: webkit
72+
- os: 'macos-latest'
73+
project: 'Microsoft Edge'
74+
- os: 'ubuntu-latest'
75+
project: 'Microsoft Edge'
76+
- os: 'ubuntu-latest'
77+
project: 'webkit'
78+
fail-fast: false
79+
runs-on: ${{ matrix.os }}
80+
81+
steps:
82+
- uses: actions/checkout@v2
83+
- name: Set up Python ${{ matrix.python-version }}
84+
uses: actions/setup-python@v2
85+
with:
86+
python-version: ${{ matrix.python-version }}
87+
cache: pip
88+
cache-dependency-path: |
89+
mitosheet/setup.py
90+
tests/requirements.txt
91+
tests/extra-requirements.txt
92+
- uses: actions/setup-node@v3
93+
with:
94+
node-version: 16
95+
cache: 'npm'
96+
cache-dependency-path: mitosheet/package-lock.json
97+
- name: Install dependencies (ubuntu, macos)
98+
if: matrix.os != 'windows-latest'
99+
run: |
100+
cd tests
101+
python3 -m venv venv
102+
source venv/bin/activate
103+
pip install mitosheet streamlit
104+
pip install --upgrade -i https://test.pypi.org/simple/ mitosheet
105+
# Install necessary node packages
106+
npm install
107+
npx playwright install chromium webkit firefox chrome
108+
- name: Setup streamlit (ubuntu, macos)
109+
if: matrix.os != 'windows-latest'
110+
run: |
111+
mkdir -p ~/.streamlit/
112+
echo "[general]" > ~/.streamlit/credentials.toml
113+
echo "email = \"\"" >> ~/.streamlit/credentials.toml
114+
- name: Setup streamlit (windows)
115+
if: matrix.os == 'windows-latest'
116+
run: |
117+
$streamlitDir = "$HOME\.streamlit"
118+
if (-not (Test-Path -Path $streamlitDir)) {
119+
New-Item -ItemType Directory -Path $streamlitDir
120+
}
121+
Set-Content -Path "$streamlitDir\credentials.toml" -Value @"
122+
[general]
123+
email = ""
124+
"@
125+
- name: Install dependencies (windows)
126+
if: matrix.os == 'windows-latest'
127+
run: |
128+
cd tests
129+
python3 -m venv venv
130+
.\venv\Scripts\Activate.ps1
131+
pip install mitosheet streamlit
132+
pip install --upgrade -i https://test.pypi.org/simple/ mitosheet
133+
# Install necessary node packages
134+
npm install
135+
npx playwright install chromium webkit firefox chrome
136+
- name: Start a server and run tests (ubuntu, macos)
137+
if: matrix.os != 'windows-latest'
138+
run: |
139+
cd tests
140+
source venv/bin/activate
141+
git clone https://github.com/mito-ds/every-feature-everywhere-all-at-once.git
142+
cd every-feature-everywhere-all-at-once
143+
streamlit run automation-app.py --server.port 8555 &
144+
bash ../check_server.sh
145+
npm run test:streamlit:demo -- --project="${{ matrix.project }}"
146+
- name: Start a server and run tests (windows)
147+
if: matrix.os == 'windows-latest'
148+
run: |
149+
cd tests
150+
.\venv\Scripts\Activate.ps1
151+
152+
git clone https://github.com/mito-ds/every-feature-everywhere-all-at-once.git
153+
cd every-feature-everywhere-all-at-once
154+
Start-Job { streamlit run automation-app.py --server.port 8555 } -WorkingDirectory (Get-Location)
155+
npm run test:streamlit:demo -- --project="${{ matrix.project }}"
156+
- name: Upload test-results
157+
uses: actions/upload-artifact@v3
158+
if: always()
159+
with:
160+
name: streamlit-playwright-report
161+
path: tests/playwright-report/
162+
retention-days: 14
163+
164+

.github/workflows/test-mitosheet-frontend.yml

+87-15
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ on:
1111
- 'tests/**'
1212

1313
jobs:
14-
test-mitosheet-frontend:
14+
test-mitosheet-frontend-jupyterlab:
1515
runs-on: ubuntu-20.04
1616
timeout-minutes: 60
1717
strategy:
1818
matrix:
19-
python-version: ['3.6', '3.8', '3.10']
19+
python-version: ['3.7', '3.8', '3.10']
20+
fail-fast: false
2021

2122
steps:
2223
- name: Cancel Previous Runs
@@ -55,9 +56,62 @@ jobs:
5556
npm run test:jupyterlab
5657
- name: Upload test-results
5758
uses: actions/upload-artifact@v3
58-
if: always()
59+
if: failure()
5960
with:
60-
name: jupyterlab-playwright-report
61+
name: jupyterlab-playwright-report-${{ matrix.python-version }}
62+
path: tests/playwright-report/
63+
retention-days: 14
64+
65+
test-mitosheet-frontend-jupyternotebook:
66+
runs-on: ubuntu-20.04
67+
timeout-minutes: 60
68+
strategy:
69+
matrix:
70+
# Usually we'd test python 3.6 but there is an error showing up in the tests
71+
# that we're not sure about. See https://github.com/mito-ds/mito/pull/1213
72+
python-version: ['3.8', '3.10']
73+
fail-fast: false
74+
75+
steps:
76+
- name: Cancel Previous Runs
77+
uses: styfle/cancel-workflow-action@0.7.0
78+
with:
79+
access_token: ${{ github.token }}
80+
- uses: actions/checkout@v2
81+
- name: Set up Python ${{ matrix.python-version }}
82+
uses: actions/setup-python@v2
83+
with:
84+
python-version: ${{ matrix.python-version }}
85+
cache: pip
86+
cache-dependency-path: |
87+
mitosheet/setup.py
88+
tests/requirements.txt
89+
- uses: actions/setup-node@v3
90+
with:
91+
node-version: 16
92+
cache: 'npm'
93+
cache-dependency-path: mitosheet/package-lock.json
94+
- name: Install dependencies
95+
run: |
96+
cd tests
97+
bash mac-setup.sh
98+
- name: Setup Jupyter notebook
99+
run: |
100+
cd tests
101+
source venv/bin/activate
102+
cd ../mitosheet
103+
jupyter labextension develop . --overwrite
104+
- name: Start a server and run tests
105+
run: |
106+
cd tests
107+
source venv/bin/activate
108+
jupyter notebook --config jupyter_notebook_config.py &
109+
npm run test:notebook
110+
- name: Upload test-results
111+
uses: actions/upload-artifact@v3
112+
if: failure()
113+
with:
114+
name: jupyternotebook-playwright-report-${{ matrix.python-version }}
61115
path: tests/playwright-report/
62116
retention-days: 14
63117

@@ -67,17 +121,34 @@ jobs:
67121
matrix:
68122
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
69123
python-version: ['3.10']
70-
project: ['chromium', 'firefox', 'webkit', 'Google Chrome', 'Microsoft Edge']
124+
project:
125+
- test-name: 'chromium'
126+
install-name: 'chromium'
127+
- test-name: 'firefox'
128+
install-name: 'firefox'
129+
- test-name: 'webkit'
130+
install-name: 'webkit'
131+
- test-name: 'Google Chrome'
132+
install-name: 'chrome'
133+
- test-name: 'Microsoft Edge'
134+
install-name: 'msedge'
135+
testfiles: ['taskpanes', 'grid', 'toolbar', 'graph']
71136
exclude:
72137
- os: 'windows-latest'
73-
project: webkit
138+
project:
139+
test-name: webkit
74140
- os: 'macos-latest'
75-
project: 'Microsoft Edge'
141+
project:
142+
test-name: 'Microsoft Edge'
76143
- os: 'ubuntu-latest'
77-
project: 'Microsoft Edge'
144+
project:
145+
test-name: 'Microsoft Edge'
78146
- os: 'ubuntu-latest'
79-
project: 'webkit'
147+
project:
148+
test-name: 'webkit'
149+
fail-fast: false
80150
runs-on: ${{ matrix.os }}
151+
name: Test ${{ matrix.testfiles }} on ${{ matrix.os }} ${{ matrix.project.test-name }}
81152

82153
steps:
83154
- uses: actions/checkout@v2
@@ -99,7 +170,7 @@ jobs:
99170
if: matrix.os != 'windows-latest'
100171
run: |
101172
cd tests
102-
bash mac-setup.sh
173+
bash mac-setup.sh ${{ matrix.project.install-name }}
103174
source venv/bin/activate
104175
pip install -r extra-requirements.txt
105176
- name: Setup streamlit (ubuntu, macos)
@@ -131,7 +202,7 @@ jobs:
131202
pip install -r extra-requirements.txt
132203
133204
npm install
134-
npx playwright install chromium firefox chrome msedge
205+
npx playwright install ${{matrix.project.install-name}}
135206
136207
cd ../mitosheet
137208
pip install -e ".[test]"
@@ -145,19 +216,19 @@ jobs:
145216
source venv/bin/activate
146217
streamlit run streamlit_test.py --server.port 8555 &
147218
bash check_server.sh
148-
npm run test:streamlit -- --project="${{ matrix.project }}"
219+
npm run test -- --project="${{ matrix.project.test-name }}" streamlit_ui_tests/${{matrix.testfiles}}
149220
- name: Start a server and run tests (windows)
150221
if: matrix.os == 'windows-latest'
151222
run: |
152223
cd tests
153224
.\venv\Scripts\Activate.ps1
154225
Start-Job { streamlit run streamlit_test.py --server.port 8555 } -WorkingDirectory (Get-Location)
155-
npm run test:streamlit -- --project="${{ matrix.project }}"
226+
npm run test -- --project="${{ matrix.project.test-name }}" streamlit_ui_tests/${{matrix.testfiles}}
156227
- name: Upload test-results
157228
uses: actions/upload-artifact@v3
158-
if: always()
229+
if: failure()
159230
with:
160-
name: streamlit-playwright-report
231+
name: test-results-${{matrix.testfiles}}-${{ matrix.os }}-python${{ matrix.python-version }}-${{ matrix.project.test-name }}
161232
path: tests/playwright-report/
162233
retention-days: 14
163234

@@ -167,6 +238,7 @@ jobs:
167238
strategy:
168239
matrix:
169240
python-version: ['3.10']
241+
fail-fast: false
170242

171243
steps:
172244
- name: Cancel Previous Runs

mitosheet/css/FormulaBar.css

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
outline: none;
2222

2323
color: var(--mito-text);
24+
height: 30px;
25+
display: flex;
26+
justify-content: center;
27+
flex-direction: column;
2428
}
2529

2630
.formula-bar-vertical-line {

mitosheet/css/mito.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
}
6262

6363
.mito-container {
64-
height: 538px;
64+
height: var(--mito-height, 538px); /* Default height */
6565
display: flex;
6666
flex-direction: column;
6767

mitosheet/mitosheet/__main__.py

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
line interface allows you to set some toggles in the user.json
1010
"""
1111
import sys
12+
from mitosheet.hello import run_hello
1213
from mitosheet.experiments.experiment_utils import set_experiment
1314

1415
from mitosheet.user.db import set_user_field
@@ -36,6 +37,8 @@ def main() -> None:
3637

3738
# Then, if we are being told to turn off logging, turn off logging
3839
if len(sys.argv) > 1:
40+
if sys.argv[-1] == 'hello':
41+
run_hello()
3942
if sys.argv[-1] == 'turnofflogging':
4043
print("Turning off all logging")
4144
set_user_field(UJ_MITOSHEET_TELEMETRY, False)

mitosheet/mitosheet/ai/recon.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,20 @@ def exec_for_recon(code: str, original_df_map: Dict[str, pd.DataFrame]) -> Dataf
8181
for df_name in potentially_modified_df_names:
8282
locals()[df_name] = df_map[df_name]
8383

84+
# If there are lambda expressions in the code, then we need to also
85+
# inject the pandas and numpy modules in as globals -- as for some
86+
# reason the code inside of a lambda doesn't have access to them
87+
globals = {}
88+
if 'lambda' in code:
89+
globals['pd'] = pd
90+
globals['np'] = np
91+
8492
# Capture the output as well
8593
output_string_io = StringIO()
8694

8795
try:
8896
with redirect_stdout(output_string_io):
89-
exec(code, {}, locals())
97+
exec(code, globals, locals())
9098
except Exception as e:
9199
raise make_exec_error(e)
92100

0 commit comments

Comments
 (0)