Skip to content

refactor: Components #61

refactor: Components

refactor: Components #61

name: '[DEPLOYMENT] @memvo/web (Production)'
on:
push:
branches:
- main
paths:
- .github/workflows/apps-web-deployment-production.yml
- .lighthouse/**
- apps/web/**
- packages/**/src/lib/**/*.svelte
- packages/**/src/lib/**/*.js
- packages/**/src/lib/**/*.css
- packages/**/package.json
- packages/i18n/translations/**/*.json
- pnpm-lock.yaml
- turbo.json
jobs:
build:
name: Build Packages & Apps
runs-on: ubuntu-latest
steps:
- name: Checkout commit
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
check-latest: true
node-version: 20
- name: Install pnpm
uses: pnpm/action-setup@v3
id: pnpm-install
with:
version: 9
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Build apps & packages
run: pnpm build
- name: Cache build artifacts
uses: actions/cache@v4
with:
path: |
**/**/.svelte-kit/
**/**/dist/
key: ${{ runner.os }}-build-${{ github.sha }}
restore-keys: |
${{ runner.os }}-build-${{ github.sha }}-
integration-tests:
name: Run Integration Tests
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout commit
uses: actions/checkout@v4
- name: Restore build artifacts
uses: actions/cache@v4
with:
path: |
**/**/.svelte-kit/
**/**/dist/
key: ${{ runner.os }}-build-${{ github.sha }}
restore-keys: |
${{ runner.os }}-build-${{ github.sha }}-
- name: Setup Node.js
uses: actions/setup-node@v4
with:
check-latest: true
node-version: 20
- name: Install pnpm
uses: pnpm/action-setup@v3
id: pnpm-install
with:
version: 9
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Install Playwright dependencies
run: cd apps/web && pnpm exec playwright install
- name: Run integration tests
run: cd apps/web && pnpm test:integration
unit-tests:
name: Run Unit Tests
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout commit
uses: actions/checkout@v4
- name: Restore build artifacts
uses: actions/cache@v4
with:
path: |
**/**/.svelte-kit/
**/**/dist/
key: ${{ runner.os }}-build-${{ github.sha }}
restore-keys: |
${{ runner.os }}-build-${{ github.sha }}-
- name: Setup Node.js
uses: actions/setup-node@v4
with:
check-latest: true
node-version: 20
- name: Install pnpm
uses: pnpm/action-setup@v3
id: pnpm-install
with:
version: 9
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Run unit tests
run: cd apps/web && pnpm test:unit
deployment:
name: Deploy to Cloudflare Pages
runs-on: ubuntu-latest
needs: [integration-tests, unit-tests]
steps:
- name: Checkout commit
uses: actions/checkout@v4
- name: Restore build artifacts
uses: actions/cache@v4
with:
path: |
**/**/.svelte-kit/
**/**/dist/
key: ${{ runner.os }}-build-${{ github.sha }}
restore-keys: |
${{ runner.os }}-build-${{ github.sha }}-
- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
accountId: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
apiToken: ${{ secrets.CLOUDFLARE_PAGES_ACCESS_TOKEN }}
projectName: memvo
directory: apps/web/.svelte-kit/cloudflare
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
wranglerVersion: '3'
lighthouse-homepage:
name: Audit Homepage with Lighthouse
env:
APP_DOMAIN: memvo.pages.dev
runs-on: ubuntu-latest
needs: deployment
steps:
- name: Checkout
uses: actions/checkout@v3
# - name: Setup CF Auth Headers for Lighthouse
# run: |
# sed -i "s/{{CLIENT_ID}}/${{ secrets.CF_ACCESS_CLIENT_ID }}/g" ${{ github.workspace }}/.lighthouse/lighthouserc.json
# sed -i "s/{{CLIENT_SECRET}}/${{ secrets.CF_ACCESS_CLIENT_SECRET }}/g" ${{ github.workspace }}/.lighthouse/lighthouserc.json
# - name: Generate cache entries for audit
# run: |
# curl "https://$APP_DOMAIN/pl" -H "CF-Access-Client-Id: ${{ secrets.CF_ACCESS_CLIENT_ID }}" -H "CF-Access-Client-Secret: ${{ secrets.CF_ACCESS_CLIENT_SECRET }}"
- name: Audit URLs
uses: treosh/lighthouse-ci-action@v12
with:
urls: |
"https://$APP_DOMAIN"
budgetPath: ${{ github.workspace }}/.lighthouse/budget/homepage.json
configPath: ${{ github.workspace }}/.lighthouse/lighthouserc.json
uploadArtifacts: false
temporaryPublicStorage: true