[DOC-#8696hk5uf] | Make the '.md' file accessible #73
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and test code on different devices | |
on: | |
pull_request: | |
branches: [develop] | |
push: | |
branches: [develop] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
permissions: | |
contents: read | |
pull-requests: write | |
strategy: | |
matrix: | |
version: [18.x, 20.x] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.version }} | |
- run: node -v | |
- name: Dependencies vulnerabilities | |
run: npm audit | |
- name: Install Dependencies | |
run: npm ci | |
- name: Linter checker | |
run: npm run lint | |
- name: Generate services | |
run: npm run generate | |
- name: Unit tests | |
run: npm run test:unit:coverage | |
- name: Report Coverage | |
if: matrix.version == '20.x' | |
uses: davelosert/vitest-coverage-report-action@v2 | |
with: | |
json-summary-path: "./coverage/coverage-summary.json" | |
json-final-path: "./coverage/coverage-final.json" | |
- name: Cypress install | |
uses: cypress-io/github-action@v6 | |
with: | |
# Disable running of tests within build job | |
runTests: false | |
- run: npm run build | |
- name: Save build folder | |
uses: actions/upload-artifact@v4 | |
if: matrix.version == '20.x' | |
with: | |
name: dist | |
if-no-files-found: error | |
path: dist | |
vulnerabilities-check: | |
runs-on: ubuntu-20.04 | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
- name: Node version | |
run: node -v | |
- name: Install Dependencies | |
run: npm ci | |
- name: Generate services | |
run: npm run generate | |
- name: Unit tests | |
run: npm run test:unit:coverage | |
- name: File | |
run: ls && cd coverage && ls | |
- name: Analyze with SonarCloud | |
uses: sonarsource/[email protected] | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
ORGANIZATION: ${{ secrets.ORGANIZATION }} | |
PROJECT_KEY: ${{ secrets.PROJECT_KEY }} | |
SONAR_HOST_URL: https://sonarcloud.io/ | |
with: | |
args: -Dsonar.organization=${{ secrets.ORGANIZATION }} | |
-Dsonar.projectKey=${{ secrets.PROJECT_KEY }} | |
-Dsonar.test.exclusions=**/node_modules/**,**/dist/**,**/src/main.ts,**/cypress/** | |
-Dsonar.javascript.lcov.reportPaths=coverage/lcov.info | |
ui-desktop-tests: | |
timeout-minutes: 15 | |
runs-on: ubuntu-20.04 | |
needs: [build, vulnerabilities-check] | |
strategy: | |
# don't fail the entire matrix on failure | |
fail-fast: false | |
matrix: | |
browser: [chrome, edge, firefox] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Node info and installation | |
run: | | |
node -v | |
npm ci | |
- name: Download the build folder | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: dist | |
- name: UI Test for chrome | |
uses: cypress-io/github-action@v6 | |
with: | |
config: "viewportWidth=1281" # can be remove if already set on the test cases | |
start: npm run preview | |
wait-on: "http://localhost:4173/" | |
wait-on-timeout: 180 | |
record: true | |
config-file: cypress.config.ts | |
spec: cypress/e2e/desktop/**/*.cy.ts | |
env: | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }} | |
COMMIT_INFO_SHA: ${{ github.event.pull_request.head.sha }} | |
DEBUG: "cypress:server:args" | |
- name: Print Cypress Cloud URL | |
if: always() | |
run: | | |
echo Cypress finished with: ${{ steps.cypress.outcome }} | |
echo See results at ${{ steps.cypress.outputs.resultsUrl }} | |
ui-mobile-tests: | |
timeout-minutes: 15 | |
runs-on: ubuntu-20.04 | |
needs: [build, vulnerabilities-check] | |
strategy: | |
fail-fast: false | |
matrix: | |
browser: [chrome, edge, firefox] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Node info | |
run: | | |
node -v | |
npm ci | |
- name: Download the build folder | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: dist | |
- name: UI Test for chrome | |
uses: cypress-io/github-action@v6 | |
with: | |
config: "viewportWidth=320" # can be remove if already set on the test cases | |
start: npm run preview | |
wait-on: "http://localhost:4173" | |
wait-on-timeout: 180 | |
record: true | |
config-file: cypress.config.ts | |
spec: cypress/e2e/mobile/**/*.cy.ts | |
env: | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }} | |
COMMIT_INFO_SHA: ${{ github.event.pull_request.head.sha }} | |
DEBUG: "cypress:server:args" | |
- name: Print Cypress Cloud URL | |
if: always() | |
run: | | |
echo Cypress finished with: ${{ steps.cypress.outcome }} | |
echo See results at ${{ steps.cypress.outputs.resultsUrl }} | |
ui-tablet-tests: | |
timeout-minutes: 15 | |
runs-on: ubuntu-20.04 | |
needs: [build, vulnerabilities-check] | |
strategy: | |
fail-fast: false | |
matrix: | |
browser: [chrome, edge, firefox] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Node info | |
run: | | |
node -v | |
npm ci | |
- name: Download the build folder | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: dist | |
- name: UI Test for chrome | |
uses: cypress-io/github-action@v6 | |
with: | |
config: "viewportWidth=641" # can be remove if already set on the test cases | |
start: npm run preview | |
wait-on: "http://localhost:4173" | |
wait-on-timeout: 180 | |
record: true | |
config-file: cypress.config.ts | |
spec: cypress/e2e/tablet/**/*.cy.ts | |
env: | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }} | |
COMMIT_INFO_SHA: ${{ github.event.pull_request.head.sha }} | |
DEBUG: "cypress:server:args" | |
- name: Print Cypress Cloud URL | |
if: always() | |
run: | | |
echo Cypress finished with: ${{ steps.cypress.outcome }} | |
echo See results at ${{ steps.cypress.outputs.resultsUrl }} | |
ui-laptop-tests: | |
timeout-minutes: 15 | |
runs-on: ubuntu-20.04 | |
needs: [build, vulnerabilities-check] | |
strategy: | |
fail-fast: false | |
matrix: | |
browser: [chrome, edge, firefox] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Node info | |
run: | | |
node -v | |
npm ci | |
- name: Download the build folder | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: dist | |
- name: UI Test for chrome | |
uses: cypress-io/github-action@v6 | |
with: | |
config: "viewportWidth=1025" # can be remove if already set on the test cases | |
start: npm run preview | |
wait-on: "http://localhost:4173" | |
wait-on-timeout: 180 | |
record: true | |
config-file: cypress.config.ts | |
spec: cypress/e2e/laptop/**/*.cy.ts | |
env: | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }} | |
COMMIT_INFO_SHA: ${{ github.event.pull_request.head.sha }} | |
DEBUG: "cypress:server:args" | |
- name: Print Cypress Cloud URL | |
if: always() | |
run: | | |
echo Cypress finished with: ${{ steps.cypress.outcome }} | |
echo See results at ${{ steps.cypress.outputs.resultsUrl }} |