Compare commits

..

5 commits

Author SHA1 Message Date
a4e45ab2b8
Unlighthouse rework with docker
All checks were successful
/ astro-check (push) Successful in 14s
/ get-version (push) Successful in 2s
/ check-tag (push) Successful in 2s
/ checking (push) Successful in 13s
/ build-site (push) Successful in 1m1s
/ run-unlighthouse (push) Successful in 0s
/ create-release (push) Successful in 6s
/ auto-deploy-dockge (push) Successful in 5s
2024-11-01 16:34:51 +01:00
a8815648cb
Added font preloading
All checks were successful
/ astro-check (push) Successful in 12s
/ get-version (push) Successful in 3s
/ check-tag (push) Successful in 3s
/ create-release (push) Successful in 8s
/ checking (push) Successful in 13s
/ build-site (push) Successful in 1m8s
/ auto-deploy-dockge (push) Successful in 9s
/ deploy-unlighthouse-files (push) Successful in 1m8s
/ unlighthouse (push) Successful in 52s
/ deploy-unlighthouse-site (push) Successful in 5s
2024-10-02 00:01:21 +02:00
747b1d78db
Updated dockge version
All checks were successful
/ astro-check (push) Successful in 13s
/ get-version (push) Successful in 3s
/ deploy-unlighthouse-files (push) Successful in 1m26s
/ unlighthouse (push) Successful in 47s
/ deploy-unlighthouse-site (push) Successful in 2m45s
2024-10-01 23:39:31 +02:00
d982c5f57b
Bumped version
All checks were successful
/ get-version (push) Successful in 3s
/ astro-check (push) Successful in 12s
/ create-release (push) Successful in 7s
/ check-tag (push) Successful in 3s
/ checking (push) Successful in 13s
/ build-site (push) Successful in 1m8s
/ auto-deploy-dockge (push) Successful in 13s
2024-09-28 15:41:57 +02:00
c609634b98
Updated flows with redeploys
All checks were successful
/ get-version (push) Successful in 3s
/ astro-check (push) Successful in 13s
2024-09-28 15:41:14 +02:00
8 changed files with 137 additions and 70 deletions

View file

