-
Notifications
You must be signed in to change notification settings - Fork 1
Improve Lighthouse CI workflow: use npm ci, npx, dynamic URL, and badges #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -54,19 +54,30 @@ jobs: | |||||||
| needs: deploy | ||||||||
| runs-on: ubuntu-latest | ||||||||
|
|
||||||||
| permissions: | ||||||||
| contents: write | ||||||||
|
|
||||||||
| steps: | ||||||||
| - uses: actions/checkout@v4 | ||||||||
| - name: Use Node.js 20 | ||||||||
| uses: actions/setup-node@v4 | ||||||||
| with: | ||||||||
| node-version: 20 | ||||||||
| cache: 'npm' | ||||||||
|
|
||||||||
| - name: Install dependencies | ||||||||
| run: npm ci | ||||||||
|
|
||||||||
| - name: npm install, build | ||||||||
| run: | | ||||||||
| npm install | ||||||||
| npm run build | ||||||||
| - name: Build website | ||||||||
| run: npm run build | ||||||||
|
|
||||||||
| - name: run Lighthouse CI | ||||||||
| run: | | ||||||||
| npm install -g @lhci/cli@0.15.x | ||||||||
| lhci autorun | ||||||||
| - name: Run Lighthouse CI | ||||||||
| run: > | ||||||||
| npx --yes @lhci/cli@0.15.x autorun | ||||||||
| --collect.url="https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/" | ||||||||
| --collect.settings.chromeFlags="--headless --no-sandbox --disable-gpu" | ||||||||
|
|
||||||||
| - name: Generate Lighthouse Badges | ||||||||
| uses: myactionway/lighthouse-badger-action@v2.2 | ||||||||
|
||||||||
| uses: myactionway/lighthouse-badger-action@v2.2 | |
| uses: myactionway/lighthouse-badger-action@v2.2 | |
| continue-on-error: true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,10 @@ | ||
| module.exports = { | ||
| ci: { | ||
| collect: { | ||
| numberOfRuns: 3, | ||
| }, | ||
| upload: { | ||
| target: "temporary-public-storage", | ||
| target: 'temporary-public-storage', | ||
| }, | ||
| }, | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not clear to me what this line does, can you give me some context?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 74 (now line 77) constructs the GitHub Pages URL dynamically using repository context variables.
github.repository_owneris the owner (e.g., "S7-OpenLearning-Individual") andgithub.event.repository.nameis the repo name (e.g., "DesignPatternPedia"). This creates the full URL:https://s7-openlearning-individual.github.io/DesignPatternPedia/which is where the site is deployed. This approach makes the workflow self-contained and reusable without hardcoding URLs.