diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e4e1c55..689c3a4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,39 +15,65 @@ jobs: node-version: [16.x] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} + # cache: 'yarn' - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn config get cacheFolder)" + # - name: Get yarn cache directory path + # id: yarn-cache-dir-path + # run: echo "::set-output name=dir::$(yarn config get cacheFolder)" - - uses: actions/cache@v2 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + # - uses: actions/cache@v2 + # id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + # with: + # # Note that we assume the following things about the compatibility tests here: + # # 1. Every directory in `build_test` is a project managed with yarn + # # 2. All these projects store their cache in `/.yarn/cache` + # # It's not that robust, but should be sufficient for us for now. + # path: | + # ${{ steps.yarn-cache-dir-path.outputs.dir }} + # ${{ github.workspace }}/compatibility-tests/*/.yarn/cache + # key: + # ${{ runner.os }}-${{ matrix.node-version }}-yarn-${{ + # hashFiles('**/yarn.lock') }} + # restore-keys: | + # ${{ runner.os }}-${{ matrix.node-version }}-yarn- + + - name: Restore node_modules + id: yarn-node-modules-cache + uses: actions/cache@v3 with: - # Note that we assume the following things about the compatibility tests here: - # 1. Every directory in `build_test` is a project managed with yarn - # 2. All these projects store their cache in `/.yarn/cache` - # It's not that robust, but should be sufficient for us for now. path: | - ${{ steps.yarn-cache-dir-path.outputs.dir }} - ${{ github.workspace }}/compatibility-tests/*/.yarn/cache + **/node_modules + .yarn/cache key: - ${{ runner.os }}-${{ matrix.node-version }}-yarn-${{ - hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-${{ matrix.node-version }}-yarn- + ${{ runner.os }}-yarn-mono-nm-node-modules-${{ + hashFiles('yarn.lock', '.yarnrc.yml') }} + + # Thanks to https://github.com/rafaelbiten for this step https://github.com/microsoft/playwright/issues/7249#issuecomment-1385567519 + - name: Cache Playwright Browsers for Playwright's Version + id: cache-playwright-browsers + uses: actions/cache@v3 + with: + path: ~/.cache/ms-playwright + key: ${{ runner.os }}-playwright-${{ hashFiles('yarn.lock') }} + + - run: yarn install --immutable --inline-builds + env: + YARN_NM_MODE: 'hardlinks-local' - - run: yarn install - run: yarn lint:all --max-warnings 0 - run: yarn test - run: yarn typecheck - run: yarn build + - name: Download playwright - run: yarn workspace playground run playwright install + if: steps.cache-playwright-browsers.outputs.cache-hit != 'true' + run: yarn workspace playground run playwright install --with-deps + - name: Run e2e tests with percy uses: percy/exec-action@v0.3.1 with: