From 6f7c39dd402292af7550ad890fd05a1224d08635 Mon Sep 17 00:00:00 2001 From: Mac Siri Date: Thu, 7 Mar 2024 14:55:05 -0500 Subject: [PATCH] [CI] Remove node_module cache (#20746) --- .github/workflows/ci.yml | 67 ++++-------------------------- .github/workflows/create-cache.yml | 6 --- 2 files changed, 8 insertions(+), 65 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e866d5889..b9b059546 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,13 +20,13 @@ env: KNAPSACK_PRO_FIXED_QUEUE_SPLIT: true POSTGRES_PASSWORD: postgres KNAPSACK_PRO_LOG_LEVEL: info + YARN_ENABLE_HARDENED_MODE: 0 jobs: build: runs-on: ubuntu-latest env: E2E: true - YARN_ENABLE_HARDENED_MODE: 0 steps: - uses: actions/checkout@v4 @@ -34,21 +34,6 @@ jobs: uses: ruby/setup-ruby@v1 with: bundler-cache: true - - name: Look up node_modules cache - id: nmcache - uses: actions/cache/restore@v4 - with: - lookup-only: true - path: node_modules - key: ${{ runner.os }}-node-modules-v2-${{ hashFiles('**/yarn.lock') }} - restore-keys: ${{ runner.os }}-node-modules-v2- - - name: Download node_modules cache if no exact cache-key match - uses: actions/cache@v4 - with: - path: node_modules - key: ${{ runner.os }}-node-modules-v2-${{ hashFiles('**/yarn.lock') }} - restore-keys: ${{ runner.os }}-node-modules-v2- - if: steps.nmcache.outputs.cache-hit != 'true' - name: Cache pre-compiled assets uses: actions/cache@v4 id: assetscache @@ -61,9 +46,9 @@ jobs: with: node-version-file: '.nvmrc' cache: yarn - if: steps.nmcache.outputs.cache-hit != 'true' || steps.assetscache.outputs.cache-hit != 'true' + if: steps.assetscache.outputs.cache-hit != 'true' - run: yarn install --immutable - if: steps.nmcache.outputs.cache-hit != 'true' || steps.assetscache.outputs.cache-hit != 'true' + if: steps.assetscache.outputs.cache-hit != 'true' - run: bundle exec rails assets:precompile if: steps.assetscache.outputs.cache-hit != 'true' @@ -81,12 +66,7 @@ jobs: with: node-version-file: '.nvmrc' cache: yarn - - name: Restore node_modules - uses: actions/cache/restore@v4 - with: - path: node_modules - key: ${{ runner.os }}-node-modules-v2-${{ hashFiles('**/yarn.lock') }} - restore-keys: ${{ runner.os }}-node-modules-v2- + - run: yarn install --immutable - name: rubocop uses: reviewdog/action-rubocop@v2 with: @@ -133,12 +113,6 @@ jobs: public/assets key: ${{ runner.os }}-compiled-assets-v3-${{ hashFiles('app/assets/**', 'app/javascript/**', '**/package.json', '**/yarn.lock') }} restore-keys: ${{ runner.os }}-compiled-assets-v3- - - name: Restore node_modules - uses: actions/cache/restore@v4 - with: - path: node_modules - key: ${{ runner.os }}-node-modules-v2-${{ hashFiles('**/yarn.lock') }} - restore-keys: ${{ runner.os }}-node-modules-v2- - uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' @@ -180,16 +154,11 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Restore node_modules - uses: actions/cache/restore@v4 - with: - path: node_modules - key: ${{ runner.os }}-node-modules-v2-${{ hashFiles('**/yarn.lock') }} - restore-keys: ${{ runner.os }}-node-modules-v2- - uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' cache: yarn + - run: yarn install --immutable - run: yarn test --colors --ci --reporters="jest-junit" --reporters="default" - name: Upload test results to BuildPulse for flaky test detection if: '!cancelled()' # Run this step even when the tests fail. Skip if the workflow is cancelled. @@ -212,12 +181,7 @@ jobs: timeout-minutes: 20 steps: - uses: actions/checkout@v4 - - name: Restore node_modules - uses: actions/cache/restore@v4 - with: - path: node_modules - key: ${{ runner.os }}-node-modules-v2-${{ hashFiles('**/yarn.lock') }} - restore-keys: ${{ runner.os }}-node-modules-v2- + - run: yarn install --immutable - uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' @@ -239,6 +203,7 @@ jobs: SECRET_KEY_BASE: dummydummydummy GITHUB_KEY: dummy GITHUB_SECRET: dummy + YARN_ENABLE_HARDENED_MODE: 1 services: postgres: @@ -254,12 +219,6 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Restore node_modules - uses: actions/cache/restore@v4 - with: - path: node_modules - key: ${{ runner.os }}-node-modules-v2-${{ hashFiles('**/yarn.lock') }} - restore-keys: ${{ runner.os }}-node-modules-v2- - uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' @@ -307,26 +266,16 @@ jobs: public/assets key: ${{ runner.os }}-compiled-assets-v3-${{ hashFiles('app/assets/**', 'app/javascript/**', '**/package.json', '**/yarn.lock') }} restore-keys: ${{ runner.os }}-compiled-assets-v3- - - name: Restore node_modules - uses: actions/cache/restore@v4 - with: - path: node_modules - key: ${{ runner.os }}-node-modules-v2-${{ hashFiles('**/yarn.lock') }} - restore-keys: ${{ runner.os }}-node-modules-v2- - uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' cache: yarn + - run: yarn install --immutable - name: setup ruby uses: ruby/setup-ruby@v1 with: bundler-cache: true - run: bundle exec rails db:test:prepare - - name: Cache cypress binary - uses: actions/cache@v4 - with: - path: ~/.cache/Cypress - key: ${{ runner.os }}-cypress-binary-${{ hashFiles('**/yarn.lock') }} - run: yarn cypress install - name: cypress env: diff --git a/.github/workflows/create-cache.yml b/.github/workflows/create-cache.yml index b685fc8f5..99cbc2793 100644 --- a/.github/workflows/create-cache.yml +++ b/.github/workflows/create-cache.yml @@ -14,12 +14,6 @@ jobs: - uses: ruby/setup-ruby@v1 with: bundler-cache: true - - name: Cache node_modules - uses: actions/cache@v4 - with: - path: node_modules - key: ${{ runner.os }}-node-modules-v2-${{ hashFiles('**/yarn.lock') }} - restore-keys: ${{ runner.os }}-node-modules-v2- - uses: actions/setup-node@v4 with: node-version-file: '.nvmrc'