Yuki Takei 1 год назад
Родитель
Сommit
b047847580
3 измененных файлов с 62 добавлено и 98 удалено
  1. 30 51
      .github/workflows/ci-app.yml
  2. 26 32
      .github/workflows/reusable-app-prod.yml
  3. 6 15
      .github/workflows/reusable-app-reg-suit.yml

+ 30 - 51
.github/workflows/ci-app.yml

@@ -43,22 +43,23 @@ jobs:
         with:
         with:
           path: |
           path: |
             **/node_modules
             **/node_modules
-            !**/node_modules/.cache
-          key: node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('apps/app/package.json') }}
+            !**/node_modules/.cache/turbo
+          key: node_modules-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-${{ github.ref_name }}-${{ hashFiles('**/yarn.lock') }}
           restore-keys: |
           restore-keys: |
-            node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-
-            node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-
+            node_modules-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-${{ github.ref_name }}-
+            node_modules-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-
 
 
-      - name: Restore dist
-        uses: actions/cache/restore@v4
+      - name: Cache/Restore dist
+        uses: actions/cache@v4
         with:
         with:
           path: |
           path: |
             **/.turbo
             **/.turbo
-            **/node_modules/.cache
             **/dist
             **/dist
-          key: dist-app-ci-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('node_modules/.cache/turbo/*-meta.json') }}
+            **/node_modules/.cache/turbo
+          key: dist-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-${{ github.ref_name }}-${{ github.sha }}
           restore-keys: |
           restore-keys: |
-            dist-app-ci-${{ runner.OS }}-node${{ matrix.node-version }}-
+            dist-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-${{ github.ref_name }}-
+            dist-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-
 
 
       - name: Install dependencies
       - name: Install dependencies
         run: |
         run: |
@@ -80,14 +81,6 @@ jobs:
           isCompactMode: true
           isCompactMode: true
           url: ${{ secrets.SLACK_WEBHOOK_URL }}
           url: ${{ secrets.SLACK_WEBHOOK_URL }}
 
 
-      - name: Cache dist
-        uses: actions/cache/save@v4
-        with:
-          path: |
-            **/.turbo
-            **/dist
-          key: dist-app-ci-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('node_modules/.cache/turbo/*-meta.json') }}
-
 
 
   ci-app-test:
   ci-app-test:
     runs-on: ubuntu-latest
     runs-on: ubuntu-latest
@@ -112,25 +105,27 @@ jobs:
           cache-dependency-path: '**/yarn.lock'
           cache-dependency-path: '**/yarn.lock'
 
 
       - name: Cache/Restore node_modules
       - name: Cache/Restore node_modules
-        id: cache-dependencies
         uses: actions/cache@v4
         uses: actions/cache@v4
         with:
         with:
           path: |
           path: |
             **/node_modules
             **/node_modules
-          key: node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('apps/app/package.json') }}
+            !**/node_modules/.cache/turbo
+          key: node_modules-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-${{ github.ref_name }}-${{ hashFiles('**/yarn.lock') }}
           restore-keys: |
           restore-keys: |
-            node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-
-            node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-
+            node_modules-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-${{ github.ref_name }}-
+            node_modules-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-
 
 
-      - name: Restore dist
-        uses: actions/cache/restore@v4
+      - name: Cache/Restore dist
+        uses: actions/cache@v4
         with:
         with:
           path: |
           path: |
             **/.turbo
             **/.turbo
             **/dist
             **/dist
-          key: dist-app-ci-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('node_modules/.cache/turbo/*-meta.json') }}
+            **/node_modules/.cache/turbo
+          key: dist-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-${{ github.ref_name }}-${{ github.sha }}
           restore-keys: |
           restore-keys: |
-            dist-app-ci-${{ runner.OS }}-node${{ matrix.node-version }}-
+            dist-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-${{ github.ref_name }}-
+            dist-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-
 
 
       - name: Install dependencies
       - name: Install dependencies
         run: |
         run: |
@@ -162,14 +157,6 @@ jobs:
           isCompactMode: true
           isCompactMode: true
           url: ${{ secrets.SLACK_WEBHOOK_URL }}
           url: ${{ secrets.SLACK_WEBHOOK_URL }}
 
 
-      - name: Cache dist
-        uses: actions/cache/save@v4
-        with:
-          path: |
-            **/.turbo
-            **/dist
-          key: dist-app-ci-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('node_modules/.cache/turbo/*-meta.json') }}
-
 
 
   ci-app-launch-dev:
   ci-app-launch-dev:
     runs-on: ubuntu-latest
     runs-on: ubuntu-latest
@@ -194,26 +181,27 @@ jobs:
           cache-dependency-path: '**/yarn.lock'
           cache-dependency-path: '**/yarn.lock'
 
 
       - name: Cache/Restore node_modules
       - name: Cache/Restore node_modules
-        id: cache-dependencies
         uses: actions/cache@v4
         uses: actions/cache@v4
         with:
         with:
           path: |
           path: |
             **/node_modules
             **/node_modules
-          key: node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('apps/app/package.json') }}
+            !**/node_modules/.cache/turbo
+          key: node_modules-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-${{ github.ref_name }}-${{ hashFiles('**/yarn.lock') }}
           restore-keys: |
           restore-keys: |
-            node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-
-            node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-
+            node_modules-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-${{ github.ref_name }}-
+            node_modules-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-
 
 
-      - name: Restore dist
-        uses: actions/cache/restore@v4
+      - name: Cache/Restore dist
+        uses: actions/cache@v4
         with:
         with:
           path: |
           path: |
             **/.turbo
             **/.turbo
             **/dist
             **/dist
-            ${{ github.workspace }}/apps/app/.next
-          key: dist-app-dev-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('node_modules/.cache/turbo/*-meta.json') }}
+            **/node_modules/.cache/turbo
+          key: dist-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-${{ github.ref_name }}-${{ github.sha }}
           restore-keys: |
           restore-keys: |
-            dist-app-dev-${{ runner.OS }}-node${{ matrix.node-version }}-
+            dist-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-${{ github.ref_name }}-
+            dist-ci-app-${{ runner.OS }}-node${{ matrix.node-version }}-
 
 
       - name: Install dependencies
       - name: Install dependencies
         run: |
         run: |
@@ -238,12 +226,3 @@ jobs:
           channel: '#ci'
           channel: '#ci'
           isCompactMode: true
           isCompactMode: true
           url: ${{ secrets.SLACK_WEBHOOK_URL }}
           url: ${{ secrets.SLACK_WEBHOOK_URL }}
-
-      - name: Cache dist
-        uses: actions/cache/save@v4
-        with:
-          path: |
-            **/.turbo
-            **/dist
-            ${{ github.workspace }}/apps/app/.next
-          key: dist-app-dev-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('node_modules/.cache/turbo/*-meta.json') }}

+ 26 - 32
.github/workflows/reusable-app-prod.yml

@@ -48,13 +48,14 @@ jobs:
         mv out/* .
         mv out/* .
 
 
     - name: Cache/Restore node_modules
     - name: Cache/Restore node_modules
-      id: cache-dependencies
       uses: actions/cache@v4
       uses: actions/cache@v4
       with:
       with:
         path: |
         path: |
           **/node_modules
           **/node_modules
-        key: node_modules-app-build-prod-${{ runner.OS }}-node${{ inputs.node-version }}-${{ hashFiles('**/yarn.lock') }}
+          !**/node_modules/.cache/turbo
+        key: node_modules-app-build-prod-${{ runner.OS }}-node${{ inputs.node-version }}-${{ github.ref_name }}-${{ hashFiles('**/yarn.lock') }}
         restore-keys: |
         restore-keys: |
