|
| 1 | +name: Update Galata References |
| 2 | + |
| 3 | +on: |
| 4 | + issue_comment: |
| 5 | + types: [created, edited] |
| 6 | + |
| 7 | +permissions: |
| 8 | + contents: write |
| 9 | + pull-requests: write |
| 10 | + |
| 11 | +defaults: |
| 12 | + run: |
| 13 | + shell: bash -l {0} |
| 14 | + |
| 15 | +jobs: |
| 16 | + update-reference-screenshots: |
| 17 | + name: Update Galata References |
| 18 | + if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, 'update galata references') }} |
| 19 | + runs-on: ubuntu-latest |
| 20 | + |
| 21 | + steps: |
| 22 | + - name: Checkout |
| 23 | + uses: actions/checkout@v2 |
| 24 | + with: |
| 25 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 26 | + |
| 27 | + - name: Configure git to use https |
| 28 | + run: git config --global hub.protocol https |
| 29 | + |
| 30 | + - name: Checkout the branch from the PR that triggered the job |
| 31 | + run: hub pr checkout ${{ github.event.issue.number }} |
| 32 | + env: |
| 33 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 34 | + |
| 35 | + - name: Setup conda |
| 36 | + uses: conda-incubator/setup-miniconda@v2 |
| 37 | + with: |
| 38 | + activate-environment: ipympl-dev |
| 39 | + environment-file: dev-environment.yml |
| 40 | + python-version: 3.9 |
| 41 | + mamba-version: "*" |
| 42 | + auto-activate-base: false |
| 43 | + channels: conda-forge |
| 44 | + |
| 45 | + - name: Install ipympl |
| 46 | + run: pip install . |
| 47 | + |
| 48 | + - name: Install Galata |
| 49 | + run: | |
| 50 | + yarn install |
| 51 | + yarn playwright install chromium |
| 52 | + working-directory: ui-tests |
| 53 | + |
| 54 | + - name: Launch JupyterLab |
| 55 | + run: yarn run start:detached |
| 56 | + working-directory: ui-tests |
| 57 | + |
| 58 | + - name: Wait for JupyterLab |
| 59 | + uses: ifaxity/wait-on-action@v1 |
| 60 | + with: |
| 61 | + resource: http-get://localhost:8888/api |
| 62 | + timeout: 20000 |
| 63 | + |
| 64 | + - name: Generate updated Galata References |
| 65 | + run: yarn run test:update |
| 66 | + working-directory: ui-tests |
| 67 | + |
| 68 | + - name: Compress screenshots |
| 69 | + run: | |
| 70 | + sudo apt install optipng |
| 71 | + optipng *.png |
| 72 | + working-directory: ui-tests/tests/ipympl.test.ts-snapshots |
| 73 | + |
| 74 | + - name: Commit reference images |
| 75 | + run: | |
| 76 | + git config user.name 'github-actions[bot]' |
| 77 | + git config user.email 'github-actions[bot]@users.noreply.github.com' |
| 78 | +
|
| 79 | + git pull |
| 80 | +
|
| 81 | + git add ui-tests/tests/ipympl.test.ts-snapshots |
| 82 | +
|
| 83 | + git commit -m "Update Galata References" |
| 84 | + git push |
| 85 | + env: |
| 86 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments