Skip to content

Commit f5b7dea

Browse files
authored
Added node_modules caching for CI workflows. (PalisadoesFoundation#1496)
1 parent 160fbaa commit f5b7dea

File tree

2 files changed

+46
-17
lines changed

2 files changed

+46
-17
lines changed

.github/workflows/inspect.yml

+19-4
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,37 @@
11
name: CI
22

33
on: [push]
4-
4+
55
jobs:
66
test:
77
name: Check Schema
88
runs-on: ubuntu-latest
9-
9+
1010
steps:
1111
- name: Checkout
1212
uses: actions/checkout@v3
1313

14+
- name: Restore node_modules from cache
15+
id: cache-npm
16+
uses: actions/cache@v3
17+
env:
18+
cache-name: cache-node-modules
19+
with:
20+
path: |
21+
~/.npm
22+
node_modules
23+
key: ${{ runner.os }}-node-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
24+
restore-keys: |
25+
${{ runner.os }}-node-${{ env.cache-name }}-
26+
${{ runner.os }}-node-
27+
${{ runner.os }}-
28+
1429
- name: Install dependencies
1530
run: npm ci
1631

1732
- name: Generate schema.graphql
18-
run: npm run gen:schema
19-
33+
run: npm run gen:schema
34+
2035
- uses: kamilkisiela/graphql-inspector@master
2136
with:
2237
schema: develop:schema.graphql

.github/workflows/pull-request.yml

+27-13
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ on:
1414
pull_request:
1515
branches:
1616
- '**'
17-
17+
1818
env:
19-
CODECOV_UNIQUE_NAME: CODECOV_UNIQUE_NAME-${{ github.run_id }}-${{ github.run_number }}
20-
19+
CODECOV_UNIQUE_NAME: CODECOV_UNIQUE_NAME-${{ github.run_id }}-${{ github.run_number }}
20+
2121
jobs:
2222
Code-Quality-Checks:
2323
name: Check for linting, formatting, and type errors
@@ -26,18 +26,33 @@ jobs:
2626
- name: Checkout repository content
2727
uses: actions/checkout@v3
2828

29+
- name: Restore node_modules from cache
30+
id: cache-npm
31+
uses: actions/cache@v3
32+
env:
33+
cache-name: cache-node-modules
34+
with:
35+
path: |
36+
~/.npm
37+
node_modules
38+
key: ${{ runner.os }}-code-quality-checks-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
39+
restore-keys: |
40+
${{ runner.os }}-code-quality-checks-${{ env.cache-name }}-
41+
${{ runner.os }}-code-quality-checks-
42+
${{ runner.os }}-
43+
2944
- name: Install Dependencies
3045
run: npm ci
31-
46+
3247
- name: Run ESLint to check for linting errors
3348
run: npm run lint:check
34-
49+
3550
- name: Check for formatting errors
3651
run: npm run format:check
37-
52+
3853
- name: Run Typescript Type-Checker
3954
run: npm run typecheck
40-
55+
4156
Test-Application:
4257
name: Testing Application
4358
runs-on: ubuntu-latest
@@ -68,16 +83,16 @@ jobs:
6883
MONGO_DB_URL: mongodb://localhost:27017/talawa-test-db
6984
REDIS_HOST: localhost
7085
REDIS_PORT: 6379
71-
# ACCESS_TOKEN_SECRET: ${{ secrets.ACCESS_TOKEN_SECRET }}
72-
# REFRESH_TOKEN_SECRET: ${{ secrets.REFRESH_TOKEN_SECRET }}
86+
# ACCESS_TOKEN_SECRET: ${{ secrets.ACCESS_TOKEN_SECRET }}
87+
# REFRESH_TOKEN_SECRET: ${{ secrets.REFRESH_TOKEN_SECRET }}
7388

7489
steps:
7590
- name: Checkout repository
7691
uses: actions/checkout@v3
77-
92+
7893
- name: Generate Access Token Secret
7994
run: echo "ACCESS_TOKEN_SECRET=$(openssl rand -hex 32)" >> $GITHUB_ENV
80-
95+
8196
- name: Generate Refresh Token Secret
8297
run: echo "REFRESH_TOKEN_SECRET=$(openssl rand -hex 32)" >> $GITHUB_ENV
8398

@@ -100,7 +115,7 @@ jobs:
100115
with:
101116
verbose: true
102117
fail_ci_if_error: false
103-
name: '${{env.CODECOV_UNIQUE_NAME}}'
118+
name: '${{env.CODECOV_UNIQUE_NAME}}'
104119

105120
- name: Test acceptable level of code coverage
106121
uses: VeryGoodOpenSource/very_good_coverage@v2
@@ -123,4 +138,3 @@ jobs:
123138
if: env.RUN_JSDOCS == 'True'
124139
run: echo "Run JSdocs :${{ env.RUN_JSDOCS }}"
125140

126-

0 commit comments

Comments
 (0)