|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + |
| 8 | +jobs: |
| 9 | + build_test: |
| 10 | + runs-on: ${{ matrix.os }} |
| 11 | + strategy: |
| 12 | + matrix: |
| 13 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 14 | + node-version: [14, 12, 10] |
| 15 | + |
| 16 | + steps: |
| 17 | + - name: Checkout |
| 18 | + uses: actions/checkout@v2 |
| 19 | + |
| 20 | + - name: Use Node.js ${{ matrix.node-version }} |
| 21 | + uses: actions/setup-node@v2 |
| 22 | + with: |
| 23 | + node-version: ${{ matrix.node-version }} |
| 24 | + |
| 25 | + - name: Get yarn cache directory |
| 26 | + id: yarn-cache |
| 27 | + run: echo "::set-output name=dir::$(yarn cache dir)" |
| 28 | + |
| 29 | + - name: Set dependencies cache |
| 30 | + uses: actions/cache@v2 |
| 31 | + with: |
| 32 | + path: ${{ steps.yarn-cache.outputs.dir }} |
| 33 | + key: ${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('yarn.lock') }} |
| 34 | + restore-keys: | |
| 35 | + ${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('yarn.lock') }} |
| 36 | + ${{ runner.os }}-${{ matrix.node_version }}- |
| 37 | + - name: Versions |
| 38 | + run: yarn versions |
| 39 | + |
| 40 | + - name: Install dependencies |
| 41 | + run: yarn install --frozen-lockfile |
| 42 | + |
| 43 | + - name: Build |
| 44 | + run: yarn build |
| 45 | + |
| 46 | + - name: Test |
| 47 | + run: yarn test |
| 48 | + |
| 49 | + lint: |
| 50 | + runs-on: ubuntu-latest |
| 51 | + name: 'Lint: node@14, ubuntu-latest' |
| 52 | + steps: |
| 53 | + - uses: actions/checkout@v2 |
| 54 | + with: |
| 55 | + fetch-depth: 0 |
| 56 | + |
| 57 | + - name: Set node version to 14 |
| 58 | + uses: actions/setup-node@v2 |
| 59 | + with: |
| 60 | + node-version: 14 |
| 61 | + |
| 62 | + - name: Set dependencies cache |
| 63 | + uses: actions/cache@v2 |
| 64 | + with: |
| 65 | + path: ~/.cache/yarn |
| 66 | + key: lint-dependencies-${{ hashFiles('yarn.lock') }} |
| 67 | + restore-keys: | |
| 68 | + lint-dependencies-${{ hashFiles('yarn.lock') }} |
| 69 | + lint-dependencies- |
| 70 | + - name: Prepare |
| 71 | + run: | |
| 72 | + yarn install --frozen-lockfile |
| 73 | + yarn build |
| 74 | + - name: Lint |
| 75 | + run: yarn lint |
0 commit comments