diff --git a/.github/.lighthouserc.yml b/.github/.lighthouserc.yml new file mode 100644 index 00000000000..5a4b315c8de --- /dev/null +++ b/.github/.lighthouserc.yml @@ -0,0 +1,11 @@ +ci: + collect: + url: + - http://127.0.0.1:8443/ + startServerCommand: "just p frontend start" + startServerReadyPattern: "Listening on http" + upload: + # temporary target until either temporary-public-storage is back + # (https://github.com/GoogleChrome/lighthouse-ci/issues/1072) + # or we spin up our own Openverse lhci server + target: "filesystem" diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 6b091745e8e..883492f4da8 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -1014,6 +1014,43 @@ jobs: issue-number: ${{ github.event.pull_request.number }} body: ${{ steps.help-body.outputs.help_body }} + lighthouse-ci: + name: Collect Lighthouse CI results + runs-on: ubuntu-latest + needs: + - nuxt-build + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup CI env + uses: ./.github/actions/setup-env + with: + setup_python: false + install_recipe: node-install + + - name: Run build + run: just frontend/run build + env: + DEPLOYMENT_ENV: production + NODE_ENV: production + + - name: Run Lighthouse CI + id: lhci-autorun + # Lighthouse CI runs the webserver for us, as configured in lighthouserc + env: + NODE_ENV: production + run: | + pnpm --package=@lhci/cli dlx lhci autorun --config .github/.lighthouserc.yml + + - name: Display Report + if: always() + uses: jackywithawhitedog/lighthouse-viewer-action@v2 + with: + resultsPath: .lighthouseci + lighthouseOutcome: ${{ steps.lhci-autorun.outcome }} + ################# # Documentation # ################# diff --git a/justfile b/justfile index 037ef385ab9..22a44214172 100644 --- a/justfile +++ b/justfile @@ -350,6 +350,7 @@ f: # alias for `pnpm --filter {package} run {script}` [positional-arguments] p package script *args: + #!/usr/bin/env bash pnpm --filter {{ package }} run {{ script }} "${@:3}" # Run eslint with --fix and default file selection enabled; used to enable easy file overriding whilst retaining the defaults when running --all-files