|
| 1 | +name: Cypress Tests using Cypress Docker Image |
| 2 | + |
| 3 | +on: push |
| 4 | + |
| 5 | +jobs: |
| 6 | + cypress-run: |
| 7 | + runs-on: ubuntu-22.04 |
| 8 | + container: |
| 9 | + image: cypress/browsers:node-20.14.0-chrome-126.0.6478.114-1-ff-127.0.1-edge-126.0.2592.61-1 |
| 10 | + options: --user 1001 |
| 11 | + services: |
| 12 | + meilisearch: |
| 13 | + image: getmeili/meilisearch:latest |
| 14 | + env: |
| 15 | + MEILI_MASTER_KEY: 'masterKey' |
| 16 | + MEILI_NO_ANALYTICS: 'true' |
| 17 | + ports: |
| 18 | + - '7700:7700' |
| 19 | + |
| 20 | + steps: |
| 21 | + - name: Checkout |
| 22 | + uses: actions/checkout@v4 |
| 23 | + - name: Setup node |
| 24 | + uses: actions/setup-node@v3 |
| 25 | + with: |
| 26 | + node-version: '20.x' |
| 27 | + cache: yarn |
| 28 | + - name: Cache dependencies |
| 29 | + uses: actions/cache@v3 |
| 30 | + with: |
| 31 | + path: | |
| 32 | + ./playground/node_modules |
| 33 | + key: ${{ hashFiles('playground/yarn.lock') }} |
| 34 | + - name: Install dependencies |
| 35 | + run: yarn --dev && yarn --cwd ./playground |
| 36 | + - name: Remove plugin symlink |
| 37 | + run: rm ./playground/src/plugins/meilisearch |
| 38 | + - name: Move plugin inside playground |
| 39 | + # Since the plugin is located at the root of the project but a symlink links |
| 40 | + # to it in ./playground/plugins/meilisearch it causes a circular |
| 41 | + # chaining problem. |
| 42 | + # Now that we removed the symlink (see previous step), we need to move our plugin in the |
| 43 | + # plugin directory of the playground. |
| 44 | + run: mkdir ./playground/src/plugins/meilisearch && |
| 45 | + mv admin ./playground/src/plugins/meilisearch && |
| 46 | + mv server ./playground/src/plugins/meilisearch && |
| 47 | + mv strapi-admin.js ./playground/src/plugins/meilisearch && |
| 48 | + mv strapi-server.js ./playground/src/plugins/meilisearch && |
| 49 | + cp package.json ./playground/src/plugins/meilisearch |
| 50 | + |
| 51 | + - name: Run e2e browser tests |
| 52 | + uses: cypress-io/github-action@v6 |
| 53 | + with: |
| 54 | + build: yarn playground:build |
| 55 | + start: yarn playground:dev |
| 56 | + env: env=ci |
| 57 | + browser: chrome |
| 58 | + |
| 59 | + - uses: actions/upload-artifact@v3 |
| 60 | + if: failure() |
| 61 | + with: |
| 62 | + name: cypress-screenshots |
| 63 | + path: cypress/screenshots |
| 64 | + - uses: actions/upload-artifact@v3 |
| 65 | + if: failure() |
| 66 | + with: |
| 67 | + name: cypress-videos |
| 68 | + path: cypress/videos |
0 commit comments