diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 47eb2c5..2044e20 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -22,129 +22,10 @@ jobs: with: node-version: 18.x.x cache: "npm" - - name: Install dependencies - id: install-dependencies - run: npm ci - - name: Store Playwright's Version - id: store-playwright-version - run: | - PLAYWRIGHT_VERSION=$(npm ls @playwright/test | grep @playwright | sed 's/.*@//') - echo "Playwright's Version: $PLAYWRIGHT_VERSION" - echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV - - name: Cache Playwright Browsers for Playwright's Version - id: cache-playwright-browsers - uses: actions/cache@v3 - env: - PLAYWRIGHT_VERSION: ${{ steps.store-playwright-version.outputs.PLAYWRIGHT_VERSION }} - if: env.PLAYWRIGHT_VERSION == 'true' + - name: Code Quality + uses: ZebraDevs/web-components-code-quality@v1.0.0 with: - path: ~/.cache/ms-playwright - key: playwright-browsers-${{ env.PLAYWRIGHT_VERSION }} - - name: Install playwright browsers - if: steps.cache-playwright-browsers.outputs.cache-hit != 'true' - run: npx playwright install --with-deps - - name: Run custom elements manifest analyzer - id: run-custom-elements-manifest-analyzer - run: npm run analyze - - name: Run eslint - id: run-eslint - run: npm run lint - - name: Run prettier - id: run-prettier - run: npm run prettier - - name: Run lit-analyzer - id: run-lit-analyzer - run: npm run lint:lit-analyzer - - name: Run tests and generate coverage - run: npm run test -- --coverage --debug - id: run-tests-and-generate-coverage - - name: Test tsdoc - run: npm run docs - id: test-tsdoc - - name: Check for modified files - id: git-check - run: echo "modified=$(if [ -n "$(git status --porcelain)" ]; then echo "true"; else echo "false"; fi)" >> $GITHUB_ENV - - name: Update changes in GitHub repository - id: update-changes-in-github-repository - env: - MODIFIED: ${{ steps.git-check.outputs.modified }} - if: env.MODIFIED == 'true' - run: | - git config --global user.name "github-actions" - git config --global user.email "github-actions@github.com" - git add -A - git commit -m '[automated commit] lint format and import sort' - git push - - name: PR checks complete - if: always() - uses: actions/github-script@v6 - with: - script: | - const fs = require('fs'); - const steps = [ - { name: 'Install dependencies', conclusion: '${{ steps.install-dependencies.outcome }}' }, - { name: 'Custom elements manifest analyzer', conclusion: '${{ steps.run-custom-elements-manifest-analyzer.outcome }}' }, - { name: 'Eslint', conclusion: '${{ steps.run-eslint.outcome }}' }, - { name: 'Prettier', conclusion: '${{ steps.run-prettier.outcome }}' }, - { name: 'Lit-analyzer', conclusion: '${{ steps.run-lit-analyzer.outcome }}' }, - { name: 'Tests and coverage', conclusion: '${{ steps.run-tests-and-generate-coverage.outcome }}' }, - { name: 'Test tsdoc', conclusion: '${{ steps.test-tsdoc.outcome }}' }, - { name: 'Check for modified files', conclusion: '${{ steps.git-check.outcome }}' }, - { name: 'Update changes in GitHub repository', conclusion: '${{ steps.update-changes-in-github-repository.outcome }}' } - ] - const failedSteps = steps.filter(step => step.conclusion === 'failure'); - const skippedSteps = steps.filter(step => step.conclusion === 'skipped'); - const passedSteps = steps.filter(step => step.conclusion === 'success'); - - const failedStepsDetails = failedSteps.map(step => `- ❌ - ${step.name} failed`).join('\n'); - const skippedStepsDetails = skippedSteps.map(step => `- ⏭️ - ${step.name} skipped`).join('\n'); - const passedStepsDetails = passedSteps.map(step => `- ✅ - ${step.name} passed`).join('\n'); - - const coverage = fs.readFileSync("coverage/lcov-report/index.html", "utf8"); - const coverageData = coverage - .split('