+          node_modules-app-build-prod-${{ runner.OS }}-node${{ inputs.node-version }}-${{ github.ref_name }}-
           node_modules-app-build-prod-${{ runner.OS }}-node${{ inputs.node-version }}-
           node_modules-app-build-prod-${{ runner.OS }}-node${{ inputs.node-version }}-
 
 
     - name: Install dependencies
     - name: Install dependencies
@@ -62,18 +63,18 @@ jobs:
         yarn global add node-gyp
         yarn global add node-gyp
         yarn --frozen-lockfile
         yarn --frozen-lockfile
 
 
-    - name: Restore dist
+    - name: Cache/Restore dist
       uses: actions/cache@v4
       uses: actions/cache@v4
       with:
       with:
         path: |
         path: |
-          node_modules/.cache/turbo
           **/.turbo
           **/.turbo
           **/dist
           **/dist
+          **/node_modules/.cache/turbo
           ${{ github.workspace }}/apps/app/.next
           ${{ github.workspace }}/apps/app/.next
-        key: dist-app-7.x-prod-${{ runner.OS }}-node${{ inputs.node-version }}-${{ github.ref_name }}-${{ github.sha }}
+        key: dist-app-prod-${{ runner.OS }}-node${{ inputs.node-version }}-${{ github.ref_name }}-${{ github.sha }}
         restore-keys: |
         restore-keys: |
-          dist-app-7.x-prod-${{ runner.OS }}-node${{ inputs.node-version }}-${{ github.ref_name }}-
-          dist-app-7.x-prod-${{ runner.OS }}-node${{ inputs.node-version }}-
+          dist-app-prod-${{ runner.OS }}-node${{ inputs.node-version }}-${{ github.ref_name }}-
+          dist-app-prod-${{ runner.OS }}-node${{ inputs.node-version }}-
 
 
     - name: Build
     - name: Build
       working-directory: ./apps/app
       working-directory: ./apps/app
@@ -159,15 +160,16 @@ jobs:
         rm -rf apps packages
         rm -rf apps packages
         mv out/* .
         mv out/* .
 
 
-    - name: Cache/Restore node_modules
-      id: cache-dependencies
-      uses: actions/cache@v4
+    - name: Restore node_modules
+      uses: actions/cache/restore@v4
       with:
       with:
         path: |
         path: |
           **/node_modules
           **/node_modules
-        key: node_modules-app-7.x-launch-prod-${{ runner.OS }}-node${{ inputs.node-version }}-${{ hashFiles('**/yarn.lock') }}
+        # shared key with build-prod
+        key: node_modules-app-build-prod-${{ runner.OS }}-node${{ inputs.node-version }}-${{ github.ref_name }}-${{ hashFiles('**/yarn.lock') }}
         restore-keys: |
         restore-keys: |
-          node_modules-app-7.x-launch-prod-${{ runner.OS }}-node${{ inputs.node-version }}-
+          node_modules-app-build-prod-${{ runner.OS }}-node${{ inputs.node-version }}-${{ github.ref_name }}-
+          node_modules-app-build-prod-${{ runner.OS }}-node${{ inputs.node-version }}-
 
 
     - name: Install dependencies
     - name: Install dependencies
       run: |
       run: |
@@ -250,15 +252,16 @@ jobs:
         rm -rf apps packages
         rm -rf apps packages
         mv out/* .
         mv out/* .
 
 
-    - name: Cache/Restore node_modules
-      id: cache-dependencies
-      uses: actions/cache@v4
+    - name: Restore node_modules
+      uses: actions/cache/restore@v4
       with:
       with:
         path: |
         path: |
           **/node_modules
           **/node_modules
-        key: node_modules-app-build-prod-${{ runner.OS }}-node${{ inputs.node-version }}-${{ hashFiles('**/yarn.lock') }}
+        # shared key with ci-app.yml
+        key: node_modules-ci-app-${{ runner.OS }}-node${{ inputs.node-version }}-${{ github.ref_name }}-${{ hashFiles('**/yarn.lock') }}
         restore-keys: |
         restore-keys: |
