Create Lighthouse Audit #38
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: lighthouse-report | |
run-name: Create Lighthouse Audit | |
on: | |
push: | |
branches: | |
- feature/IVYPORTAL-17377-Create-pipeline-to-run-Lighthouse-report | |
pull_request: | |
branches: | |
- master | |
env: # Define reusable environment variables | |
ENGINE_DIR: $GITHUB_WORKSPACE/ivy/engine/nightly | |
ENGINE_URL: https://developer.axonivy.com/permalink/nightly/axonivy-engine.zip | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
name: Build Modules | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Set Up Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '21' | |
- name: Set up Maven | |
uses: stCarolas/setup-maven@v5 | |
with: | |
maven-version: 3.9.8 | |
- name: Export Environment Variables | |
run: | | |
echo "export IVY_JAVA_HOME=$JAVA_HOME" >> $GITHUB_ENV | |
echo "export JAVA_HOME=$JAVA_HOME" >> $GITHUB_ENV | |
echo "export PATH=$JAVA_HOME/bin:$PATH" >> $GITHUB_ENV | |
- name: Set Up and Verify Directories | |
run: | | |
ENGINE_DIR="${GITHUB_WORKSPACE}/ivy/engine/nightly" | |
mkdir -p $ENGINE_DIR | |
sudo chown -R $USER:$USER $ENGINE_DIR | |
ls -la $ENGINE_DIR | |
echo "ENGINE_DIR=$ENGINE_DIR" >> $GITHUB_ENV | |
- name: Download Engine | |
run: | | |
cd $ENGINE_DIR | |
wget $ENGINE_URL -O axonivy-engine.zip | |
unzip -o axonivy-engine.zip -d . | |
rm axonivy-engine.zip | |
ls -la | |
- name: Verify Engine Directory | |
run: | | |
if [ ! -d "$ENGINE_DIR" ]; then | |
echo "Engine directory does not exist" | |
exit 1 | |
fi | |
ls -la $ENGINE_DIR | |
ls -la $ENGINE_DIR/bin || true | |
- name: Start Axon Ivy Engine | |
run: | | |
# Set absolute paths | |
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${PATH}" | |
# Install required packages directly | |
apt-get update && apt-get install -y coreutils | |
# Debug environment | |
echo "Current location: $(pwd)" | |
echo "Engine location: ${ENGINE_DIR}" | |
# Change to engine directory | |
cd "${ENGINE_DIR}/bin" || exit 1 | |
# Make engine executable | |
chmod +x ./AxonIvyEngine | |
# Start engine with full environment | |
nohup ./AxonIvyEngine & | |
./AxonIvyEngine | |
env: | |
IVY_JAVA_HOME: ${{ env.JAVA_HOME }} | |
JAVA_HOME: ${{ env.JAVA_HOME }} | |
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${{ env.JAVA_HOME }}/bin:$PATH | |
- name: Build Portal Modules | |
run: | | |
modules=( | |
"AxonIvyPortal/portal-components" | |
"AxonIvyPortal/portal" | |
"AxonIvyPortal/PortalKitTestHelper" | |
"Showcase/portal-user-examples" | |
"Showcase/portal-developer-examples" | |
"Showcase/InternalSupport" | |
"Showcase/portal-components-examples" | |
"AxonIvyPortal/PortalApp" | |
"Showcase/portal-demo-app" | |
) | |
for module in "${modules[@]}"; do | |
echo "Building $module..." | |
mvn clean install -f $module/pom.xml -Divy.engine.directory=$ENGINE_DIR | |
done | |
- name: Deploy Portal Modules | |
run: | | |
DEPLOYMENT=$ENGINE_DIR/system/demo-applications/demo-portal | |
rm -rf $DEPLOYMENT/* | |
cp Showcase/portal-demo-app/target/*.zip $DEPLOYMENT | |
cp Showcase/portal-developer-examples/target/*.iar $DEPLOYMENT | |
cp Showcase/portal-components-examples/target/*.iar $DEPLOYMENT | |
lighthouse-audit: | |
name: Lighthouse Audit | |
needs: build | |
runs-on: ubuntu-latest | |
env: | |
WAIT_TIME: 60 # Define the wait time in seconds | |
SERVER_URL: http://localhost:8080 # Define the server URL | |
REPORT_PATH: ./lighthouse-report.html # Define the report path | |
steps: | |
- name: Install Lighthouse | |
run: npm install -g lighthouse | |
- name: Wait for Server to Be Ready | |
run: | | |
for ((i=1; i<=${{ env.WAIT_TIME }}; i++)); do | |
if curl -s ${{ env.SERVER_URL }} > /dev/null; then | |
echo "Server is ready" | |
exit 0 | |
fi | |
echo "Waiting for server..." | |
sleep 1 | |
done | |
echo "Server did not start in time" && exit 1 | |
- name: Execute Lighthouse Audit | |
run: lighthouse ${{ env.SERVER_URL }} --output=json --output=html --output-path=${{ env.REPORT_PATH }} | |
- name: Upload Audit Report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: lighthouse-report | |
path: ${{ env.REPORT_PATH }} |