summaryrefslogtreecommitdiff
path: root/.github/workflows/nodejs.yml
blob: 1e958547b76aaed4cb0e84886236dc29146b3002 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Node CI

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

jobs:
  skip_run:
    continue-on-error: true
    runs-on: ubuntu-latest
    outputs:
      should_skip: ${{ steps.skip_check.outputs.should_skip }}
    steps:
      - id: skip_check
        uses: fkirc/skip-duplicate-actions@master
        with:
          concurrent_skipping: 'never'
          skip_after_successful_duplicate: 'true'
          paths_ignore: '["README.md", "**/README.md", "docs/**"]'
          do_not_skip: '["workflow_dispatch", "schedule"]'
  changeset:
    needs: skip_run # allow skip_run to cancel this job if it’s not needed
    if: ${{ needs.skip_run.outputs.should_skip != 'true' }}
    name: Ensure changeset
    runs-on: ubuntu-latest
    steps:
      - name: Check out PR branch
        uses: actions/checkout@v2

      - name: Check out main branch
        uses: actions/checkout@v2
        with:
          ref: main

      - name: Set up Node.js 14.x
        uses: actions/setup-node@v2
        with:
          node-version: 14.x

      - name: Install dependencies
        run: yarn --frozen-lockfile --ignore-engines
        env:
          CI: true

      - run: yarn changeset status --since=main
  test:
    needs: skip_run # allow skip_run to cancel this job if it’s not needed
    if: ${{ needs.skip_run.outputs.should_skip != 'true' }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest]
        node-version: [14.x, 16.x]
    steps:
      - uses: actions/checkout@v2
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v2
        with:
          node-version: ${{ matrix.node-version }}
      - run: yarn --frozen-lockfile --ignore-engines
        env:
          CI: true
      - run: yarn build
        env:
          CI: true
      - run: yarn test
        env:
          CI: true