From 56b8d5b2cc5fb227d14fd9c3e3322e834cc1aa68 Mon Sep 17 00:00:00 2001 From: Achanandhi-M Date: Tue, 29 Apr 2025 18:26:15 +0530 Subject: [PATCH 1/2] feat: lighthouse-github-actionsintegrations-added Signed-off-by: Achanandhi-M --- .github/workflows/lighthouse.yml | 49 ++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/lighthouse.yml diff --git a/.github/workflows/lighthouse.yml b/.github/workflows/lighthouse.yml new file mode 100644 index 0000000..9d34436 --- /dev/null +++ b/.github/workflows/lighthouse.yml @@ -0,0 +1,49 @@ +name: Lighthouse score + +on: + pull_request: + branches: + - '**' + +jobs: + lighthouse: + runs-on: ubuntu-latest + steps: + - name: Checkout PR branch + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 18 + + - name: Install static server + run: npm install -g serve + + - name: Serve PR branch (background on port 3001) + run: | + serve . -l 3001 & + sleep 5 + - name: Checkout main branch into separate folder + run: | + git fetch origin main + git worktree add main-branch origin/main + - name: Serve Main branch (background on port 3000) + run: | + cd main-branch + serve . -l 3000 & + cd .. + sleep 5 + + - name: Create output directory for Lighthouse + run: mkdir -p ${{ github.workspace }}/tmp/artifacts + + - name: Run Lighthouse audit for both PR and Main + uses: foo-software/lighthouse-check-action@master + with: + gitAuthor: ${{ github.actor }} + gitBranch: ${{ github.head_ref }} + gitHubAccessToken: ${{ secrets.GITHUB_TOKEN }} + outputDirectory: ${{ github.workspace }}/tmp/artifacts + urls: 'http://localhost:3000/?branch=main,http://localhost:3001/?branch=pr' + sha: ${{ github.sha }} \ No newline at end of file From bcf81e634c072f542c14755ae591ceacf15f0edd Mon Sep 17 00:00:00 2001 From: Achanandhi-M Date: Wed, 30 Apr 2025 18:48:58 +0530 Subject: [PATCH 2/2] lighthouse-modified --- .github/workflows/lighthouse.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/lighthouse.yml b/.github/workflows/lighthouse.yml index 9d34436..c8927df 100644 --- a/.github/workflows/lighthouse.yml +++ b/.github/workflows/lighthouse.yml @@ -43,7 +43,6 @@ jobs: with: gitAuthor: ${{ github.actor }} gitBranch: ${{ github.head_ref }} - gitHubAccessToken: ${{ secrets.GITHUB_TOKEN }} outputDirectory: ${{ github.workspace }}/tmp/artifacts urls: 'http://localhost:3000/?branch=main,http://localhost:3001/?branch=pr' sha: ${{ github.sha }} \ No newline at end of file