Skip to content

Commit 4fd42cb

Browse files
committed
feat: use cache for node js github actions
1 parent 50a62ef commit 4fd42cb

17 files changed

+165
-97
lines changed

.github/workflows/cd-core.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
- uses: actions/setup-node@v4
1414
with:
1515
node-version-file: .nvmrc
16+
cache: yarn
1617
- run: yarn --ignore-scripts
1718
name: Install dependencies
1819
- run: yarn build

.github/workflows/cd-deploy-contracts.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ jobs:
3838
- uses: actions/setup-node@v4
3939
with:
4040
node-version-file: .nvmrc
41+
cache: yarn
4142
- name: Install dependencies
42-
run: npm install --global yarn && yarn --ignore-scripts
43+
run: yarn --ignore-scripts
4344
- run: yarn build
4445
name: Build core package
4546
working-directory: ./packages/core

.github/workflows/cd-node-sdk.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
- uses: actions/setup-node@v4
1919
with:
2020
node-version-file: .nvmrc
21+
cache: yarn
2122
- run: yarn --ignore-scripts
2223
name: Install dependencies
2324
- run: yarn build

.github/workflows/cd-python-sdk.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,14 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- uses: actions/checkout@v4
18-
- run: yarn --ignore-scripts
19-
name: Install dependencies
20-
- run: yarn build
21-
name: Build core package
18+
- uses: actions/setup-node@v4
19+
with:
20+
node-version-file: .nvmrc
21+
cache: yarn
22+
- name: Install dependencies
23+
run: yarn --ignore-scripts
24+
- name: Build core package
25+
run: yarn build
2226
working-directory: ./packages/core
2327
- name: Set up Python
2428
uses: actions/setup-python@v5

.github/workflows/cd-subgraph.yaml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ jobs:
2727
max-parallel: 3
2828
steps:
2929
- uses: actions/checkout@v4
30-
- uses: actions/setup-node@v4
31-
name: Set up Node.js
30+
- uses: actions/setup-node@v4
3231
with:
3332
node-version-file: .nvmrc
33+
cache: yarn
3434
- name: Filter Networks
3535
id: filter_networks
3636
run: |
@@ -47,30 +47,30 @@ jobs:
4747
done
4848
echo "Match found: $MATCH"
4949
echo "::set-output name=continue::$MATCH"
50-
- run: npm install --global yarn && yarn
51-
name: Install dependencies
50+
- name: Install dependencies
5251
if: steps.filter_networks.outputs.continue == 'true'
53-
- run: yarn build
54-
name: Build core package
52+
run: yarn
53+
- name: Build core package
54+
if: steps.filter_networks.outputs.continue == 'true'
55+
run: yarn build
5556
working-directory: ./packages/core
57+
- name: Install Graph CLI
5658
if: steps.filter_networks.outputs.continue == 'true'
57-
- run: yarn global add @graphprotocol/graph-cli@0.71.2
58-
name: Install Graph CLI
59+
run: yarn global add @graphprotocol/graph-cli@0.71.2
60+
- name: Authenticate Graph CLI
5961
if: steps.filter_networks.outputs.continue == 'true'
60-
- run: graph auth --studio ${API_KEY}
61-
name: Authenticate Graph CLI
62+
run: graph auth --studio ${API_KEY}
6263
env:
6364
API_KEY: ${{ secrets.HP_GRAPH_API_KEY }}
65+
- name: Generate and build Subgraph
6466
if: steps.filter_networks.outputs.continue == 'true'
65-
- run: yarn generate && yarn build
66-
name: Generate and build Subgraph
67+
run: yarn generate && yarn build
6768
working-directory: ./packages/sdk/typescript/subgraph
6869
env:
6970
NETWORK: ${{ matrix.network.name }}
71+
- name: Deploy Subgraph
7072
if: steps.filter_networks.outputs.continue == 'true'
71-
- run: graph deploy --studio ${NETWORK} -l ${{ github.event.inputs.label }}
72-
name: Deploy Subgraph
73+
run: graph deploy --studio ${NETWORK} -l ${{ github.event.inputs.label }}
7374
working-directory: ./packages/sdk/typescript/subgraph
7475
env:
7576
NETWORK: ${{ matrix.network.name }}
76-
if: steps.filter_networks.outputs.continue == 'true'
Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
name: "Dependency Review"
2-
on: [pull_request]
1+
name: Dependency Review
2+
on:
3+
push:
4+
branches:
5+
- develop
6+
- main
7+
pull_request:
8+
branches:
9+
- develop
10+
- main
311

