wmr/.github/workflows/main.yml
2021-06-03 18:32:12 -05:00

78 lines
2.3 KiB
YAML

name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
changes:
runs-on: ubuntu-latest
outputs:
wmr: ${{ steps.filter.outputs.wmr }}
preact-iso: ${{ steps.filter.outputs.preact-iso }}
steps:
- uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
wmr:
- 'packages/wmr/**'
- 'examples/demo/**'
preact-iso:
- 'packages/preact-iso/**'
build:
needs: changes
runs-on: ubuntu-latest
strategy:
matrix:
# Change the condition for ESM Dist Test below when changing this.
node-version: [12.18, 14.x]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install
if: ${{ needs.changes.outputs.wmr == 'true' || needs.changes.outputs.preact-iso == 'true' }}
run: yarn --frozen-lockfile
- name: Build
if: ${{ needs.changes.outputs.wmr == 'true' }}
run: yarn wmr build
- name: Test wmr
if: ${{ needs.changes.outputs.wmr == 'true' }}
run: yarn eslint packages/wmr && yarn wmr test
- name: Test wmr (production build)
if: ${{ needs.changes.outputs.wmr == 'true' }}
run: yarn wmr test-prod
- name: Test preact-iso
if: ${{ needs.changes.outputs.preact-iso == 'true' }}
run: yarn eslint packages/preact-iso && yarn iso test
lhci:
needs: changes
if: ${{ needs.changes.outputs.wmr == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- name: Prepare LHCI
run: npm install -g @lhci/cli@0.4.x
- name: Install
run: yarn --frozen-lockfile
- name: Build
run: yarn ci
- name: LHCI
run: lhci autorun --upload.target=temporary-public-storage --collect.url="http://localhost:8080" --collect.startServerCommand="yarn workspace @examples/demo serve" --collect.startServerReadyPattern="server running at" --upload.githubAppToken=${{ secrets.LHCI_GITHUB_APP_TOKEN }}