@ -69,7 +69,7 @@ jobs:
needs: [ build-site ] needs: [ build-site ]
if: success() if: success()
runs-on: docker runs-on: docker
container: forgejo.neshweb.net/firq/dockge-cli:0.1.1-c.2 container: forgejo.neshweb.net/firq/dockge-cli:0.1.2
steps: steps:
- name: Configure Dockge CLI - name: Configure Dockge CLI
run: | run: |
@ -80,3 +80,18 @@ jobs:
dockge status fgo-ta-com-preview dockge status fgo-ta-com-preview
dockge update fgo-ta-com-preview dockge update fgo-ta-com-preview
dockge status fgo-ta-com-preview dockge status fgo-ta-com-preview
run-unlighthouse:
needs: [ build-site ]
if: success()
runs-on: docker
steps:
- name: Launch workflow
run: |
payload="{\"ref\": \"${GITHUB_REF_NAME}\", \"inputs\": { \"containertag\": \"${GITHUB_REF_NAME}\" }}"
curl -X "POST" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: token ${GITHUB_TOKEN}" \
-d "${payload}" \
"${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/actions/workflows/unlighthouse.yml/dispatches" -v

View file

@ -63,3 +63,19 @@ jobs:
release-dir: release release-dir: release
token: ${{ secrets.FORGEJO_TOKEN }} token: ${{ secrets.FORGEJO_TOKEN }}
tag: ${{ github.ref_name }} tag: ${{ github.ref_name }}
auto-deploy-dockge:
needs: [ build-site ]
if: success()
runs-on: docker
container: forgejo.neshweb.net/firq/dockge-cli:0.1.2
steps:
- name: Configure Dockge CLI
run: |
dockge host '${{ vars.DOCKGE_HOST }}'
dockge login --user '${{ secrets.DOCKGE_USER }}' --password '${{ secrets.DOCKGE_CREDENTIAL }}'
- name: Check status and redeploy
run: |
dockge status fgo-ta-com
dockge update fgo-ta-com
dockge status fgo-ta-com

View file

@ -1,17 +1,36 @@
name: Run unlighthouse-tests [Downstream pipeline]
run-name: Run unlighthouse-tests [Downstream pipeline] for version ${{ inputs.containertag }}
on: on:
push: workflow_dispatch:
tags: inputs:
- '[0-9]+\.[0-9]+\.[0-9]+-ulh\.[0-9]+' containertag:
description: "Tag of the container to test"
default: "preview"
type: "string"
jobs: jobs:
unlighthouse: unlighthouse:
runs-on: docker runs-on: docker
container: forgejo.neshweb.net/ci-docker-images/unlighthouse:0.2.1 container:
image: forgejo.neshweb.net/ci-docker-images/unlighthouse:0.3.0
services:
website:
image: forgejo.neshweb.net/firq/fgo-ta-com-website:${{ inputs.containertag }}
options: >-
--workdir /
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: https://code.forgejo.org/actions/checkout@v3 uses: https://code.forgejo.org/actions/checkout@v3
- name: Check availability
run: |
while [ "$(curl -o /dev/null -s -w '%{http_code}' http://localhost:8081/)" -ne 200 ];
do echo "Waiting...";
sleep 5;
done;
- name: Run unlighthouse - name: Run unlighthouse
run: unlighthouse-ci --site "https://preview.fgo-ta.com/" --disable-dynamic-sampling run: unlighthouse-ci --site "http://localhost:8081/"
- name: Replace URLs
run: find ./unlighthouse-reports -type f | xargs sed -i "s|http://localhost:8081|https://preview.fgo-ta.com|g";
- name: Prepare artifacts - name: Prepare artifacts
run: cp serve.json unlighthouse-reports run: cp serve.json unlighthouse-reports
- name: Upload reports - name: Upload reports
@ -19,79 +38,54 @@ jobs:
with: with:
name: unlighthouse-reports name: unlighthouse-reports
path: unlighthouse-reports/ path: unlighthouse-reports/
- name: Upload Dockerfile
uses: actions/upload-artifact@v3
with:
name: dockerfile
path: Dockerfile.reports
deploy-unlighthouse-files: build-site:
needs: [ unlighthouse ] needs: [ unlighthouse ]
if: success() if: success()
runs-on: docker runs-on: dind
env:
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
steps: steps:
- name: Install and update ssh + rsync - name: Downloading static site artifacts
run: | uses: actions/download-artifact@v3
which rsync || ( apt update -y && apt install rsync -y) with:
which ssh-agent || ( apt update -y && apt install openssh-client -y) name: dockerfile
- name: Downloading static site artifacts - name: Downloading static site artifacts
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
with: with:
name: unlighthouse-reports name: unlighthouse-reports
path: public path: reports
- name: Install SSH Key - name: Set up Docker Buildx
uses: https://github.com/shimataro/ssh-key-action@v2 uses: docker/setup-buildx-action@v3
- name: Log into Docker Package Registry
uses: docker/login-action@v3
with: with:
key: ${{ secrets.SSH_PRIVATE_KEY }} registry: forgejo.neshweb.net
known_hosts: unnecessary username: ${{ secrets.FORGEJO_USERNAME }}
- name: Adding Known Hosts password: ${{ secrets.FORGEJO_TOKEN }}
run: ssh-keyscan -H ${{ secrets.DEPLOY_HOST }} >> ~/.ssh/known_hosts - name: Build and push to Docker Package Registry
- name: Stop screen session, delete old files uses: docker/build-push-action@v5
uses: https://github.com/appleboy/ssh-action@master
with: with:
host: ${{ env.DEPLOY_HOST }} context: .
username: ${{ env.DEPLOY_USER }} file: Dockerfile.reports
key: ${{ secrets.SSH_PRIVATE_KEY }} push: true
script: | tags: forgejo.neshweb.net/firq/fgo-ta-com-website-unlighthouse:latest
screen -X -S fgo_ta_com-unlighthouse kill
rm -r -f fgo_ta_com/unlighthouse/*
- name: Copy files using rsync
run: rsync -az --stats public/* ${{ env.DEPLOY_USER }}@${{ env.DEPLOY_HOST }}:~/fgo_ta_com/unlighthouse
- name: Check files on deploy target
uses: https://github.com/appleboy/ssh-action@master
with:
host: ${{ env.DEPLOY_HOST }}
username: ${{ env.DEPLOY_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
cd fgo_ta_com
find unlighthouse -maxdepth 1 -printf "%p\n"
deploy-unlighthouse-site: auto-deploy-dockge:
needs: [ deploy-unlighthouse-files ] needs: [ build-site ]
if: success() if: success()
runs-on: docker runs-on: docker
env: container: forgejo.neshweb.net/firq/dockge-cli:0.1.2
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
steps: steps:
- name: Install and update ssh + rsync - name: Configure Dockge CLI
run: | run: |
which rsync || ( apt update -y && apt install rsync -y) dockge host '${{ vars.DOCKGE_HOST }}'
which ssh-agent || ( apt update -y && apt install openssh-client -y) dockge login --user '${{ secrets.DOCKGE_USER }}' --password '${{ secrets.DOCKGE_CREDENTIAL }}'
- name: Install SSH Key - name: Check status and redeploy
uses: https://github.com/shimataro/ssh-key-action@v2 run: |
with: dockge status fgo-ta-com-unlighthouse
key: ${{ secrets.SSH_PRIVATE_KEY }} dockge update fgo-ta-com-unlighthouse
known_hosts: unnecessary dockge status fgo-ta-com-unlighthouse
- name: Adding Known Hosts
run: ssh-keyscan -H ${{ secrets.DEPLOY_HOST }} >> ~/.ssh/known_hosts
- name: Start new screen session
uses: https://github.com/appleboy/ssh-action@master
with:
host: ${{ env.DEPLOY_HOST }}
username: ${{ env.DEPLOY_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
PATH="$HOME/.local/bin:$PATH"
screen -ls | grep 'fgo_ta_com-unlighthouse' | awk '{print $1}' | xargs -I % -t screen -X -S % quit
cd fgo_ta_com
screen -S fgo_ta_com-unlighthouse -dm serve unlighthouse/ -p ${{ secrets.UNLIGHTHOUSE_DEPLOY_PORT }}

6
Dockerfile.reports Normal file
View file

@ -0,0 +1,6 @@
FROM forgejo.neshweb.net/ci-docker-images/website-serve:2 AS runtime
ADD reports /public
EXPOSE 8081
CMD serve public/ -p 8081

View file

@ -1,7 +1,7 @@
{ {
"name": "fgo-ta-com-website", "name": "fgo-ta-com-website",
"type": "module", "type": "module",
"version": "0.2.2-pre.19", "version": "0.2.2-pre.22",
"scripts": { "scripts": {
"dev": "astro dev", "dev": "astro dev",
"start": "astro dev", "start": "astro dev",

View file

@ -12,6 +12,15 @@
} }
] ]
}, },
{
"source": "**/*.woff2",
"headers": [
{
"key": "Cache-Control",
"value": "no-cache"
}
]
},
{ {
"source": "404.html", "source": "404.html",
"headers": [ "headers": [

View file

@ -9,6 +9,9 @@ import databasestar from 'iconoir/icons/database-star.svg'
import mail from 'iconoir/icons/mail.svg' import mail from 'iconoir/icons/mail.svg'
import type { IconsLookup } from '../types/generic' import type { IconsLookup } from '../types/generic'
import workSans800 from '@fontsource/work-sans/files/work-sans-latin-800-normal.woff2?url';
import workSans600 from '@fontsource/work-sans/files/work-sans-latin-600-normal.woff2?url';
export interface Props { export interface Props {
title: string title: string
currentpage: string currentpage: string
@ -61,6 +64,8 @@ const mapped_navdata = navdata.map((item) => ({
<!-- Disable DarkReader, as site is already in dark mode --> <!-- Disable DarkReader, as site is already in dark mode -->
<meta name="darkreader-lock" content="this site only has darkmode"> <meta name="darkreader-lock" content="this site only has darkmode">
<!-- Links --> <!-- Links -->
<link rel="preload" as="font" type="font/woff2" href={workSans600} crossorigin="anonymous" />
<link rel="preload" as="font" type="font/woff2" href={workSans800} crossorigin="anonymous" />
<link rel="icon" type="image/ico" href="/favicon.ico" /> <link rel="icon" type="image/ico" href="/favicon.ico" />
<link rel="sitemap" href="/sitemap-index.xml" /> <link rel="sitemap" href="/sitemap-index.xml" />
<link href="https://mastodon.neshweb.net/@Firq" rel="me" /> <link href="https://mastodon.neshweb.net/@Firq" rel="me" />

View file

@ -1,10 +1,32 @@
export default { export default {
lighthouseOptions: {
throttlingMethod: "devtools",
throttling: {
cpuSlowdownMultiplier: 4,
requestLatencyMs: 150,
downloadThroughputKbps: 1638.4,
uploadThroughputKbps: 1638.4,
},
screenEmulation: {
width: 412,
height: 823,
deviceScaleFactor: 1.75,
}
},
puppeteerOptions: { puppeteerOptions: {
args: ["--no-sandbox", "--disable-setuid-sandbox"], args: [
"--no-sandbox",
"--disable-setuid-sandbox"
],
}, },
ci: { ci: {
budget: 50, budget: 50,
buildStatic: true buildStatic: true,
},
scanner: {
sitemap: true,
dynamicSampling: false,
samples: 3,
}, },
outputPath: "unlighthouse-reports", outputPath: "unlighthouse-reports",
} }