From ba894bbb98d1d65269d44bb242b76a4a9c956497 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Vanvelthem?= Date: Mon, 3 Oct 2022 15:21:35 +0200 Subject: [PATCH] ci: use internal action to centralize install --- .github/workflows/ci-e2e-nextjs-app.yml | 24 ++------------------- .github/workflows/ci-e2e-prisma.yml | 24 ++------------------- .github/workflows/ci-monorepo-integrity.yml | 24 ++------------------- .github/workflows/ci-nextjs-app.yml | 24 ++------------------- .github/workflows/ci-packages.yml | 24 ++------------------- .github/workflows/ci-remix-app.yml | 24 ++------------------- .github/workflows/ci-vite-app.yml | 24 ++------------------- .github/workflows/release-or-version-pr.yml | 24 ++------------------- 8 files changed, 16 insertions(+), 176 deletions(-) diff --git a/.github/workflows/ci-e2e-nextjs-app.yml b/.github/workflows/ci-e2e-nextjs-app.yml index 6c33072f2c4..c9c36a8e919 100644 --- a/.github/workflows/ci-e2e-nextjs-app.yml +++ b/.github/workflows/ci-e2e-nextjs-app.yml @@ -53,20 +53,8 @@ jobs: with: node-version: ${{ matrix.node-version }} - # Why not using setup-node 2.2+ cache option (yet) ? - # see https://github.com/belgattitude/nextjs-monorepo-example/pull/369 - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn config get cacheFolder)" - - - name: Restore yarn cache - uses: actions/cache@v3 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: yarn-cache-folder-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }} - restore-keys: | - yarn-cache-folder- + - name: 📥 Monorepo install + uses: ./.github/actions/monorepo-install # see https://github.com/vercel/next.js/pull/27362 - name: Restore nextjs build nextjs-app from cache @@ -85,14 +73,6 @@ jobs: working-directory: packages/db-main-prisma run: docker-compose -f docker-compose.e2e.yml up --detach ${{ matrix.database }} - - name: Install dependencies - run: | - yarn install --immutable --inline-builds - env: - PRISMA_SKIP_POSTINSTALL_GENERATE: true - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 - HUSKY: 0 - - name: Create and seed test database working-directory: packages/db-main-prisma run: | diff --git a/.github/workflows/ci-e2e-prisma.yml b/.github/workflows/ci-e2e-prisma.yml index 722e2e2d3a9..59f141b4f87 100644 --- a/.github/workflows/ci-e2e-prisma.yml +++ b/.github/workflows/ci-e2e-prisma.yml @@ -45,33 +45,13 @@ jobs: with: node-version: ${{ matrix.node-version }} - # Why not using setup-node 2.2+ cache option (yet) ? - # see https://github.com/belgattitude/nextjs-monorepo-example/pull/369 - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn config get cacheFolder)" - - - name: Restore yarn cache - uses: actions/cache@v3 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: yarn-cache-folder-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }} - restore-keys: | - yarn-cache-folder- + - name: 📥 Monorepo install + uses: ./.github/actions/monorepo-install - name: Start postgresql working-directory: packages/db-main-prisma run: docker-compose -f docker-compose.e2e.yml up --detach ${{ matrix.database }} - - name: Install dependencies - run: | - yarn install --immutable --inline-builds - env: - PRISMA_SKIP_POSTINSTALL_GENERATE: true - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 - HUSKY: 0 - - name: E2E prisma working-directory: packages/db-main-prisma run: | diff --git a/.github/workflows/ci-monorepo-integrity.yml b/.github/workflows/ci-monorepo-integrity.yml index 43f12be9e62..d197db31481 100644 --- a/.github/workflows/ci-monorepo-integrity.yml +++ b/.github/workflows/ci-monorepo-integrity.yml @@ -36,28 +36,8 @@ jobs: with: node-version: ${{ matrix.node-version }} - # Why not using setup-node 2.2+ cache option (yet) ? - # see https://github.com/belgattitude/nextjs-monorepo-example/pull/369 - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn config get cacheFolder)" - - - name: Restore yarn cache - uses: actions/cache@v3 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: yarn-cache-folder-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }} - restore-keys: | - yarn-cache-folder- - - - name: Install dependencies - run: | - yarn install --immutable --inline-builds - env: - PRISMA_SKIP_POSTINSTALL_GENERATE: true - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 - HUSKY: 0 + - name: 📥 Monorepo install + uses: ./.github/actions/monorepo-install - name: Check for duplicate dependencies in lock file run: | diff --git a/.github/workflows/ci-nextjs-app.yml b/.github/workflows/ci-nextjs-app.yml index ef7ba39050e..61204cb8d0d 100644 --- a/.github/workflows/ci-nextjs-app.yml +++ b/.github/workflows/ci-nextjs-app.yml @@ -45,20 +45,8 @@ jobs: with: node-version: ${{ matrix.node-version }} - # Why not using setup-node 2.2+ cache option (yet) ? - # see https://github.com/belgattitude/nextjs-monorepo-example/pull/369 - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn config get cacheFolder)" - - - name: Restore yarn cache - uses: actions/cache@v3 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: yarn-cache-folder-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }} - restore-keys: | - yarn-cache-folder- + - name: 📥 Monorepo install + uses: ./.github/actions/monorepo-install # see https://github.com/vercel/next.js/pull/27362 - name: Restore nextjs build nextjs-app from cache @@ -73,14 +61,6 @@ jobs: restore-keys: | ${{ runner.os }}-nextjs-app-${{ hashFiles('**/yarn.lock') }}- - - name: Install dependencies - run: | - yarn install --immutable --inline-builds - env: - PRISMA_SKIP_POSTINSTALL_GENERATE: true - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 - HUSKY: 0 - - name: Typecheck working-directory: apps/nextjs-app run: | diff --git a/.github/workflows/ci-packages.yml b/.github/workflows/ci-packages.yml index e0801cee30c..c9fd48160af 100644 --- a/.github/workflows/ci-packages.yml +++ b/.github/workflows/ci-packages.yml @@ -46,20 +46,8 @@ jobs: with: node-version: ${{ matrix.node-version }} - # Why not using setup-node 2.2+ cache option (yet) ? - # see https://github.com/belgattitude/nextjs-monorepo-example/pull/369 - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn config get cacheFolder)" - - - name: Restore yarn cache - uses: actions/cache@v3 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: yarn-cache-folder-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }} - restore-keys: | - yarn-cache-folder- + - name: 📥 Monorepo install + uses: ./.github/actions/monorepo-install - name: Restore packages cache uses: actions/cache@v3 @@ -72,14 +60,6 @@ jobs: restore-keys: | ${{ runner.os }}-packages-cache-${{ hashFiles('**/yarn.lock') }}- - - name: Install dependencies - run: | - yarn install --immutable --inline-builds - env: - PRISMA_SKIP_POSTINSTALL_GENERATE: true - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 - HUSKY: 0 - # Typecheck packages that have changed + packages and apps that depends on them (--from & --since) # That allows to see if we're introducing "surface" regressions (just the types) - name: Typecheck diff --git a/.github/workflows/ci-remix-app.yml b/.github/workflows/ci-remix-app.yml index ae327cd6fd6..c6a5e94d8f8 100644 --- a/.github/workflows/ci-remix-app.yml +++ b/.github/workflows/ci-remix-app.yml @@ -42,28 +42,8 @@ jobs: with: node-version: ${{ matrix.node-version }} - # Why not using setup-node 2.2+ cache option (yet) ? - # see https://github.com/belgattitude/nextjs-monorepo-example/pull/369 - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn config get cacheFolder)" - - - name: Restore yarn cache - uses: actions/cache@v3 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: yarn-cache-folder-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }} - restore-keys: | - yarn-cache-folder- - - - name: Install dependencies - run: | - yarn install --immutable --inline-builds - env: - PRISMA_SKIP_POSTINSTALL_GENERATE: true - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 - HUSKY: 0 + - name: 📥 Monorepo install + uses: ./.github/actions/monorepo-install - name: Typecheck working-directory: apps/remix-app diff --git a/.github/workflows/ci-vite-app.yml b/.github/workflows/ci-vite-app.yml index f28509a11af..2754d9ae6ba 100644 --- a/.github/workflows/ci-vite-app.yml +++ b/.github/workflows/ci-vite-app.yml @@ -42,28 +42,8 @@ jobs: with: node-version: ${{ matrix.node-version }} - # Why not using setup-node 2.2+ cache option (yet) ? - # see https://github.com/belgattitude/nextjs-monorepo-example/pull/369 - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn config get cacheFolder)" - - - name: Restore yarn cache - uses: actions/cache@v3 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: yarn-cache-folder-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }} - restore-keys: | - yarn-cache-folder- - - - name: Install dependencies - run: | - yarn install --immutable --inline-builds - env: - PRISMA_SKIP_POSTINSTALL_GENERATE: true - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 - HUSKY: 0 + - name: 📥 Monorepo install + uses: ./.github/actions/monorepo-install - name: Typecheck working-directory: apps/vite-app diff --git a/.github/workflows/release-or-version-pr.yml b/.github/workflows/release-or-version-pr.yml index ed810a8ccb6..8989ca64e46 100644 --- a/.github/workflows/release-or-version-pr.yml +++ b/.github/workflows/release-or-version-pr.yml @@ -23,28 +23,8 @@ jobs: with: node-version: 16.x - # Why not using setup-node 2.2+ cache option (yet) ? - # see https://github.com/belgattitude/nextjs-monorepo-example/pull/369 - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn config get cacheFolder)" - - - name: Restore yarn cache - uses: actions/cache@v3 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: yarn-cache-folder-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }} - restore-keys: | - yarn-cache-folder- - - - name: Install dependencies - run: | - yarn install --immutable --inline-builds - env: - PRISMA_SKIP_POSTINSTALL_GENERATE: true - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 - HUSKY: 0 + - name: 📥 Monorepo install + uses: ./.github/actions/monorepo-install # @link https://github.com/changesets/action - name: Create Release Pull Request