Skip to content

Commit

Permalink
[Issue 441] Fix lighthouse CI and update GitHub workflow (#451)
Browse files Browse the repository at this point in the history
* Fix lighthouse CI and update workflow

* Use startServerReadyPattern

* Add missing gh-pages index.html

* Add startServerReadyTimeout to have clean log
  • Loading branch information
William Welling authored Sep 23, 2022
1 parent 296a238 commit 3c12c07
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 23 deletions.
31 changes: 12 additions & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,36 +27,29 @@ jobs:
cd $GITHUB_WORKSPACE/weaver-ui
npm run publish:local
- name: "Install Chrome Drivers"
run: sudo apt-get install xvfb

- name: "Node Cache"
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-cache-node-${{ hashFiles('**/package.json', '**/package-lock.json') }}
key: ${{ runner.os }}-cache-node-${{ hashFiles('**/package.json') }}

- name: "Node Modules Cache"
uses: actions/cache@v3
with:
path: $GITHUB_WORKSPACE/repo/node_modules
key: ${{ runner.os }}-cache-node_modules-${{ hashFiles('**/package.json', '**/package-lock.json') }}

- name: "Maven Cache"
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-cache-maven-${{ hashFiles('**/pom.xml') }}
key: ${{ runner.os }}-cache-node_modules-${{ hashFiles('**/package.json') }}

- name: "Setup Node"
uses: actions/setup-node@v3
with:
node-version: 16

- name: "Setup Java"
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'adopt'
cache: 'maven'

- name: "Maven Test"
env:
Expand All @@ -78,19 +71,19 @@ jobs:
path-to-file: 'repo/coveralls.json'
coverage-format: raw

# - name: "Lighthouse Report"
# env:
# LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
# run: |
# cd $GITHUB_WORKSPACE/repo
# xvfb-run --auto-servernum npm run test:audit
- name: "Lighthouse Report"
env:
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
run: |
cd $GITHUB_WORKSPACE/repo
xvfb-run --auto-servernum npm run test:audit
- name: "Deploy GH-Pages"
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
uses: JamesIves/[email protected]
with:
github_token: ${{ secrets.github_token }}
branch: gh-pages
folder: repo/target/generated-docs
folder: repo/target/gh-pages
clean: true
single_commit: true
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<a name="readme-top"></a>
[![Build Status][build-badge]][build-status]
[![Coverage Status][coverage-badge]][coverage-status]
[![Performance][performance-badge]][performance-status]
[![Accessibility][accessibility-badge]][accessibility-status]
[![Best Practices][best_practices-badge]][best_practices-status]
[![SEO][seo-badge]][seo-status]
[![Progressive Web App][pwa-badge]][pwa-status]


# Search Aggregation Engine
Expand All @@ -14,7 +19,7 @@

## User Documentation

*CAP* user documentation can be found in [the wiki][user-docs].
*SAGE* user documentation can be found in [the wiki][user-docs].

For more technical users, deployment related configurations are described in the [Deployment Guide][deployment-guide].

Expand Down Expand Up @@ -69,6 +74,16 @@ Copyright © 2022 Texas A&M University Libraries under the [MIT License][license
[build-badge]: https://github.com/TAMULib/SAGE/workflows/Build/badge.svg
[coverage-status]: https://coveralls.io/github/TAMULib/SAGE
[coverage-badge]: https://coveralls.io/repos/github/TAMULib/SAGE/badge.svg
[performance-status]: https://tamulib.github.io/SAGE/audit/#performance
[performance-badge]: https://tamulib.github.io/SAGE/audit/assets/performance.svg
[accessibility-status]: https://tamulib.github.io/SAGE/audit/#accessibility
[accessibility-badge]: https://tamulib.github.io/SAGE/audit/assets/accessibility.svg
[best_practices-status]: https://tamulib.github.io/SAGE/audit/#best-practices
[best_practices-badge]: https://tamulib.github.io/SAGE/audit/assets/best-practices.svg
[seo-status]: https://tamulib.github.io/SAGE/audit/#seo
[seo-badge]: https://tamulib.github.io/SAGE/audit/assets/seo.svg
[pwa-status]: https://tamulib.github.io/SAGE/audit/#pwa
[pwa-badge]: https://tamulib.github.io/SAGE/audit/assets/pwa.svgb/SAGE/badge.svg

[tamu-library]: http://library.tamu.edu
[api-docs]: https://tamulib.github.io/SAGE
Expand Down
4 changes: 3 additions & 1 deletion lighthouserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"collect": {
"numberOfRuns": 1,
"url": ["http://localhost:9000/"],
"startServerCommand": "mvn spring-boot:run"
"startServerCommand": "mvn spring-boot:run",
"startServerReadyPattern": "Started SageApplication",
"startServerReadyTimeout": 90000
},
"assert": {
"assertions": {
Expand Down
1 change: 0 additions & 1 deletion scripts/build-lighthouse-badges.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const https = require('https');
const fs = require('fs-extra');
const glob = require("glob");

const ghPagesPath = `src/main/resources/gh-pages`;
const lighthousePath = `src/main/resources/gh-pages/audit`;
const lighthouseAssetsPath = `${lighthousePath}/assets`;
const lighthouseCiPath = './.lighthouseci';
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/gh-pages/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
audit/
38 changes: 38 additions & 0 deletions src/main/resources/gh-pages/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!doctype html>
<html lang="en" class="no-js">

<head>

<base th:href="${ base + '/'}" />

<title>Sage :: Solr Aggregation Engine</title>

<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

<meta name="description" content="Fedora User Interface" />

<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">

<link rel="stylesheet" th:href="${@environment.getProperty('app.url')+'/wro/app.css'}" />

</head>

<body>
<main>
<tl-header page-title="SAGE Documentation"></tl-header>
<div class="jumbotron jumbotron-fluid">
<div class="container">
<h1 class="display-4">SAGE</h1>
<p class="lead">Choose your option:
<a class="btn btn-primary ml-2" href="/SAGE/audit/">Audit</a>
<a class="btn btn-success ml-2" href="/SAGE/api-docs/">Api Docs</a>
</p>
</div>
</div>
</main>
<tl-footer></tl-footer>
<script src="https://api.library.tamu.edu/tl-components/latest/tl-components.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion src/main/resources/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
<script src="app.bundle.js"></script>

<!-- CDN tl-component -->
<script src="https://labs.library.tamu.edu/tl-components/latest/tl-components.js"></script>
<script src="https://api.library.tamu.edu/tl-components/latest/tl-components.js"></script>

</body>

Expand Down

0 comments on commit 3c12c07

Please sign in to comment.