From 2ab0fc25e1ce8afc3e9f7b01eb9b66fff590211e Mon Sep 17 00:00:00 2001 From: Claudio Wunder Date: Wed, 31 May 2023 17:35:42 +0200 Subject: [PATCH 1/6] chore: gnu tar Signed-off-by: Claudio Wunder --- .github/workflows/pull-request.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index b0c4d8bc2474d..16a0fc502749e 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -59,6 +59,11 @@ jobs: os: [ubuntu-latest, windows-latest] steps: + - name: "Use GNU tar instead BSD tar" + if: matrix.os == 'windows-latest' + shell: cmd + run: echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%" + - name: Git Checkout uses: actions/checkout@v3 with: @@ -115,6 +120,16 @@ jobs: os: [ubuntu-latest, windows-latest] steps: + - name: "Use GNU tar instead BSD tar" + if: matrix.os == 'windows-latest' + shell: cmd + run: echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%" + + - name: "Use GNU tar instead BSD tar" + if: matrix.os == 'windows-latest' + shell: cmd + run: echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%" + - name: Git Checkout uses: actions/checkout@v3 with: From 8a93ee20df8b63c5f1aaa3e81c76d1dfafa46c68 Mon Sep 17 00:00:00 2001 From: Claudio Wunder Date: Wed, 31 May 2023 17:49:28 +0200 Subject: [PATCH 2/6] chore: more aggressive cache behaviour Signed-off-by: Claudio Wunder --- .github/workflows/pull-request.yml | 57 +++++++++++++++--------------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 16a0fc502749e..04e286a14efc3 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -19,21 +19,21 @@ jobs: uses: actions/setup-node@v3 with: node-version-file: '.nvmrc' - cache: npm - - - name: Install NPM packages - run: npm ci - name: Restore Cache uses: actions/cache/restore@v3 with: path: | + ~/.npm + .next/cache node_modules/.cache - key: tests-${{ hashFiles('**/package-lock.json') }}- - restore-keys: | - tests-${{ hashFiles('**/package-lock.json') }}- + key: cache-${{ hashFiles('package-lock.json') }}- + restore-keys: cache- enableCrossOsArchive: true + - name: Install NPM packages + run: npm ci + - name: Run Linting run: npx turbo lint env: @@ -45,8 +45,10 @@ jobs: uses: actions/cache/save@v3 with: path: | + ~/.npm + .next/cache node_modules/.cache - key: tests-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('node_modules/.cache') }} + key: cache-${{ hashFiles('package-lock.json') }}-${{ hashFiles('node_modules/.cache') }} enableCrossOsArchive: true unit-tests: @@ -73,21 +75,21 @@ jobs: uses: actions/setup-node@v3 with: node-version-file: '.nvmrc' - cache: npm - - - name: Install NPM packages - run: npm ci - name: Restore Cache uses: actions/cache/restore@v3 with: path: | + ~/.npm + .next/cache node_modules/.cache - key: tests-${{ hashFiles('**/package-lock.json') }}- - restore-keys: | - tests-${{ hashFiles('**/package-lock.json') }}- + key: cache-${{ hashFiles('package-lock.json') }}- + restore-keys: cache- enableCrossOsArchive: true + - name: Install NPM packages + run: npm ci + - name: Run Unit Tests run: npx turbo test:unit -- --coverage env: @@ -106,8 +108,10 @@ jobs: uses: actions/cache/save@v3 with: path: | + ~/.npm + .next/cache node_modules/.cache - key: tests-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('node_modules/.cache') }} + key: cache-${{ hashFiles('package-lock.json') }}-${{ hashFiles('node_modules/.cache') }} enableCrossOsArchive: true build: @@ -125,11 +129,6 @@ jobs: shell: cmd run: echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%" - - name: "Use GNU tar instead BSD tar" - if: matrix.os == 'windows-latest' - shell: cmd - run: echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%" - - name: Git Checkout uses: actions/checkout@v3 with: @@ -139,22 +138,21 @@ jobs: uses: actions/setup-node@v3 with: node-version-file: '.nvmrc' - cache: npm - - - name: Install NPM packages - run: npm ci - name: Restore Cache uses: actions/cache/restore@v3 with: path: | + ~/.npm .next/cache node_modules/.cache - key: build-${{ hashFiles('**/package-lock.json') }}- - restore-keys: | - build-${{ hashFiles('**/package-lock.json') }}- + key: cache-${{ hashFiles('package-lock.json') }}- + restore-keys: cache- enableCrossOsArchive: true + - name: Install NPM packages + run: npm ci + - name: Build Next.js run: npx turbo build env: @@ -167,7 +165,8 @@ jobs: uses: actions/cache/save@v3 with: path: | + ~/.npm .next/cache node_modules/.cache - key: build-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('node_modules/.cache') }} + key: cache-${{ hashFiles('package-lock.json') }}-${{ hashFiles('node_modules/.cache') }} enableCrossOsArchive: true From eb1a58885914c9ba2e947e3a965915ea3c0c554d Mon Sep 17 00:00:00 2001 From: Claudio Wunder Date: Wed, 31 May 2023 17:52:01 +0200 Subject: [PATCH 3/6] chore: remove node_modules cache prefix Signed-off-by: Claudio Wunder --- .github/workflows/pull-request.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 04e286a14efc3..816480970e26e 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -48,7 +48,7 @@ jobs: ~/.npm .next/cache node_modules/.cache - key: cache-${{ hashFiles('package-lock.json') }}-${{ hashFiles('node_modules/.cache') }} + key: cache-${{ hashFiles('package-lock.json') }} enableCrossOsArchive: true unit-tests: @@ -111,7 +111,7 @@ jobs: ~/.npm .next/cache node_modules/.cache - key: cache-${{ hashFiles('package-lock.json') }}-${{ hashFiles('node_modules/.cache') }} + key: cache-${{ hashFiles('package-lock.json') }} enableCrossOsArchive: true build: @@ -168,5 +168,5 @@ jobs: ~/.npm .next/cache node_modules/.cache - key: cache-${{ hashFiles('package-lock.json') }}-${{ hashFiles('node_modules/.cache') }} + key: cache-${{ hashFiles('package-lock.json') }} enableCrossOsArchive: true From 1fdd6cfdb9e9b7531146418bff31557cc5b014d6 Mon Sep 17 00:00:00 2001 From: Claudio Wunder Date: Wed, 31 May 2023 17:54:42 +0200 Subject: [PATCH 4/6] chore: make cache specific to the os Signed-off-by: Claudio Wunder --- .github/workflows/pull-request.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 816480970e26e..d05bd78c285f9 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -29,7 +29,6 @@ jobs: node_modules/.cache key: cache-${{ hashFiles('package-lock.json') }}- restore-keys: cache- - enableCrossOsArchive: true - name: Install NPM packages run: npm ci @@ -49,7 +48,6 @@ jobs: .next/cache node_modules/.cache key: cache-${{ hashFiles('package-lock.json') }} - enableCrossOsArchive: true unit-tests: name: Tests on ${{ matrix.os }} @@ -85,7 +83,6 @@ jobs: node_modules/.cache key: cache-${{ hashFiles('package-lock.json') }}- restore-keys: cache- - enableCrossOsArchive: true - name: Install NPM packages run: npm ci @@ -112,7 +109,6 @@ jobs: .next/cache node_modules/.cache key: cache-${{ hashFiles('package-lock.json') }} - enableCrossOsArchive: true build: name: Build on ${{ matrix.os }} @@ -148,7 +144,6 @@ jobs: node_modules/.cache key: cache-${{ hashFiles('package-lock.json') }}- restore-keys: cache- - enableCrossOsArchive: true - name: Install NPM packages run: npm ci @@ -169,4 +164,3 @@ jobs: .next/cache node_modules/.cache key: cache-${{ hashFiles('package-lock.json') }} - enableCrossOsArchive: true From 0d8420f9f85590bd8d0409a26b782c460e4fe99b Mon Sep 17 00:00:00 2001 From: Claudio Wunder Date: Wed, 31 May 2023 17:57:40 +0200 Subject: [PATCH 5/6] chore: double-cache with npm cache Signed-off-by: Claudio Wunder --- .github/workflows/pull-request.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index d05bd78c285f9..54f75b9e0e2c1 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -19,6 +19,7 @@ jobs: uses: actions/setup-node@v3 with: node-version-file: '.nvmrc' + cache: 'npm' - name: Restore Cache uses: actions/cache/restore@v3 @@ -73,6 +74,7 @@ jobs: uses: actions/setup-node@v3 with: node-version-file: '.nvmrc' + cache: 'npm' - name: Restore Cache uses: actions/cache/restore@v3 @@ -134,6 +136,7 @@ jobs: uses: actions/setup-node@v3 with: node-version-file: '.nvmrc' + cache: 'npm' - name: Restore Cache uses: actions/cache/restore@v3 From 33145ac212e039ac7ef4bcf53673a8d00abddc5b Mon Sep 17 00:00:00 2001 From: Claudio Wunder Date: Wed, 31 May 2023 18:00:48 +0200 Subject: [PATCH 6/6] chore: restore cache before Signed-off-by: Claudio Wunder --- .github/workflows/pull-request.yml | 36 +++++++++++++++--------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 54f75b9e0e2c1..6653ce82ea3da 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -15,12 +15,6 @@ jobs: with: fetch-depth: 2 - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version-file: '.nvmrc' - cache: 'npm' - - name: Restore Cache uses: actions/cache/restore@v3 with: @@ -31,6 +25,12 @@ jobs: key: cache-${{ hashFiles('package-lock.json') }}- restore-keys: cache- + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + cache: 'npm' + - name: Install NPM packages run: npm ci @@ -70,12 +70,6 @@ jobs: with: fetch-depth: 2 - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version-file: '.nvmrc' - cache: 'npm' - - name: Restore Cache uses: actions/cache/restore@v3 with: @@ -86,6 +80,12 @@ jobs: key: cache-${{ hashFiles('package-lock.json') }}- restore-keys: cache- + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + cache: 'npm' + - name: Install NPM packages run: npm ci @@ -132,12 +132,6 @@ jobs: with: fetch-depth: 2 - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version-file: '.nvmrc' - cache: 'npm' - - name: Restore Cache uses: actions/cache/restore@v3 with: @@ -148,6 +142,12 @@ jobs: key: cache-${{ hashFiles('package-lock.json') }}- restore-keys: cache- + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + cache: 'npm' + - name: Install NPM packages run: npm ci