name: CI on: push: branches: - next pull_request: permissions: contents: read # to fetch code (actions/checkout) jobs: unit-test: runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest] node_version: [14, 16, 18] include: - os: macos-latest node_version: 16 - os: macos-latest node_version: 18 - os: windows-latest node_version: 16 - os: windows-latest node_version: 18 fail-fast: false timeout-minutes: 10 name: 'Build & Unit Test: node-${{ matrix.node_version }}, ${{ matrix.os }}' steps: - name: Checkout uses: actions/checkout@v3 with: # Required for docs/versions tests fetch-depth: 0 - name: Install pnpm (node 14, pnpm 7) if: matrix.node_version == 14 uses: pnpm/action-setup@v2.2.4 with: version: 7 - name: Install pnpm if: matrix.node_version != 14 uses: pnpm/action-setup@v2.2.4 - name: Set node version to ${{ matrix.node_version }} uses: actions/setup-node@v3 with: node-version: ${{ matrix.node_version }} cache: 'pnpm' - name: Install deps run: pnpm install env: CYPRESS_INSTALL_BINARY: 0 - name: Build run: pnpm run build - name: Test run: pnpm run test timezone-test: runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest] node_version: [18] fail-fast: false env: LANG: zh_SG.UTF-8 TZ: Asia/Singapore timeout-minutes: 10 name: 'Timezone Test: node-${{ matrix.node_version }}, ${{ matrix.os }}' steps: - name: Set system LANG=zh_SG.UTF-8 run: | sudo locale-gen zh_SG.UTF-8 sudo update-locale LANG=zh_SG.UTF-8 - name: Check date run: date - name: Checkout uses: actions/checkout@v3 with: # Required for docs/versions tests fetch-depth: 0 - name: Install pnpm uses: pnpm/action-setup@v2.2.4 with: version: 7 - name: Set node version to ${{ matrix.node_version }} uses: actions/setup-node@v3 with: node-version: ${{ matrix.node_version }} cache: 'pnpm' - name: Install deps run: pnpm install env: CYPRESS_INSTALL_BINARY: 0 - name: Build run: pnpm run build - name: Test run: pnpm run test e2e-test: runs-on: ubuntu-latest container: cypress/browsers:node18.12.0-chrome107 timeout-minutes: 10 name: 'E2E Doc Test: node-18, ubuntu-latest' steps: - name: Checkout uses: actions/checkout@v3 - name: Install pnpm uses: pnpm/action-setup@v2.2.4 with: version: 7 - name: Install deps run: pnpm install - name: Build docs run: pnpm run docs:build:ci - id: e2e name: Run e2e run: pnpm run docs:test:e2e:run lint: runs-on: ubuntu-latest timeout-minutes: 10 name: 'Lint: node-18, ubuntu-latest' steps: - name: Checkout uses: actions/checkout@v3 with: fetch-depth: 0 - name: Install pnpm uses: pnpm/action-setup@v2.2.4 with: version: 7 - name: Set node version to 18 uses: actions/setup-node@v3 with: node-version: 18 cache: 'pnpm' - name: Install deps run: pnpm install env: CYPRESS_INSTALL_BINARY: 0 - name: Lint run: pnpm run lint - name: Check formatting run: pnpm prettier --check . ts-check-scripts: runs-on: ubuntu-latest timeout-minutes: 10 name: 'TS-Check Scripts: node-18, ubuntu-latest' steps: - name: Checkout uses: actions/checkout@v3 with: fetch-depth: 0 - name: Install pnpm uses: pnpm/action-setup@v2.2.4 with: version: 7 - name: Set node version to 18 uses: actions/setup-node@v3 with: node-version: 18 cache: 'pnpm' - name: Install deps run: pnpm install env: CYPRESS_INSTALL_BINARY: 0 - name: Check scripts run: pnpm run ts-check:scripts ts-check-tests: runs-on: ubuntu-latest timeout-minutes: 10 name: 'TS-Check Tests: node-18, ubuntu-latest' steps: - name: Checkout uses: actions/checkout@v3 with: fetch-depth: 0 - name: Install pnpm uses: pnpm/action-setup@v2.2.4 with: version: 7 - name: Set node version to 18 uses: actions/setup-node@v3 with: node-version: 18 cache: 'pnpm' - name: Install deps run: pnpm install env: CYPRESS_INSTALL_BINARY: 0 - name: Check tests run: pnpm run ts-check:tests codecov: runs-on: ubuntu-latest timeout-minutes: 10 name: 'Codecov: node-18, ubuntu-latest' steps: - name: Checkout uses: actions/checkout@v3 with: fetch-depth: 0 - name: Install pnpm uses: pnpm/action-setup@v2.2.4 with: version: 7 - name: Set node version to 18 uses: actions/setup-node@v3 with: node-version: 18 cache: 'pnpm' - name: Install deps run: pnpm install env: CYPRESS_INSTALL_BINARY: 0 - name: Build run: pnpm run build - name: Generate coverage report run: pnpm vitest run --coverage - name: Upload coverage to Codecov uses: codecov/codecov-action@v3.1.3 with: token: ${{ secrets.CODECOV_TOKEN }} fail_ci_if_error: true