Skip to content

Commit

Permalink
test(cy): components in CI
Browse files Browse the repository at this point in the history
Signed-off-by: Max <[email protected]>
  • Loading branch information
max-nextcloud committed Jan 18, 2024
1 parent fa145e8 commit 5642c59
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/cypress-component.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Cypress Component Tests

on: pull_request

env:
# Adjust APP_NAME if your repository name is different
APP_NAME: ${{ github.event.repository.name }}

# This represents the server branch to checkout.
# Usually it's the base branch of the PR, but for pushes it's the branch itself.
# e.g. 'main', 'stable27' or 'feature/my-feature
# n.b. server will use head_ref, as we want to test the PR branch.
BRANCH: ${{ github.base_ref || github.ref_name }}

jobs:
cypress-component:
runs-on: ubuntu-latest

steps:
- name: Checkout app
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Read package.json node and npm engines version
uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
id: versions
with:
fallbackNode: "^20"
fallbackNpm: "^9"

- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
node-version: ${{ steps.versions.outputs.nodeVersion }}

- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"

- name: Install node dependencies & build app
run: |
npm ci
TESTING=true npm run build --if-present
steps:

- name: Cypress component tests
uses: cypress-io/github-action@ebe8b24c4428922d0f793a5c4c96853a633180e3 # v6.6.0
with:
component: true
env:
# Needs to be prefixed with CYPRESS_
CYPRESS_BRANCH: ${{ env.BRANCH }}
# https:/cypress-io/github-action/issues/124
COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }}
# Needed for some specific code workarounds
TESTING: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CYPRESS_BUILD_ID: ${{ github.sha }}-${{ github.run_number }}
CYPRESS_GROUP: Run component

0 comments on commit 5642c59

Please sign in to comment.