Skip to content

add eslint and fix code issues #870

add eslint and fix code issues

add eslint and fix code issues #870

Workflow file for this run

name: Build and Deploy
on: ['push', 'pull_request']
jobs:
build:
runs-on: ubuntu-latest
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
strategy:
matrix:
node-version: [16]
react-version: [17, 18]
steps:
- name: Branch Name
run: echo Running on branch ${GITHUB_REF##*/}
- name: Begin CI...
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Cache pnpm modules
uses: actions/cache@v2
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-node${{ matrix.node-version }}-react${{ matrix.react-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
- name: Setup pnpm
uses: pnpm/[email protected]
with:
version: 7
run_install: true
- name: Install React ${{ matrix.react-version }} at Root
if: matrix.react-version != 18
run: pnpm -w -D add react@^${{ matrix.react-version }} react-dom@^${{ matrix.react-version }}
- name: Install React ${{ matrix.react-version }} at Examples
if: matrix.react-version != 18
run: pnpm --filter="./examples/**" --filter="react-showroom-docs" add react@^${{ matrix.react-version }} react-dom@^${{ matrix.react-version }} @testing-library/react@^12 @testing-library/user-event@^13
- name: Install Playwright
run: npx playwright install --with-deps
- name: Test
run: pnpm run test
- name: Build
run: pnpm run build
- name: Run Playwright tests
run: pnpm run test:e2e
- uses: actions/upload-artifact@v3
if: failure()
with:
name: playwright-test-result ${{ matrix.node-version }} ${{ matrix.react-version }}
path: |
examples/subpath-example/test-results/
examples/subpath-example/trace.zip
examples/react-example/test-results/
examples/react-example/trace.zip
if-no-files-found: ignore
retention-days: 2
- name: Deploy Docs to Netlify
uses: nwtgck/[email protected]
if: matrix.react-version == 18
with:
publish-dir: docs/showroom
production-deploy: ${{ github.ref == 'refs/heads/main'}}
production-branch: main
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: 'Deploy from GitHub Actions'
github-deployment-environment: Docs
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
- name: Deploy SSR Example to Netlify
uses: nwtgck/[email protected]
if: matrix.react-version == 18
with:
publish-dir: examples/react-example/showroom
production-deploy: ${{ github.ref == 'refs/heads/main'}}
production-branch: main
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: 'Deploy from GitHub Actions'
github-deployment-environment: Prerender Example
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SSR_EXAMPLE_SITE_ID }}
- name: Deploy SPA Example to Netlify
uses: nwtgck/[email protected]
if: matrix.react-version == 18
with:
publish-dir: examples/react-example/showroom-spa
production-deploy: ${{ github.ref == 'refs/heads/main'}}
production-branch: main
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: 'Deploy from GitHub Actions'
github-deployment-environment: Non-Prerender Example
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SPA_EXAMPLE_SITE_ID }}
- name: Deploy Subpath Example to Netlify
uses: nwtgck/[email protected]
if: matrix.react-version == 18
with:
publish-dir: examples/subpath-example/public
production-deploy: ${{ github.ref == 'refs/heads/main'}}
production-branch: main
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: 'Deploy from GitHub Actions'
github-deployment-environment: Subpath Example
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SUBPATH_EXAMPLE_SITE_ID }}
- name: Deploy Client Only Example to Netlify
uses: nwtgck/[email protected]
if: matrix.react-version == 18
with:
publish-dir: examples/client-only-example/showroom
production-deploy: ${{ github.ref == 'refs/heads/main'}}
production-branch: main
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: 'Deploy from GitHub Actions'
github-deployment-environment: Client Only Example
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_CLIENT_ONLY_SITE_ID }}
- name: Deploy CRA 5 Only Example to Netlify
uses: nwtgck/[email protected]
if: matrix.react-version == 18
with:
publish-dir: examples/cra-example/showroom
production-deploy: ${{ github.ref == 'refs/heads/main'}}
production-branch: main
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: 'Deploy from GitHub Actions'
github-deployment-environment: CRA 5 Example
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_CRA5_EXAMPLE_SITE_ID }}