Skip to content

Yarn v3, yarn cache and add windows to test matrix on gh #437

Yarn v3, yarn cache and add windows to test matrix on gh

Yarn v3, yarn cache and add windows to test matrix on gh #437

Workflow file for this run

# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
node-version: [
14.x,
16.x,
# Deal with unhandled promise rejection in integration test:
# ERROR [karma-server]: Error: error:0308010C:digital envelope routines::unsupported
# , 18.x
]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
# https://github.com/actions/cache/blob/main/examples.md#node---yarn-2
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
shell: bash
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
enableCrossOsArchive: true
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn install --immutable --immutable-cache
- name: Test
id: test-linux
run: yarn test
if: ${{ runner.os }} == 'ubuntu-latest'
- name: Test
id: test-windows
run: yarn test:unit
if: ${{ runner.os }} == 'windows-latest'
- name: Build
run: yarn build
id: build-linux
if: ${{ runner.os }} == 'ubuntu-latest'