From 1109eb1db0a5c307823b574f38b3550d7d792769 Mon Sep 17 00:00:00 2001 From: Stuart Clark Date: Mon, 12 Sep 2022 11:21:33 +1000 Subject: [PATCH] chore(#29): add e2e tests --- .github/workflows/test-e2e.yml | 99 ++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 .github/workflows/test-e2e.yml diff --git a/.github/workflows/test-e2e.yml b/.github/workflows/test-e2e.yml new file mode 100644 index 0000000..5c150c1 --- /dev/null +++ b/.github/workflows/test-e2e.yml @@ -0,0 +1,99 @@ +name: ci + +on: + push: + branches: + - main + - develop + pull_request: + branches: + - main + - develop + +jobs: + ci: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest] + node: [14] + + steps: + - name: Checkout ๐Ÿ›Ž + uses: actions/checkout@master + + - name: Setup node env ๐Ÿ— + uses: actions/setup-node@v3.4.1 + with: + node-version: ${{ matrix.node }} + check-latest: true + + - name: Get yarn cache directory path ๐Ÿ›  + id: yarn-cache-dir-path + run: cd nuxt && echo "::set-output name=dir::$(yarn cache dir)" + + - name: Cache node_modules ๐Ÿ“ฆ + uses: actions/cache@v3.0.8 + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Setup ddev + uses: jonaseberle/github-action-setup-ddev@v1 + with: + autostart: false + - name: Start ddev + run: cd drupal && ddev start + + - name: Install Drupal ๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป + run: cd drupal && ddev install + + - name: Install Nuxt.js ๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป + run: cd nuxt && yarn + + - name: Run linting ๐Ÿ”Ž + run: cd nuxt && yarn lint + + - name: Run Jest tests ๐Ÿงช + run: cd nuxt && yarn test:jest + + - name: Run Cypress tests ๐Ÿงช + run: cd nuxt && NODE_TLS_REJECT_UNAUTHORIZED=0 yarn test:cy + + - name: Deploy to Netlify + uses: nwtgck/actions-netlify@v1.2 + with: + publish-dir: './nuxt/dist' + production-branch: main + github-token: ${{ secrets.GITHUB_TOKEN }} + deploy-message: "Deploy from GitHub Actions" + enable-pull-request-comment: true + enable-commit-comment: true + overwrites-pull-request-comment: true + github-deployment-environment: ${{ github.head_ref }} + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} + timeout-minutes: 1 + + - uses: actions/upload-artifact@v3 + if: failure() + with: + name: cypress-screenshots + path: nuxt/cypress/screenshots + - uses: actions/upload-artifact@v3 + if: always() + with: + name: cypress-videos + path: nuxt/cypress/videos + + - uses: codecov/codecov-action@v3 + with: + files: ./nuxt/coverage/clover.xml + name: codecov-umbrella + fail_ci_if_error: true + verbose: true