refactor: delete old structure

This commit is contained in:
Bart van der Braak 2024-01-27 23:21:10 +01:00
parent f1fddec0a7
commit 6e2d812345
64 changed files with 0 additions and 8292 deletions

View file

@ -1,14 +0,0 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
reviewers:
- "bartvdbraak"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
reviewers:
- "bartvdbraak"

View file

@ -1,34 +0,0 @@
name: Cleanup GitHub Pages on Branch Deletion
on:
delete
permissions:
contents: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3.5.3
- name: Delete directory in gh-pages
if: github.event.ref_type == 'branch'
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git fetch --all
git checkout gh-pages
branchName=$(echo "${{ github.event.ref }}" | sed -e 's,^refs/heads/,,')
if [ -d "./${branchName}" ]; then
git rm -rf --ignore-unmatch "${branchName}"
git commit -m "Cleanup directory for deleted branch ${branchName}"
git push origin gh-pages
else
echo "Directory doesn't exist for branch ${branchName}"
fi

View file

@ -1,152 +0,0 @@
name: Lighthouse report
on:
pull_request:
permissions:
contents: write
pages: write
id-token: write
pull-requests: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
unlighthouse:
environment:
name: github-pages
url: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/${{ env.BRANCH_NAME }}
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18]
steps:
- name: Sticky Comment on Pull Request
uses: marocchino/sticky-pull-request-comment@v2.7.0
with:
header: unlighthouse
message: |
⚡️ Lighthouse report
![Loading](https://github.com/bartvdbraak/omnidash/assets/3996360/8e85bc78-53ac-41de-bdb6-bedfe8c6d8c1)
- name: Checkout Git repository
uses: actions/checkout@v3.5.3
- name: Setup pnpm
uses: pnpm/action-setup@v2.4.0
with:
version: 8.6.2
- name: Setup Node.js
uses: actions/setup-node@v3.7.0
with:
node-version: ${{ matrix.node-version }}
cache: pnpm
- name: Install Dependencies
run: pnpm add -g @unlighthouse/cli puppeteer
- 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: 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: Build Unlighthouse report
run: |
unlighthouse-ci \
--router-prefix "${{ github.event.repository.name }}/${{ env.BRANCH_NAME }}" \
--site "${{ steps.vercel_preview_url.outputs.preview_url }}" \
--reporter jsonExpanded \
--build-static
- name: Deploy report to GitHub pages
uses: peaceiris/actions-gh-pages@v3.9.3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./.unlighthouse
destination_dir: ${{ env.BRANCH_NAME }}
- name: Format lighthouse score
id: format_lighthouse_score
uses: actions/github-script@v6.4.1
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const fs = require('fs');
const result = JSON.parse(fs.readFileSync('.unlighthouse/ci-result.json', 'utf8'));
const formatScore = score => `${Math.round(score * 100)} (${score})`;
const getEmoji = score => score >= 0.9 ? '🟢' : score >= 0.5 ? '🟠' : '🔴';
const score = res => `${getEmoji(res)} ${formatScore(res)}`;
const reportUrl = `https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/${{ env.BRANCH_NAME }}`;
const comment = [
`⚡️ Lighthouse report for the changes in this PR:`,
'| Category | Score |',
'| --- | --- |',
`| Performance | ${score(result.summary.categories.performance.averageScore)} |`,
`| Accessibility | ${score(result.summary.categories.accessibility.averageScore)} |`,
`| Best practices | ${score(result.summary.categories['best-practices'].averageScore)} |`,
`| SEO | ${score(result.summary.categories.seo.averageScore)} |`,
`| *Overall* | ${score(result.summary.score)} |`,
'',
'*Lighthouse scores for individual routes:*',
'',
'| Path | Performance | Accessibility | Best practices | SEO | Overall |',
'| --- | --- | --- | --- | --- | --- |',
`${result.routes.map(route => `| ${route.path} | ${score(route.categories.performance.score)} | ${score(route.categories.accessibility.score)} | ${score(route.categories['best-practices'].score)} | ${score(route.categories.seo.score)} | ${score(route.score)} |`).join('\n')}`,
'',
'*Lighthouse metrics:*',
'',
'| Metric | Average Value |',
'| --- | --- |',
`${Object.entries(result.summary.metrics).map(([metric, { averageNumericValue }]) => `| ${metric} | ${averageNumericValue} |`).join('\n')}`,
'',
`View the full Lighthouse report [here](${reportUrl}).`,
'',
'Learn more about the Lighthouse metrics:',
'- [Largest Contentful Paint](https://web.dev/lighthouse-largest-contentful-paint/)',
'- [Cumulative Layout Shift](https://web.dev/cls/)',
'- [First Contentful Paint](https://web.dev/first-contentful-paint/)',
'- [Total Blocking Time](https://web.dev/lighthouse-total-blocking-time/)',
'- [Max Potential First Input Delay](https://web.dev/lighthouse-max-potential-fid/)',
'- [Time to Interactive](https://web.dev/interactive/)',
].join('\n');
core.setOutput("comment", comment);
- name: Sticky Comment on Pull Request with result
uses: marocchino/sticky-pull-request-comment@v2.7.0
with:
header: unlighthouse
message: |
${{ steps.format_lighthouse_score.outputs.comment }}
- name: Sticky Comment on Pull Request with failure
uses: marocchino/sticky-pull-request-comment@v2.7.0
if: ${{ failure() }}
with:
header: unlighthouse
message: |
⚡️ Lighthouse report failed
See deployment for any errors

View file

@ -1,47 +0,0 @@
name: Linting and Dependency Check
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
checks: write
contents: write
jobs:
run-checks:
name: Run checks
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20]
steps:
- name: Checkout Git repository
uses: actions/checkout@v3.5.3
- name: Setup pnpm
uses: pnpm/action-setup@v2.4.0
with:
version: 8.6.2
- name: Setup Node.js
uses: actions/setup-node@v3.7.0
with:
node-version: ${{ matrix.node-version }}
cache: pnpm
- name: Install Node.js dependencies
run: pnpm install --frozen-lockfile
- name: Run linters
uses: wearerequired/lint-action@v2.3.0
with:
eslint: true
prettier: true
- name: Run dependency check
run: npx depcheck