Skip to content

Replace CRA with Vite #221

Replace CRA with Vite

Replace CRA with Vite #221

Workflow file for this run

name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v4
- name: Set up NodeJS
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run linters
run: npm run lint
- name: Run type check
run: npm run typecheck
- name: Run tests
run: npm test -- --run
- name: Build the app
run: npm run build
- name: Run Lighthouse CI
id: lhci
# Unfortunately vite requires the index.html to be at the root.
# This means that the public and index.html are separated, which
# affects the building process. Lighthouse also only allows for
# one staticDir. Therefore we need to create a sym link for it.
# https://stackoverflow.com/questions/76590642/how-to-configure-vite-with-index-html-in-public-folder
run: |
npm install -g @lhci/[email protected]
ln -s $(pwd)/index.html $(pwd)/public/index.html
lhci_output=$(lhci autorun)
echo "$lhci_output"
url=$(echo "$lhci_output" | grep -o "https://.\+")
echo "Found storage url: <$url>"
echo "report_url=$url" >> $GITHUB_OUTPUT
- name: Save data needed by the Lighthouse workflow
if: github.event_name == 'pull_request'
run: |
mkdir -p ./lighthouse
echo "${{ github.event.number }}" >> ./lighthouse/pull-request-id
echo "${{ steps.lhci.outputs.report_url }}" >> ./lighthouse/report-url
- uses: actions/upload-artifact@v3
with:
name: lighthouse
path: lighthouse/