From 2a4f0207c570bba6b9e2e8b0e7f17cfdc893e824 Mon Sep 17 00:00:00 2001 From: Bart van der Braak Date: Fri, 18 Aug 2023 10:36:14 +0200 Subject: [PATCH] refactor: run lighthouse accurate on vercel target --- .github/workflows/unlighthouse.yaml | 23 +++++++++++++++-------- unlighthouse.config.ts | 8 ++++++++ 2 files changed, 23 insertions(+), 8 deletions(-) create mode 100644 unlighthouse.config.ts diff --git a/.github/workflows/unlighthouse.yaml b/.github/workflows/unlighthouse.yaml index a29c3b4..77bb3fa 100644 --- a/.github/workflows/unlighthouse.yaml +++ b/.github/workflows/unlighthouse.yaml @@ -34,14 +34,21 @@ jobs: with: node-version: ${{ matrix.node-version }} - - name: Install dependencies - run: npm install + - name: Retrieve Vercel Preview URL + uses: zentered/vercel-preview-url@v1.1.9 + id: vercel_preview_url + env: + VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} + with: + vercel_project_id: ${{ vars.VERCEL_PROJECT_ID }} - - name: Build production - run: npm run build - - - name: Start Preview and Get Preview URL - run: npm run preview -- --port=${{ env.PORT }} & echo $! > preview_pid + - name: Await Vercel Deployment + uses: UnlyEd/github-action-await-vercel@v1.2.43 + env: + VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} + with: + deployment-url: ${{ steps.vercel_preview_url.outputs.preview_url }} + timeout: 120 - name: Install Dependencies run: npm add -g @unlighthouse/cli puppeteer @@ -49,7 +56,7 @@ jobs: - name: Run Unlighthouse run: | unlighthouse-ci \ - --site "http://localhost:${{ env.PORT }}" \ + --site "${{ steps.vercel_preview_url.outputs.preview_url }}" \ --reporter jsonExpanded \ --build-static diff --git a/unlighthouse.config.ts b/unlighthouse.config.ts new file mode 100644 index 0000000..89996c7 --- /dev/null +++ b/unlighthouse.config.ts @@ -0,0 +1,8 @@ +export default { + scanner: { + samples: 3 + }, + puppeteerClusterOptions: { + maxConcurrency: 1 + } +};