Skip to content

Commit

Permalink
github/workflows: simplify npm cache setup (#3404)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed Dec 4, 2021
1 parent 13530ce commit ce4277e
Showing 1 changed file with 13 additions and 68 deletions.
81 changes: 13 additions & 68 deletions .github/workflows/ci.yml
Expand Up @@ -13,16 +13,9 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v2
with:
cache: npm
node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }}

- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
- name: Install Dependencies
run: npm ci

Expand Down Expand Up @@ -65,16 +58,17 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v2
with:
cache: npm
node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }}

- name: Run npm install
run: npm install --package-lock-only --engine-strict --strict-peer-deps
run: npm install --engine-strict --strict-peer-deps

- name: Check that package-lock.json is in sync with package.json
run: git diff --exit-code package-lock.json

- name: Check that package-lock.json doesn't have conflicts
run: npm ls --package-lock-only --depth 999
run: npm ls --depth 999

integrationTests:
name: Run integration tests
Expand All @@ -87,9 +81,9 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }}
# We install bunch of packages during integration tests without locking them
# so we skip cache action to not pollute cache for other jobs.

# We install bunch of packages during integration tests without locking them
# so we skip cache action to not pollute cache for other jobs.
- name: Install Dependencies
run: npm ci

Expand All @@ -106,16 +100,9 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v2
with:
cache: npm
node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }}

- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
- name: Install Dependencies
run: npm ci

Expand All @@ -132,16 +119,9 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v2
with:
cache: npm
node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }}

- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
- name: Install Dependencies
run: npm ci

Expand All @@ -168,16 +148,9 @@ jobs:
- name: Setup Node.js v${{ matrix.node_version_to_setup }}
uses: actions/setup-node@v2
with:
cache: npm
node-version: ${{ matrix.node_version_to_setup }}

- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
- name: Install Dependencies
run: npm ci

Expand All @@ -196,16 +169,9 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v2
with:
cache: npm
node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }}

- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
- name: Install Dependencies
run: npm ci

Expand All @@ -224,16 +190,9 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v2
with:
cache: npm
node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }}

- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
- name: Install Dependencies
run: npm ci

Expand Down Expand Up @@ -264,16 +223,9 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v2
with:
cache: npm
node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }}

- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
- name: Install Dependencies
run: npm ci

Expand All @@ -300,16 +252,9 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v2
with:
cache: npm
node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }}

- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
- name: Install Dependencies
run: npm ci

Expand Down

0 comments on commit ce4277e

Please sign in to comment.