From b83a0e38c470f8f0dde93b0f65e543a9d93d1cb6 Mon Sep 17 00:00:00 2001 From: George <31376482+george-gca@users.noreply.github.com> Date: Tue, 23 Jan 2024 10:35:13 -0300 Subject: [PATCH] Added Lighthouse test GitHub action (#2084) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added support for Lighthouse test as a GitHub action, and it appears like [this](https://github.com/george-gca/multi-language-al-folio?tab=readme-ov-file#lighthouse-pagespeed-insights). The only thing missing is for @alshedivat to create a [repository secret](https://github.com/MyActionWay/lighthouse-badger-workflows#lighthouse-badger-easyyml) named `LIGHTHOUSE_BADGER_TOKEN` with the information needed. --------- Signed-off-by: George Araújo --- .github/workflows/lighthouse-badger.yml | 63 +++++++++++++++++++++++++ README.md | 14 +++++- 2 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/lighthouse-badger.yml diff --git a/.github/workflows/lighthouse-badger.yml b/.github/workflows/lighthouse-badger.yml new file mode 100644 index 0000000..7681910 --- /dev/null +++ b/.github/workflows/lighthouse-badger.yml @@ -0,0 +1,63 @@ +# Lighthouse-Badger-Easy | GitHub Action Workflow +# +# Description: Generates, adds & updates manually/automatically Lighthouse badges & reports from one/multiple input URL(s) to the current repository & main branch with minimal settings +# Author: Sitdisch +# Source: https://github.com/myactionway/lighthouse-badger-workflows +# License: MIT +# Copyright (c) 2021 Sitdisch + +name: "Lighthouse Badger" + +######################################################################## +# DEFINE YOUR INPUTS AND TRIGGERS IN THE FOLLOWING +######################################################################## + +# INPUTS as environmental variables (env) for not manually triggered workflows +env: + URLS: https://alshedivat.github.io/al-folio/ + TOKEN_NAME: LIGHTHOUSE_BADGER_TOKEN + # If any of the following env is blank, a default value is used instead + REPO_BRANCH: "${{ github.repository }} master" # target repository & branch e.g. 'dummy/mytargetrepo main' + MOBILE_LIGHTHOUSE_PARAMS: "--only-categories=performance,accessibility,best-practices,seo --throttling.cpuSlowdownMultiplier=2" + DESKTOP_LIGHTHOUSE_PARAMS: "--only-categories=performance,accessibility,best-practices,seo --preset=desktop --throttling.cpuSlowdownMultiplier=1" + +# TRIGGERS +on: + page_build: + # schedule: # Check your schedule here => https://crontab.guru/ + # - cron: '55 23 * * 0' # e.g. every Sunday at 23:55 + # + # THAT'S IT; YOU'RE DONE; + workflow_dispatch: + +######################################################################## +# THAT'S IT; YOU DON'T HAVE TO DEFINE ANYTHING IN THE FOLLOWING +######################################################################## + +jobs: + lighthouse-badger-easy: + runs-on: ubuntu-latest + timeout-minutes: 8 + steps: + - name: Preparatory Tasks + run: | + REPOSITORY=`expr "${{ env.REPO_BRANCH }}" : "\([^ ]*\)"` + BRANCH=`expr "${{ env.REPO_BRANCH }}" : ".* \([^ ]*\)"` + echo "REPOSITORY=$REPOSITORY" >> $GITHUB_ENV + echo "BRANCH=$BRANCH" >> $GITHUB_ENV + env: + REPO_BRANCH: ${{ env.REPO_BRANCH }} + - uses: actions/checkout@v3 + with: + repository: ${{ env.REPOSITORY }} + token: ${{ secrets[github.event.inputs.token_name] || secrets[env.TOKEN_NAME] }} + ref: ${{ env.BRANCH }} + - uses: actions/checkout@v3 + with: + repository: "myactionway/lighthouse-badges" + path: temp_lighthouse_badges_nested + - uses: myactionway/lighthouse-badger-action@v2.2 + with: + urls: ${{ env.URLS }} + mobile_lighthouse_params: ${{ env.MOBILE_LIGHTHOUSE_PARAMS }} + desktop_lighthouse_params: ${{ env.DESKTOP_LIGHTHOUSE_PARAMS }} diff --git a/README.md b/README.md index 94996b8..ea76dad 100644 --- a/README.md +++ b/README.md @@ -175,13 +175,25 @@ Workshop on Diffusion Models (NeurIPS: