Skip to content

Commit

Permalink
Merge branch 'main' into fix/264-unknown-error-when-the-browser-windo…
Browse files Browse the repository at this point in the history
…w-is-small
  • Loading branch information
ansivgit committed Jul 5, 2024
2 parents d6453f7 + 13ed152 commit c57e298
Show file tree
Hide file tree
Showing 99 changed files with 1,084 additions and 1,040 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Qodana
on:
workflow_dispatch:
pull_request:
push:
branches:
- main

env:
NODE_VERSION: 20.x

jobs:
qodana:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
checks: write

steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}

- uses: bahmutov/npm-install@v1

- name: 'Qodana Scan'
uses: JetBrains/[email protected]
env:
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
59 changes: 59 additions & 0 deletions .github/workflows/lighthouse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Lighthouse test

on:
repository_dispatch:
types: [preview-created]

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

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

- name: Install dependencies
run: npm install && npm install -g @lhci/[email protected]

- name: Run Lighthouse
run: lhci autorun --collect.url=https://pr${{ github.event.client_payload.number }}.rs.school

- name: Upload Lighthouse artifacts
uses: actions/upload-artifact@v4
with:
name: lighthouse-report
path: '.lighthouseci/*'

- name: Generate Lighthouse report summary
id: generate_report
run: |
REPORT_PATH=$(ls .lighthouseci/lhr-*.json | head -n 1)
FINAL_URL=$(jq -r '.finalUrl' "$REPORT_PATH")
LINKS_PATH=$(ls .lighthouseci/links.json | head -n 1)
REPORT_URL=$(jq -r --arg FINAL_URL "$FINAL_URL" '.[$FINAL_URL]' "$LINKS_PATH")
PERFORMANCE=$(jq -r '.categories.performance.score * 100' "$REPORT_PATH")
ACCESSIBILITY=$(jq -r '.categories.accessibility.score * 100' "$REPORT_PATH")
BEST_PRACTICES=$(jq -r '.categories["best-practices"].score * 100' "$REPORT_PATH")
SEO=$(jq -r '.categories.seo.score * 100' "$REPORT_PATH")
echo "performance=$PERFORMANCE" >> $GITHUB_OUTPUT
echo "accessibility=$ACCESSIBILITY" >> $GITHUB_OUTPUT
echo "bestPractices=$BEST_PRACTICES" >> $GITHUB_OUTPUT
echo "seo=$SEO" >> $GITHUB_OUTPUT
echo "reportUrl=$REPORT_URL" >> $GITHUB_OUTPUT
- name: Post Lighthouse results to PR
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.client_payload.number }}
body: |
**Lighthouse Report**:
- Performance: ${{ steps.generate_report.outputs.performance }} / 100
- Accessibility: ${{ steps.generate_report.outputs.accessibility }} / 100
- Best Practices: ${{ steps.generate_report.outputs.bestPractices }} / 100
- SEO: ${{ steps.generate_report.outputs.seo }} / 100
[View detailed report](${{ steps.generate_report.outputs.reportUrl }})
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- main

env:
NODE_VERSION: 21.x
NODE_VERSION: 20.x

jobs:
ci:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ jobs:
- name: build
env:
HOST: 'https://rollingscopes.com'
RS_SCHOOL_HOST: 'https://rs.school'
run: |
npm install
npm run build
Expand Down
14 changes: 13 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,22 @@ export default [
...cssImportOrder.configs['recommended'].rules,

'no-undef': 'off',
'no-restricted-exports': [
'warn',
{ 'restrictDefaultExports':
{
'direct': true,
'named': true,
'defaultFrom': true,
'namedFrom': true,
'namespaceFrom': true,
}
}
],
'react/prop-types': 'off',
'react/react-in-jsx-scope': 'off',
'react-refresh/only-export-components': [
'warn',
'off',
{ allowConstantExport: true },
],

Expand Down
8 changes: 8 additions & 0 deletions lighthouserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"ci": {
"collect": { "numberOfRuns": 1 },
"upload": {
"target": "temporary-public-storage"
}
}
}
Loading

0 comments on commit c57e298

Please sign in to comment.