Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
af60b87
Update README.md
Eloypripan Feb 13, 2025
5466c20
Create ci_lighthouse
Eloypripan Feb 13, 2025
deded70
Update README.md
Eloypripan Feb 13, 2025
c043601
Create pagespeed.yml
Eloypripan Feb 13, 2025
6e0c7f1
Merge pull request #1 from Eloypripan/patch-1
Eloypripan Feb 13, 2025
db6dc18
Update and rename ci_lighthouse to Lighthouse.yml
Eloypripan Feb 13, 2025
70d3d70
Update Lighthouse.yml
Eloypripan Feb 13, 2025
b50706c
Add files via upload
Eloypripan Feb 13, 2025
2e148bf
Rename lighthouse-config.js to lighthouse.js
Eloypripan Feb 13, 2025
4997200
Update Lighthouse.yml
Eloypripan Feb 13, 2025
27724a2
Update README.md
Eloypripan Feb 13, 2025
1b65bb7
Update README.md
Eloypripan Feb 13, 2025
444f6e7
Update README.md
Eloypripan Feb 13, 2025
8b5ba7a
Update README.md
Eloypripan Feb 13, 2025
dfe2bed
Update README.md
Eloypripan Feb 13, 2025
d8f0dca
Update README.md
Eloypripan Feb 13, 2025
51ac617
Update README.md
Eloypripan Feb 13, 2025
cb46cbb
Update README.md
Eloypripan Feb 13, 2025
22b5462
Update README.md
Eloypripan Feb 13, 2025
1290aa9
Update README.md
Eloypripan Feb 13, 2025
ae500a4
Update README.md
Eloypripan Feb 13, 2025
3f0cf8f
Update README.md
Eloypripan Feb 13, 2025
05553b7
Update README.md
Eloypripan Feb 13, 2025
7eb712f
Update pagespeed.yml
Eloypripan Feb 13, 2025
255736a
Rename lighthouse.js to .lighthouse.js
Eloypripan Feb 13, 2025
b7f5044
Update README.md
Eloypripan Feb 13, 2025
abac118
Update README.md
Eloypripan Feb 13, 2025
4b475cb
Update README.md
Eloypripan Feb 13, 2025
547df33
Update README.md
Eloypripan Feb 13, 2025
b4a030b
Update README.md
Eloypripan Feb 13, 2025
d555616
Update README.md
Eloypripan Feb 13, 2025
4d827d2
Rename Lighthouse.yml to Lighthouse&Pagespeed.yml
Eloypripan Feb 13, 2025
498274f
Create unlighthouse2.yml
Eloypripan Feb 17, 2025
8ac758c
Rename unlighthouse2.yml to unlighthouse.yml
Eloypripan Feb 17, 2025
882bc31
Update unlighthouse.yml
Eloypripan Feb 17, 2025
2425ace
Create cd-main.yml
Eloypripan Feb 17, 2025
f2f9e6d
Rename cd-main.yml to cd-audit.yml
Eloypripan Feb 17, 2025
efe7531
Update cd-audit.yml
Eloypripan Feb 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/Lighthouse&Pagespeed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Ligthhouse and Pagespeed Insights
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allow manual trigger
workflow_dispatch:
# Run daily to update badges
#schedule:
# - cron: '0 0 * * *'

jobs:
lighthouse:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install Lighthouse CI
run: npm install -g @lhci/cli@0.13.x

- name: Run Lighthouse CI
run: |
lhci autorun \
--collect.url=${{ secrets.SITE_URL || 'http://localhost:3000' }} \
--upload.target=temporary-public-storage
env:
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}

#- name: Run PageSpeed Insights and Generate Badges
# uses: jakepartusch/psi-action@v1.3
# with:
# url: ${{ secrets.SITE_URL || 'http://localhost:3000' }}
# strategy: mobile
# threshold: 70
# key: ${{ secrets.PSI_API_KEY }}

- name: Generate Badges
run: |
# Create badges directory if it doesn't exist
mkdir -p badges

# Generate badges using shields.io
curl -o badges/performance.svg "https://img.shields.io/badge/dynamic/json?label=Performance&query=$.categories.performance.score&url=https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=${{ secrets.SITE_URL }}&key=${{ secrets.PSI_API_KEY }}&strategy=mobile&multiply=100&style=flat&logo=lighthouse&suffix=%"

curl -o badges/accessibility.svg "https://img.shields.io/badge/dynamic/json?label=Accessibility&query=$.categories.accessibility.score&url=https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=${{ secrets.SITE_URL }}&key=${{ secrets.PSI_API_KEY }}&strategy=mobile&multiply=100&style=flat&logo=lighthouse&suffix=%"

curl -o badges/best-practices.svg "https://img.shields.io/badge/dynamic/json?label=Best%20Practices&query=$.categories.best-practices.score&url=https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=${{ secrets.SITE_URL }}&key=${{ secrets.PSI_API_KEY }}&strategy=mobile&multiply=100&style=flat&logo=lighthouse&suffix=%"