412
permissions:
513
contents: read
@@ -8,7 +16,6 @@ jobs:
816
dependency-review:
917
runs-on: ubuntu-latest
1018
steps:
11-
- name: "Checkout Repository"
12-
uses: actions/checkout@v4.1.1
13-
- name: "Dependency Review"
19+
- uses: actions/checkout@v4.1.1
20+
- name: Dependency Review
1421
uses: actions/dependency-review-action@v4.5.0

.github/workflows/ci-lint.yaml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ name: Lint check
33
on:
44
push:
55
branches:
6-
- "main"
6+
- develop
7+
- main
78
pull_request:
8-
workflow_dispatch:
9+
branches:
10+
- develop
11+
- main
912

1013
jobs:
1114
lint:
@@ -16,7 +19,8 @@ jobs:
1619
- uses: actions/setup-node@v4
1720
with:
1821
node-version-file: .nvmrc
19-
- run: npm install --global yarn && yarn
20-
name: Install dependencies
21-
- run: yarn lint
22-
name: Run lint
22+
cache: yarn
23+
- name: Install dependencies
24+
run: yarn
25+
- name: Run lint
26+
run: yarn lint

.github/workflows/ci-test-core.yaml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@ name: Protocol check
33
on:
44
push:
55
branches:
6-
- 'main'
6+
- develop
7+
- main
78
pull_request:
9+
branches:
10+
- develop
11+
- main
812
paths:
913
- 'packages/core/**'
10-
workflow_dispatch:
1114

1215
jobs:
1316
core-test:
@@ -18,7 +21,8 @@ jobs:
1821
- uses: actions/setup-node@v4
1922
with:
2023
node-version-file: .nvmrc
21-
- run: npm install --global yarn && yarn --ignore-scripts
22-
name: Install dependencies
23-
- run: yarn workspace @human-protocol/core test
24-
name: Run protocol test
24+
cache: yarn
25+
- name: Install dependencies
26+
run: yarn --ignore-scripts
27+
- name: Run protocol test
28+
run: yarn workspace @human-protocol/core test

.github/workflows/ci-test-dashboard.yaml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@ name: Dashboard Check
33
on:
44
push:
55
branches:
6-
- 'main'
6+
- develop
7+
- main
78
pull_request:
9+
branches:
10+
- develop
11+
- main
812
paths:
913
- 'packages/core/**'
1014
- 'packages/sdk/typescript/human-protocol-sdk/**'
1115
- 'packages/apps/dashboard/**'
12-
workflow_dispatch:
1316

1417
jobs:
1518
dashboard-server-test:
@@ -20,7 +23,8 @@ jobs:
2023
- uses: actions/setup-node@v4
2124
with:
2225
node-version-file: .nvmrc
23-
- run: npm install --global yarn && yarn
24-
name: Install dependencies
25-
- run: yarn workspace @human-protocol/dashboard-server test
26-
name: Run dashboard Server test
26+
cache: yarn
27+
- name: Install dependencies
28+
run: yarn
29+
- name: Run dashboard Server test
30+
run: yarn workspace @human-protocol/dashboard-server test

.github/workflows/ci-test-faucet-server.yaml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@ name: Faucet server check
33
on:
44
push:
55
branches:
6-
- 'main'
6+
- develop
7+
- main
78
pull_request:
9+
branches:
10+
- develop
11+
- main
812
paths:
913
- 'packages/core/**'
1014
- 'packages/sdk/typescript/human-protocol-sdk/**'
1115
- 'packages/apps/faucet/server/**'
12-
workflow_dispatch:
1316

1417
jobs:
1518
faucet-server-test:
@@ -20,10 +23,11 @@ jobs:
2023
- uses: actions/setup-node@v4
2124
with:
2225
node-version-file: .nvmrc
23-
- run: npm install --global yarn && yarn
24-
name: Install dependencies
25-
- run: cp .env.example .env
26-
name: Create .env file
26+
cache: yarn
27+
- name: Install dependencies
28+
run: yarn
29+
- name: Create .env file
30+
run: cp .env.example .env
2731
working-directory: packages/apps/faucet/server
28-
- run: yarn workspace @human-protocol/faucet-server test
29-
name: Run faucet/server test
32+
- name: Run faucet/server test
33+
run: yarn workspace @human-protocol/faucet-server test

0 commit comments

Comments
 (0)