Skip to content

Commit

Permalink
feat(project): fix lhci workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonLantukh committed Jul 13, 2023
1 parent 6b8973e commit 69550a9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 12 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/firebase-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build
- name: Build Preview Link
env:
APP_PLAYER_LICENSE_KEY: ${{ secrets.PLAYER_LICENSE_KEY }}
run: yarn && MODE=preview yarn build
Expand All @@ -19,8 +19,11 @@ jobs:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT }}'
expires: 30d
- name: Dispatch init event to run Lighthouse
env:
GH_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
- shell: bash
run: |
gh workflow run 'Lighthouse' --ref '${{ github.event.pull_request.head.ref }}' -f url='${{ steps.firebase_hosting_preview.outputs.details_url }}'
${{ steps.firebase_hosting_preview.outputs.details_url }} > preview_link.txt
- name: Upload preview link
uses: actions/upload-artifact@v3
with:
name: preview_link
path: preview_link.txt
25 changes: 18 additions & 7 deletions .github/workflows/lhci.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
name: Lighthouse

on:
workflow_dispatch:
inputs:
url:
description: 'Fill preview link'
pull_request:
branches: ['develop', 'feat/*', 'feature/*', 'release']

jobs:
lhci:
name: Lighthouse
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Wait for preview link to be created
uses: lewagon/[email protected]
with:
ref: ${{ github.ref }}
running-workflow-name: 'Firebase Preview'
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 10
- name: Grab preview link
uses: actions/download-artifact@v3
with:
name: preview_link
- name: Set env
run: echo "PREVIEW_LINK=$(cat preview_link.txt)" >> $GITHUB_ENV
- uses: actions/checkout@v2
- name: Install Lighthouse CI
run: sudo yarn global add @lhci/[email protected] http-server
run: sudo yarn global add @lhci/[email protected]
- name: Run Lighthouse CI
run: lhci autorun --collect.url=${{ github.event.inputs.url }}?app-config=gnnuzabk --config=./lighthouserc.js
run: lhci autorun --collect.url=${{ env.PREVIEW_LINK }}?app-config=gnnuzabk --config=./lighthouserc.js

0 comments on commit 69550a9

Please sign in to comment.