curl -o badges/seo.svg "https://img.shields.io/badge/dynamic/json?label=SEO&query=$.categories.seo.score&url=https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=${{ secrets.SITE_URL }}&key=${{ secrets.PSI_API_KEY }}&strategy=mobile&multiply=100&style=flat&logo=lighthouse&suffix=%"

- name: Commit and Push Badges
run: |
git config --global user.name 'GitHub Action'
git config --global user.email 'action@github.com'
git add badges/
git commit -m "Update PageSpeed Insights badges" || exit 0
git push
62 changes: 62 additions & 0 deletions .github/workflows/cd-audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: CD - Audit

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Activacion manual
workflow_dispatch:

jobs:
deploy-and-audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'

- name: Setup PNPM
uses: pnpm/action-setup@v4
with:
version: 10

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build website
run: pnpm build

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist # Adjust this to your build output directory

# Wait for GitHub Pages deployment to complete
- name: Wait for deployment
run: |
# Extract repository name for the URL
REPO_NAME=${GITHUB_REPOSITORY#*/}
# Wait for GitHub Pages to be ready (usually takes 1-2 minutes)
sleep 120
# Store the GitHub Pages URL
echo "SITE_URL=https://${{ github.repository_owner }}.github.io/$REPO_NAME" >> $GITHUB_ENV

# Run Unlighthouse audit
- name: Install Unlighthouse
run: pnpm add -g @unlighthouse/cli

- name: Run Unlighthouse audit
run: unlighthouse-ci --site ${{ env.SITE_URL }} --config unlighthouse.config.ts

# Upload results as artifacts
- name: Upload Unlighthouse results
uses: actions/upload-artifact@v4
if: always()
with:
name: unlighthouse-results
path: .unlighthouse
38 changes: 38 additions & 0 deletions .github/workflows/pagespeed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: PageSpeed Insights
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Activacion manual :)
workflow_dispatch:

jobs:
lighthouse:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install Lighthouse CI
run: npm install -g @lhci/cli@0.13.x

- name: Run Lighthouse CI
run: |
lhci autorun \
--collect.url=${{ secrets.SITE_URL || 'http://localhost:3000' }} \
--upload.target=temporary-public-storage
env:
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}

- name: Run PageSpeed Insights
uses: jakepartusch/psi-action@v1.3
with:
url: ${{ secrets.SITE_URL || 'http://localhost:3000' }}
strategy: mobile
threshold: 50 #deberia ser 70 pero es que sale muy muy mal ....
api_key: ${{ secrets.PSI_API_KEY }}
34 changes: 34 additions & 0 deletions .github/workflows/unlighthouse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Unlighthouse Audit
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Activacion manual
workflow_dispatch:

jobs:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Install Unlighthouse
run: npm install -g unlighthouse

- name: Run Unlighthouse
run: unlighthouse ci --site https://ulp.ugr.es --site-key ulp-ugr --budget '{"performance":90,"accessibility":90,"best-practices":90,"seo":90}'
# en el budget he definido los valores que considero aceptables para cada uno de los aspectos que se puede medir
# los valores que yo es puesto son completamente subjetivos, y he puesto 90 porque me ha dado la gana jaja

- name: Upload results
if: always()
uses: actions/upload-artifact@v4
with:
name: unlighthouse-report
path: .unlighthouse
32 changes: 32 additions & 0 deletions .lighthouse.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module.exports = {
ci: {
collect: {
// Number of runs to do per URL
numberOfRuns: 3,
// Settings for collecting Lighthouse results
settings: {
preset: 'desktop',
chromeFlags: ['--disable-gpu', '--no-sandbox', '--no-zygote'],
},
// You can add multiple URLs to test
url: ['http://localhost:3000']
},
assert: {
// Add assertions here to enforce score thresholds
assertions: {
'categories:performance': ['warn', {minScore: 0.9}],
'categories:accessibility': ['warn', {minScore: 0.9}],
'categories:best-practices': ['warn', {minScore: 0.9}],
'categories:seo': ['warn', {minScore: 0.9}],
'first-contentful-paint': ['warn', {maxNumericValue: 2000}],
'interactive': ['warn', {maxNumericValue: 3500}],
'largest-contentful-paint': ['warn', {maxNumericValue: 2500}],
}
},
upload: {
// Upload target for the results
target: 'temporary-public-storage',
// You can also use other targets like 'lhci' if you have a Lighthouse CI Server
},
},
};
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@

# ULP Website

Página web oficial de la UGR LAN Party.
[Página web oficial de la UGR LAN Party](https://ulp.ugr.es)


![Chromium HSTS preload](https://img.shields.io/hsts/preload/ulp.ugr.es)
![Mozilla HTTP Observatory Grade](https://img.shields.io/mozilla-observatory/grade-score/ulp.ugr.es)

[Performance](https://googlechrome.github.io/lighthouse/viewer/?gist=521d3ce3747c754c1b80dcae048bf21f)


## Instalación para desarrollo

Expand Down