Skip to content
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

Adding Lighthouse audit #445

Merged
merged 74 commits into from
May 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
5b15f28
Adding Lighthouse audit
RichtXO Apr 14, 2021
4ab7df9
made changes
RichtXO Apr 15, 2021
05d3679
run plz?
RichtXO Apr 15, 2021
3c9ce77
cert errors have returned to bite my ass...
RichtXO Apr 15, 2021
2e6f001
combining the temp_deploy with the CI
RichtXO Apr 15, 2021
9c34f00
dam it
RichtXO Apr 15, 2021
ba990f8
add seed data
RichtXO Apr 15, 2021
ebbd917
will it work now?
RichtXO Apr 15, 2021
15bf227
just want to see it work :/
RichtXO Apr 15, 2021
909baac
more changes for the data
RichtXO Apr 15, 2021
5c8f098
changes
RichtXO Apr 15, 2021
a682db6
changes
RichtXO Apr 15, 2021
7c1233b
what is it outputtng...
RichtXO Apr 15, 2021
3b2c9dc
sleep?
RichtXO Apr 15, 2021
65ca255
remove space
RichtXO Apr 15, 2021
efc5b85
finally done!
RichtXO Apr 15, 2021
3efc4d3
run this in desktop?
RichtXO Apr 15, 2021
ffbe838
now it should work
RichtXO Apr 15, 2021
4af6752
adding screenEmulation
RichtXO Apr 15, 2021
40d9aac
test...
RichtXO Apr 15, 2021
1651681
test
RichtXO Apr 15, 2021
ef55536
adding back the desktop
RichtXO Apr 15, 2021
3187cc9
Now Adding 404 Page! (#429)
RichtXO Apr 15, 2021
aade109
beep boop Github Action Master Branch CI Prettier hard at work
Apr 15, 2021
d71f62f
Automatically Switch to Dark Mode (#410)
Viyerelu23333 Apr 15, 2021
589cec0
beep boop Github Action Master Branch CI Prettier hard at work
Apr 15, 2021
7a92e07
Nginx cache Solution (#424)
RichtXO Apr 15, 2021
fbfd324
just updating csv files
RichtXO Apr 15, 2021
763e339
PWA Coming to YACS (#432)
RichtXO Apr 16, 2021
dfa242f
beep boop Github Action Master Branch CI Prettier hard at work
Apr 16, 2021
dee7953
changing background color
RichtXO Apr 16, 2021
c49ab2a
linking apple image
RichtXO Apr 16, 2021
9d962c6
Adding Lighthouse audit
RichtXO Apr 14, 2021
56ad444
made changes
RichtXO Apr 15, 2021
258c4dd
run plz?
RichtXO Apr 15, 2021
fdedc68
cert errors have returned to bite my ass...
RichtXO Apr 15, 2021
30c95fa
combining the temp_deploy with the CI
RichtXO Apr 15, 2021
ab0ae37
dam it
RichtXO Apr 15, 2021
83ac2b1
add seed data
RichtXO Apr 15, 2021
1840641
will it work now?
RichtXO Apr 15, 2021
f9173e5
just want to see it work :/
RichtXO Apr 15, 2021
89c0409
more changes for the data
RichtXO Apr 15, 2021
fb0c354
changes
RichtXO Apr 15, 2021
004e2c0
changes
RichtXO Apr 15, 2021
93217de
what is it outputtng...
RichtXO Apr 15, 2021
de53a3d
sleep?
RichtXO Apr 15, 2021
9a67ec3
remove space
RichtXO Apr 15, 2021
b39d6cb
finally done!
RichtXO Apr 15, 2021
92d3902
run this in desktop?
RichtXO Apr 15, 2021
81101ea
now it should work
RichtXO Apr 15, 2021
7c3d03f
adding screenEmulation
RichtXO Apr 15, 2021
9bcc372
test...
RichtXO Apr 15, 2021
d3c5d65
test
RichtXO Apr 15, 2021
eb60c1a
adding back the desktop
RichtXO Apr 15, 2021
7d82ac9
Merge branch 'lighthouseCI' of https://github.com/YACS-RCOS/yacs.n in…
RichtXO Apr 16, 2021
b4e1d1d
final changes
RichtXO Apr 16, 2021
57d7161
small syntax difference?
RichtXO Apr 16, 2021
1f68f81
removed useless docker-compose build
RichtXO Apr 20, 2021
137a296
seperated the PR CD and CI
RichtXO Apr 23, 2021
30a9086
name changed
RichtXO Apr 23, 2021
dbbdbf3
trying out terosh/lighthouse-ci-action
RichtXO Apr 23, 2021
e67bb7e
removing spaces
RichtXO Apr 23, 2021
0998119
changing back
RichtXO Apr 23, 2021
b7d044f
adding url
RichtXO Apr 23, 2021
95b85ab
adding url
RichtXO Apr 23, 2021
0a33b1b
Revert "name changed"
RichtXO Apr 23, 2021
e08c0f4
asdf
RichtXO Apr 23, 2021
e728192
Revert "asdf"
RichtXO Apr 23, 2021
839b53c
Revert "Revert "name changed""
RichtXO Apr 23, 2021
fe5403c
Revert "adding url"
RichtXO Apr 23, 2021
b124e3a
Revert "adding url"
RichtXO Apr 23, 2021
a58306f
Revert "changing back"
RichtXO Apr 23, 2021
a9d53a3
Revert "removing spaces"
RichtXO Apr 23, 2021
95df95f
Revert "trying out terosh/lighthouse-ci-action"
RichtXO Apr 23, 2021
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
35 changes: 30 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
RichtXO marked this conversation as resolved.
Show resolved Hide resolved
workflow_dispatch:


jobs:
backend-unit-tests:
name: Run backend unit tests
Expand Down Expand Up @@ -51,19 +52,43 @@ jobs:
run: |
bash scripts/test.sh

test-build:
lighthouse:
name: Lighthouse CI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build production
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 15.x

- name: Build and Run Production
run: |
docker-compose \
-f docker-compose.yml \
-f docker-compose.production.yml \
build
up -d &&
sleep 5

- name: Seed test data
working-directory: rpi_data
run: |
curl --insecure -X POST -H "Content-Type: multipart/form-data" \
-F "isPubliclyVisible=on" -F "file=@$FILE_NAME" $AUTH_ARGS $API_ENDPOINT
env:
FILE_NAME: fall-2021.csv
AUTH_ARGS: ${{ secrets.AUTH_ARGS }}
API_ENDPOINT: https://localhost/api/bulkCourseUpload

- name: run Lighthouse CI
run: |
npm install -g @lhci/cli@0.7.x &&
lhci autorun
env:
LHCI_GITHUB_APP_TOKEN: ${{secrets.LHCI_GITHUB_APP_TOKEN}}

publish-action-status:
needs: [backend-unit-tests, test-build]
needs: [backend-unit-tests, lighthouse]
if: always()
runs-on: ubuntu-latest

Expand All @@ -74,4 +99,4 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: CI
conclusion: ${{ env.WORKFLOW_CONCLUSION }}
conclusion: ${{ env.WORKFLOW_CONCLUSION }}
35 changes: 33 additions & 2 deletions .github/workflows/pr-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,39 @@ on:
workflow_dispatch:

jobs:
wait-checks:
runs-on: ubuntu-latest

steps:
# action doesn't support multiple checks yet so
# use a step for each check
- name: Wait for ci to complete
uses: fountainhead/action-wait-for-check@v1.0.0
id: wait-for-ci
with:
token: ${{ secrets.GITHUB_TOKEN }}
checkName: CI
ref: ${{ github.event.pull_request.head.sha }}

- name: Check if ci was successful
if: steps.wait-for-ci.outputs.conclusion != 'success'
run: exit 1

- name: Wait for codefactor to complete
uses: fountainhead/action-wait-for-check@v1.0.0
id: wait-for-codefactor
with:
token: ${{ secrets.GITHUB_TOKEN }}
checkName: CodeFactor
ref: ${{ github.event.pull_request.head.sha }}

- name: Check if codefactor was successful
if: steps.wait-for-codefactor.outputs.conclusion != 'success'
run: exit 1

temp_deploy:
runs-on: ubuntu-latest
needs: wait-checks
steps:
- uses: actions/checkout@v2
- name: Use Node.js 13.x
Expand Down Expand Up @@ -37,10 +68,10 @@ jobs:
id: provision

- name: Share Link on PR
uses: vinodsai-a/actions-comment-pull-request@master
uses: thollander/actions-comment-pull-request@master
with:
message: |
Deploy Link: ${{ steps.provision.outputs.link }}/
Branch and Build Info: ${{ steps.provision.outputs.link }}:3000/info.txt
Expected Time Ready: ${{ steps.info.outputs.datetime_ready }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30 changes: 30 additions & 0 deletions lighthouserc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module.exports = {
ci: {
collect: {
url: ['https://localhost'],
settings: {
chromeFlags: ['--ignore-certificate-errors'],
// --- comment the formFactor and screenEmulation to test for mobile ---
formFactor: 'desktop',
screenEmulation: {
mobile: false,
width: 1920,
height: 1080,
deviceScaleFactor: 1,
disabled: false,
}
}
},
assert:{
assertions: {
'categories:performance': ['warn', { 'minScore': 0.8 }],
'categories:accessibility': ['warn', { 'minScore': 0.8 }],
'categories:best-practices': ['error', { 'minScore': 1.0 }],
'categories:seo': ['warn', { 'minScore': 1.0 }],
}
},
upload: {
target: 'temporary-public-storage'
}
}
}
2,758 changes: 1,382 additions & 1,376 deletions rpi_data/fall-2021.csv

Large diffs are not rendered by default.

374 changes: 188 additions & 186 deletions rpi_data/summer-2021.csv

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ COPY cert/ /etc/nginx/cert
RUN \
apt-get update --no-install-recommends && \
apt-get install openssl --no-install-recommends -y && \
rm /var/lib/apt/lists/* || true
rm -rf /var/lib/apt/lists/* || true

CMD ["/usr/local/bin/entrypoint.sh"]
CMD ["/usr/local/bin/entrypoint.sh"]
56 changes: 34 additions & 22 deletions src/web/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,14 @@ http {
default_type application/octet-stream;
keepalive_timeout 65;

# Expires map
# Expires map
RichtXO marked this conversation as resolved.
Show resolved Hide resolved
map $sent_http_content_type $expires {
default off;
text/html epoch;
text/css max;
application/javascript max;
~image/ max;
text/css 30d;
application/javascript 30d;
application/json 60m;
}


proxy_cache_path /tmp/micro_cache levels=1:2 keys_zone=micro_cache:100m max_size=100m inactive=3600s;

server{
listen 80;
Expand All @@ -43,8 +41,10 @@ http {
gzip_proxied any;
gzip_vary on;
gzip_comp_level 6;
gzip_buffers 16 8k;

gzip_buffers 16 8k;
gzip_min_length 600;
gzip_types image/jpeg image/bmp image/svg+xml text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript image/x-icon;

ssl_certificate /etc/nginx/cert/${HOST}.crt;
ssl_certificate_key /etc/nginx/cert/${HOST}.key;

Expand All @@ -54,31 +54,33 @@ http {
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA HIGH !RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS";
# disabling unwanted http methods

# Disabling unwanted http methods
if ($request_method !~ ^(DELETE|GET|POST)$ ){
return 405;
}
# prevent clickjack attacks
add_header X-Frame-Options "SAMEORIGIN";
# prevent XSS attacks
add_header X-XSS-Protection "1; mode=block";
# Configuring HSTS
add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains; preload';

# Headers
add_header X-Frame-Options "SAMEORIGIN"; # prevent clickjack attacks
add_header X-XSS-Protection "1; mode=block"; # prevent XSS attacks
add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains; preload' always; # Configuring HSTS
add_header CC-X-Request-ID $request_id;
add_header X-Cache_Status $upstream_cache_status;

# Secure Diffie-Hellman for TLS
ssl_dhparam /etc/nginx/cert/${HOST}.pem;

ssl_session_cache shared:TLS:10m;
ssl_session_timeout 10m;
ssl_buffer_size 4k;

# Set HSTS to 365 days
add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains; preload' always;

# Enable session tickets
ssl_session_tickets on;

# OCSP stapling
ssl_stapling on;
ssl_stapling_verify on;
resolver 1.1.1.1 1.0.0.1 [2606:4700:4700::1111] [2606:4700:4700::1001]; # Cloudflare

resolver 8.8.8.8 8.8.4.4 208.67.222.222 208.67.220.220 valid=60s; # Google and Cisco
resolver_timeout 2s;

# simple secure admin panel, will change later
location ~* ^/admin {
Expand All @@ -96,6 +98,16 @@ http {

# Serve API routes
location /api {
# Micro Cache
proxy_cache micro_cache;
proxy_cache_valid 200 1s;
proxy_cache_use_stale updating;
proxy_cache_background_update on;
proxy_cache_lock on;

proxy_cache_revalidate on;
proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;

proxy_pass http://yacs_api:5000;
client_max_body_size 3M;
}
Expand Down
Loading