Upd lighthouse conf #6
This file contains hidden or 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: Lighthouse CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| lighthouse: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: 'latest' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: | | |
| npm ci | |
| npm install -g @lhci/cli | |
| npm install xml-js | |
| - name: Build project | |
| run: npm run build | |
| - name: Extract URLs from sitemap | |
| id: sitemap | |
| run: | | |
| node -e " | |
| const fs = require('fs'); | |
| const convert = require('xml-js'); | |
| const sitemap = fs.readFileSync('./build/sitemap.xml', 'utf8'); | |
| const result = convert.xml2js(sitemap, {compact: true}); | |
| const urls = result.urlset.url.map(item => item.loc._text); | |
| fs.writeFileSync('./urls.json', JSON.stringify(urls)); | |
| console.log('Found URLs:', urls.length); | |
| " | |
| - name: Run Lighthouse CI | |
| id: lhci | |
| uses: treosh/lighthouse-ci-action@v12 | |
| with: | |
| configPath: './lighthouserc.js' | |
| uploadArtifacts: true | |
| temporaryPublicStorage: true | |
| env: | |
| LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }} |