|
| 1 | +name: ci |
| 2 | +on: [push] |
| 3 | +jobs: |
| 4 | + e2e: |
| 5 | + runs-on: ubuntu-20.04 |
| 6 | + steps: |
| 7 | + - name: Checkout 🛎 |
| 8 | + uses: actions/checkout@v2 |
| 9 | + |
| 10 | + - name: Install and run Cypress tests 🌲 |
| 11 | + uses: cypress-io/github-action@v2 |
| 12 | + |
| 13 | + unit: |
| 14 | + runs-on: ubuntu-20.04 |
| 15 | + steps: |
| 16 | + - name: Checkout 🛎 |
| 17 | + uses: actions/checkout@v2 |
| 18 | + |
| 19 | + # we are only interested in installing and caching dependencies, |
| 20 | + # without installing the Cypress binary |
| 21 | + - name: Install NPM dependencies 📦 |
| 22 | + uses: bahmutov/npm-install@v1 |
| 23 | + env: |
| 24 | + # we do not need to install Cypress itself |
| 25 | + # as we do not plan to run tests |
| 26 | + CYPRESS_INSTALL_BINARY: 0 |
| 27 | + |
| 28 | + - name: Run Jest tests 🧪 |
| 29 | + run: npm test |
| 30 | + |
| 31 | + unit-using-cypress-gh-action: |
| 32 | + runs-on: ubuntu-20.04 |
| 33 | + steps: |
| 34 | + - name: Checkout 🛎 |
| 35 | + uses: actions/checkout@v2 |
| 36 | + |
| 37 | + # we are only interested in installing and caching dependencies, |
| 38 | + # without installing the Cypress binary |
| 39 | + - name: Install NPM dependencies 📦 |
| 40 | + uses: cypress-io/github-action@v2 |
| 41 | + # we do not want to accidentally overwrite |
| 42 | + # the full cache created in the e2e test job |
| 43 | + # because this job does not cache Cypress binary |
| 44 | + # thus we use custom cache key |
| 45 | + with: |
| 46 | + cache-key: unit-cache-v1-${{ runner.os }}-hash-${{ hashFiles('package-lock.json') }} |
| 47 | + env: |
| 48 | + # we do not need to install Cypress itself |
| 49 | + # as we do not plan to run tests |
| 50 | + CYPRESS_INSTALL_BINARY: 0 |
| 51 | + |
| 52 | + - name: Run Jest tests 🧪 |
| 53 | + run: npm test |
| 54 | + |
| 55 | + unit-without-any-helpers: |
| 56 | + runs-on: ubuntu-20.04 |
| 57 | + steps: |
| 58 | + - name: Checkout 🛎 |
| 59 | + uses: actions/checkout@v2 |
| 60 | + |
| 61 | + # use actions/cache to restore / save cache |
| 62 | + - name: Cache dependencies 💎 |
| 63 | + uses: actions/cache@v2 |
| 64 | + with: |
| 65 | + path: ~/.npm |
| 66 | + # use key string with "v1" for simple cache invalidation |
| 67 | + key: dependencies-v1-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} |
| 68 | + |
| 69 | + - name: Install dependencies 📦 |
| 70 | + run: npm ci |
| 71 | + env: |
| 72 | + # we do not need to install Cypress itself |
| 73 | + # as we do not plan to run tests |
| 74 | + CYPRESS_INSTALL_BINARY: 0 |
| 75 | + |
| 76 | + - name: Run Jest tests 🧪 |
| 77 | + run: npm test |
0 commit comments