From 4c0eeb384dc64a6931f8fb0f5358bc115739acbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Sat, 15 Aug 2020 14:57:43 -0400 Subject: [PATCH 1/6] chore: add cache actions for yarn --- .github/workflows/ci.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 877c5a9b0d9a..f38da2e96fe6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,15 @@ jobs: uses: actions/checkout@v2 - name: Use Node.js latest uses: actions/setup-node@v2-beta + - 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 + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- - name: Generate coverage report run: | make -j test-ci-coverage @@ -28,6 +37,15 @@ jobs: uses: actions/checkout@v2 - name: Use Node.js latest uses: actions/setup-node@v2-beta # Build Babel on latest node versions + - 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 + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- - name: Build run: | BABEL_ENV=test-legacy make -j bootstrap From 7a8042e2a886c99c81a0a7915b37312dbe6a5ed8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Sat, 15 Aug 2020 15:57:35 -0400 Subject: [PATCH 2/6] chore: validate yarn cache before CI jobs --- .github/workflows/ci.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f38da2e96fe6..92b20c2b065e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,30 @@ name: Node CI on: [push, pull_request] jobs: + validate-yarn-cache: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Use Node.js latest + uses: actions/setup-node@v2-beta + - 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 + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + - name: Update Yarn cache + if: steps.yarn-cache.outputs.cache-hit != 'true' + run: | + yarn install --immutable + test: + needs: validate-yarn-cache runs-on: ubuntu-latest steps: - name: Checkout code @@ -28,6 +51,7 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} legacy-node-version-test: + needs: validate-yarn-cache runs-on: ubuntu-latest strategy: matrix: From 793a5e8955122251e3cefafd0a3622e2cc0f4d85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Sat, 15 Aug 2020 16:47:43 -0400 Subject: [PATCH 3/6] chore: remove restore-keys as cache-hit must be true --- .github/workflows/ci.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 92b20c2b065e..635f824dcdb0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,8 +40,6 @@ jobs: with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - name: Generate coverage report run: | make -j test-ci-coverage @@ -68,8 +66,6 @@ jobs: with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - name: Build run: | BABEL_ENV=test-legacy make -j bootstrap From 0512daba9d4bd23a2b3c487d26dcbd3a557e4033 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Sun, 16 Aug 2020 14:53:55 -0400 Subject: [PATCH 4/6] chore: disable post install scripts in yarn-cache validate --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 635f824dcdb0..518d32501d64 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,6 +22,8 @@ jobs: ${{ runner.os }}-yarn- - name: Update Yarn cache if: steps.yarn-cache.outputs.cache-hit != 'true' + env: + YARN_ENABLE_SCRIPTS: false # disable post-install scripts run: | yarn install --immutable From 26aa1b1ddbef4013960971666abb5dff37da3fc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Sun, 16 Aug 2020 14:41:06 -0400 Subject: [PATCH 5/6] chore: use pnp linker in validate-yarn-cache step --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 518d32501d64..c6f517e70b3a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,6 +24,7 @@ jobs: if: steps.yarn-cache.outputs.cache-hit != 'true' env: YARN_ENABLE_SCRIPTS: false # disable post-install scripts + YARN_NODE_LINKER: pnp # use pnp linker for better performance: it meant to update yarn cache only run: | yarn install --immutable From b9904078208917d338292ccad5ec544e7e53ae44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Mon, 24 Aug 2020 15:22:47 -0400 Subject: [PATCH 6/6] chore: add job names --- .github/workflows/ci.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c6f517e70b3a..ceb48cb8ca91 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,9 +1,10 @@ -name: Node CI +name: CI on: [push, pull_request] jobs: - validate-yarn-cache: + prepare-yarn-cache: + name: Prepare Cache runs-on: ubuntu-latest steps: - name: Checkout code @@ -28,8 +29,9 @@ jobs: run: | yarn install --immutable - test: - needs: validate-yarn-cache + test-coverage: + name: Test on Node.js Latest + needs: prepare-yarn-cache runs-on: ubuntu-latest steps: - name: Checkout code @@ -52,7 +54,8 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} legacy-node-version-test: - needs: validate-yarn-cache + name: Test on Node.js + needs: prepare-yarn-cache runs-on: ubuntu-latest strategy: matrix: