| 1 |
name: check |
| 2 |
on: |
| 3 |
workflow_dispatch: |
| 4 |
push: |
| 5 |
branches: "main" |
| 6 |
pull_request: |
| 7 |
schedule: |
| 8 |
- cron: "0 8 * * *" |
| 9 |
|
| 10 |
defaults: |
| 11 |
run: |
| 12 |
shell: bash -l {0} |
| 13 |
|
| 14 |
concurrency: |
| 15 |
group: check-${{ github.ref }} |
| 16 |
cancel-in-progress: true |
| 17 |
|
| 18 |
jobs: |
| 19 |
lint: |
| 20 |
runs-on: ubuntu-latest |
| 21 |
steps: |
| 22 |
- uses: actions/checkout@v4 |
| 23 |
- uses: actions/setup-python@v5 |
| 24 |
with: |
| 25 |
python-version: '3.12' |
| 26 |
- uses: pre-commit/[email protected] |
| 27 |
|
| 28 |
test: |
| 29 |
name: test on ${{ matrix.py }} |
| 30 |
runs-on: ubuntu-latest |
| 31 |
strategy: |
| 32 |
fail-fast: false |
| 33 |
matrix: |
| 34 |
py: |
| 35 |
- '3.12' |
| 36 |
- '3.11' |
| 37 |
- '3.10' |
| 38 |
- '3.9' |
| 39 |
- pypy3.9 |
| 40 |
steps: |
| 41 |
- uses: actions/checkout@v4 |
| 42 |
- name: setup python for tox |
| 43 |
uses: actions/setup-python@v5 |
| 44 |
with: |
| 45 |
python-version: '3.12' |
| 46 |
- name: install tox |
| 47 |
run: python -m pip install tox |
| 48 |
- name: setup python for test ${{ matrix.py }} |
| 49 |
uses: actions/setup-python@v5 |
| 50 |
with: |
| 51 |
python-version: ${{ matrix.py }} |
| 52 |
- name: Pick environment to run |
| 53 |
run: | |
| 54 |
import platform; import os; import sys; import codecs |
| 55 |
cpy = platform.python_implementation() == "CPython" |
| 56 |
base =("{}{}{}" if cpy else "{}{}").format("py" if cpy else "pypy", *sys.version_info[0:2]) |
| 57 |
env = "TOXENV={}\n".format(base) |
| 58 |
print("Picked:\n{}for{}".format(env, sys.version)) |
| 59 |
with codecs.open(os.environ["GITHUB_ENV"], "a", "utf-8") as file_handler: |
| 60 |
file_handler.write(env) |
| 61 |
shell: python |
| 62 |
- name: setup test suite for ${{ matrix.py }} |
| 63 |
run: tox -vv --notest |
| 64 |
- name: run test suite for ${{ matrix.py }} |
| 65 |
run: tox --skip-pkg-install |
| 66 |
|
| 67 |
check: |
| 68 |
name: check ${{ matrix.tox_env }} |
| 69 |
runs-on: ubuntu-latest |
| 70 |
strategy: |
| 71 |
fail-fast: false |
| 72 |
matrix: |
| 73 |
tox_env: |
| 74 |
- pkg_desc |
| 75 |
- dev |
| 76 |
steps: |
| 77 |
- uses: actions/checkout@v4 |
| 78 |
- name: setup Python 3.12 |
| 79 |
uses: actions/setup-python@v5 |
| 80 |
with: |
| 81 |
python-version: '3.12' |
| 82 |
- name: install tox |
| 83 |
run: python -m pip install tox |
| 84 |
- name: run check for ${{ matrix.tox_env }} |
| 85 |
run: python -m tox -e ${{ matrix.tox_env }} |
| 86 |
|
| 87 |
publish: |
| 88 |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') |
| 89 |
needs: [check, test, lint] |
| 90 |
runs-on: ubuntu-latest |
| 91 |
steps: |
| 92 |
- name: setup python to build package |
| 93 |
uses: actions/setup-python@v5 |
| 94 |
with: |
| 95 |
python-version: '3.12' |
| 96 |
- name: install build |
| 97 |
run: python -m pip install build |
| 98 |
- uses: actions/checkout@v4 |
| 99 |
- name: build package |
| 100 |
run: python -m build --sdist --wheel . -o dist |
| 101 |
- name: publish to PyPi |
| 102 |
uses: pypa/gh-action-pypi-publish@master |
| 103 |
with: |
| 104 |
skip_existing: true |
| 105 |
user: __token__ |
| 106 |
password: ${{ secrets.pypi_password }} |
| 107 |
|
| 108 |
build: |
| 109 |
runs-on: ubuntu-latest |
| 110 |
steps: |
| 111 |
- name: setup python to build package |
| 112 |
uses: actions/setup-python@v5 |
| 113 |
with: |
| 114 |
python-version: '3.12' |
| 115 |
- name: install build |
| 116 |
run: python -m pip install build |
| 117 |
- uses: actions/checkout@v4 |
| 118 |
- name: build package |
| 119 |
run: python -m build --sdist --wheel . -o dist |
| 120 |
- name: Upload builds |
| 121 |
uses: actions/upload-artifact@v3 |
| 122 |
with: |
| 123 |
name: dist ${{ github.run_number }} |
| 124 |
path: ./dist |
| 125 |
|
| 126 |
visual-regression-tests-ipw7: |
| 127 |
runs-on: ubuntu-latest |
| 128 |
needs: [build] |
| 129 |
|
| 130 |
steps: |
| 131 |
- name: Checkout |
| 132 |
uses: actions/checkout@v4 |
| 133 |
|
| 134 |
- name: Install Conda environment with Micromamba |
| 135 |
uses: mamba-org/setup-micromamba@v2 |
| 136 |
with: |
| 137 |
environment-name: ipydatagrid-test-ipw7 |
| 138 |
environment-file: test-environment-ipyw7.yaml |
| 139 |
auto-activate-base: false |
| 140 |
create-args: >- |
| 141 |
python=3.9 |
| 142 |
|
| 143 |
- uses: actions/download-artifact@v3 |
| 144 |
with: |
| 145 |
name: dist ${{ github.run_number }} |
| 146 |
path: ./dist |
| 147 |
|
| 148 |
- name: Install the package |
| 149 |
run: pip install -vv ipydatagrid*.whl |
| 150 |
working-directory: dist |
| 151 |
|
| 152 |
- name: Install Galata |
| 153 |
run: | |
| 154 |
yarn install |
| 155 |
yarn playwright install chromium |
| 156 |
working-directory: ui-tests-ipw7 |
| 157 |
|
| 158 |
- name: Launch JupyterLab |
| 159 |
run: yarn run start:detached & |
| 160 |
working-directory: ui-tests-ipw7 |
| 161 |
|
| 162 |
- name: Wait for JupyterLab |
| 163 |
uses: ifaxity/wait-on-action@v1 |
| 164 |
with: |
| 165 |
resource: http-get://localhost:8888/api |
| 166 |
timeout: 20000 |
| 167 |
|
| 168 |
- name: Run UI Tests |
| 169 |
run: yarn run test |
| 170 |
working-directory: ui-tests-ipw7 |
| 171 |
|
| 172 |
- name: Upload UI Test artifacts |
| 173 |
if: always() |
| 174 |
uses: actions/upload-artifact@v3 |
| 175 |
with: |
| 176 |
name: ui-test-output-ipw7 |
| 177 |
path: | |
| 178 |
ui-tests-ipw7/playwright-report |
| 179 |
ui-tests-ipw7/test-results |
| 180 |
|
| 181 |
visual-regression-tests-ipw8: |
| 182 |
runs-on: ubuntu-latest |
| 183 |
needs: [build] |
| 184 |
|
| 185 |
steps: |
| 186 |
- name: Checkout |
| 187 |
uses: actions/checkout@v4 |
| 188 |
|
| 189 |
- name: Install Conda environment with Micromamba |
| 190 |
uses: mamba-org/setup-micromamba@v2 |
| 191 |
with: |
| 192 |
environment-name: ipydatagrid-test-ipw8 |
| 193 |
environment-file: test-environment-ipyw8.yaml |
| 194 |
auto-activate-base: false |
| 195 |
create-args: >- |
| 196 |
python=3.9 |
| 197 |
|
| 198 |
- uses: actions/download-artifact@v3 |
| 199 |
with: |
| 200 |
name: dist ${{ github.run_number }} |
| 201 |
path: ./dist |
| 202 |
|
| 203 |
- name: Install the package |
| 204 |
run: pip install -vv ipydatagrid*.whl |
| 205 |
working-directory: dist |
| 206 |
|
| 207 |
- name: Install dependencies |
| 208 |
shell: bash -l {0} |
| 209 |
working-directory: ui-tests-ipw8 |
| 210 |
env: |
| 211 |
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 |
| 212 |
run: jlpm install |
| 213 |
|
| 214 |
- name: Install browser |
| 215 |
shell: bash -l {0} |
| 216 |
run: npx playwright install chromium |
| 217 |
working-directory: ui-tests-ipw8 |
| 218 |
|
| 219 |
- name: Execute integration tests |
| 220 |
shell: bash -l {0} |
| 221 |
working-directory: ui-tests-ipw8 |
| 222 |
run: npx playwright test |
| 223 |
|
| 224 |
- name: Upload UI Test artifacts |
| 225 |
if: always() |
| 226 |
uses: actions/upload-artifact@v3 |
| 227 |
with: |
| 228 |
name: ui-test-output-ipw8 |
| 229 |
path: | |
| 230 |
ui-tests-ipw8/playwright-report |
| 231 |
ui-tests-ipw8/test-results |