-          node_modules-app-build-prod-${{ runner.OS }}-node${{ inputs.node-version }}-
+          node_modules-ci-app-${{ runner.OS }}-node${{ inputs.node-version }}-${{ github.ref_name }}-
+          node_modules-ci-app-${{ runner.OS }}-node${{ inputs.node-version }}-
 
 
     - name: Cache/Restore Cypress files
     - name: Cache/Restore Cypress files
       uses: actions/cache@v4
       uses: actions/cache@v4
@@ -376,25 +379,16 @@ jobs:
         cache: 'yarn'
         cache: 'yarn'
         cache-dependency-path: '**/yarn.lock'
         cache-dependency-path: '**/yarn.lock'
 
 
-    - name: Install turbo
-      run: |
-        yarn global add turbo
-
-    - name: Prune repositories
-      run: |
-        turbo prune @growi/app
-        rm -rf apps packages
-        mv out/* .
-
-    - name: Cache/Restore node_modules
-      id: cache-dependencies
-      uses: actions/cache@v4
+    - name: Restore node_modules
+      uses: actions/cache/restore@v4
       with:
       with:
         path: |
         path: |
           **/node_modules
           **/node_modules
-        key: node_modules-app-build-prod-${{ runner.OS }}-node${{ inputs.node-version }}-${{ hashFiles('**/yarn.lock') }}
+        # shared key with ci-app.yml
+        key: node_modules-ci-app-${{ runner.OS }}-node${{ inputs.node-version }}-${{ github.ref_name }}-${{ hashFiles('**/yarn.lock') }}
         restore-keys: |
         restore-keys: |
-          node_modules-app-build-prod-${{ runner.OS }}-node${{ inputs.node-version }}-
+          node_modules-ci-app-${{ runner.OS }}-node${{ inputs.node-version }}-${{ github.ref_name }}-
+          node_modules-ci-app-${{ runner.OS }}-node${{ inputs.node-version }}-
 
 
     - name: Cache/Restore Playwright files
     - name: Cache/Restore Playwright files
       uses: actions/cache@v4
       uses: actions/cache@v4

+ 6 - 15
.github/workflows/reusable-app-reg-suit.yml

@@ -60,25 +60,16 @@ jobs:
         cache: 'yarn'
         cache: 'yarn'
         cache-dependency-path: '**/yarn.lock'
         cache-dependency-path: '**/yarn.lock'
 
 
-    - name: Install turbo
-      run: |
-        yarn global add turbo
-
-    - name: Prune repositories
-      run: |
-        turbo prune @growi/app
-        rm -rf apps packages
-        mv out/* .
-
-    - name: Cache/Restore node_modules
-      id: cache-dependencies
-      uses: actions/cache@v4
+    - name: Restore node_modules
+      uses: actions/cache/restore@v4
       with:
       with:
         path: |
         path: |
           **/node_modules
           **/node_modules
-        key: node_modules-7.x-${{ runner.OS }}-node${{ inputs.node-version }}-${{ hashFiles('**/yarn.lock') }}
+        # shared key with ci-app.yml
+        key: node_modules-ci-app-${{ runner.OS }}-node${{ inputs.node-version }}-${{ github.ref_name }}-${{ hashFiles('**/yarn.lock') }}
         restore-keys: |
         restore-keys: |
-          node_modules-7.x-${{ runner.OS }}-node${{ inputs.node-version }}-
+          node_modules-ci-app-${{ runner.OS }}-node${{ inputs.node-version }}-${{ github.ref_name }}-
+          node_modules-ci-app-${{ runner.OS }}-node${{ inputs.node-version }}-
 
 
     - name: Install dependencies
     - name: Install dependencies
       run: |
       run: |