Skip to content

Commit 4de3046

Browse files
ci: fix caches and permissions (#960)
* Remove restore keys * Rename pnpm key * Use sha for lerna * Use restore and save actions * Save lerna at the end * Fix typo * Remove cargo install * Move functional tests under tests * Add read read * Set permissions on all workers * style: resolve style guide violations * Remove permissions from codeql * Add toolchain back
1 parent cd480fc commit 4de3046

7 files changed

Lines changed: 119 additions & 119 deletions

File tree

.github/workflows/circular.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
pull_request:
99
types: [ready_for_review, synchronize, opened]
1010

11+
permissions:
12+
contents: read
13+
1114
jobs:
1215
source:
1316
runs-on: ubuntu-latest

.github/workflows/contracts.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ on:
1111
- main
1212
- develop
1313

14+
permissions:
15+
contents: read
16+
1417
env:
1518
FOUNDRY_PROFILE: ci
1619
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/deps.yml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
name: Dependencies
2+
on:
3+
pull_request:
4+
types:
5+
- ready_for_review
6+
- synchronize
7+
- opened
8+
push:
9+
branches:
10+
- main
11+
- develop
12+
13+
permissions:
14+
contents: read
15+
116
jobs:
217
source:
318
runs-on: ubuntu-latest
@@ -36,14 +51,3 @@ jobs:
3651
strategy:
3752
matrix:
3853
node-version: [22.x]
39-
name: Dependencies
40-
on:
41-
pull_request:
42-
types:
43-
- ready_for_review
44-
- synchronize
45-
- opened
46-
push:
47-
branches:
48-
- main
49-
- develop

.github/workflows/functional.yml

Lines changed: 0 additions & 68 deletions
This file was deleted.

.github/workflows/lint-internal.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
pull_request:
99
types: [ready_for_review, synchronize, opened]
1010

11+
permissions:
12+
contents: read
13+
1114
jobs:
1215
source:
1316
runs-on: ubuntu-latest

.github/workflows/publish-develop.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ env:
44
DEBUG: napi:*
55
APP_NAME: evm
66
MACOSX_DEPLOYMENT_TARGET: "10.13"
7+
78
permissions:
8-
contents: write
9-
id-token: write
9+
contents: read
1010

1111
on:
1212
push:

.github/workflows/test.yml

Lines changed: 93 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,15 @@ on:
1111
- main
1212
- develop
1313

14+
permissions:
15+
contents: read
16+
1417
env:
1518
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
1619

1720
jobs:
1821
build:
22+
name: "Build"
1923
strategy:
2024
matrix:
2125
node-version: [22.x]
@@ -46,15 +50,8 @@ jobs:
4650
- name: Cache pnpm modules
4751
uses: actions/cache@v4
4852
with:
49-
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
53+
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}
5054
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
51-
restore-keys: ${{ runner.os }}-pnpm-
52-
53-
- name: Cache lerna
54-
uses: actions/cache@v4
55-
with:
56-
key: lerna-${{ runner.os }}-${{ github.run_id }}
57-
path: ./.cache
5855

5956
- uses: actions-rs/toolchain@v1
6057
with:
@@ -65,10 +62,18 @@ jobs:
6562

6663
- name: Install dependencies
6764
run: pnpm install
65+
6866
- name: Build
6967
run: pnpm run build
7068

69+
- name: Cache lerna
70+
uses: actions/cache/save@v4
71+
with:
72+
key: lerna-${{ github.sha }}
73+
path: ./.cache
74+
7175
unit:
76+
name: "Unit"
7277
needs:
7378
- build
7479
strategy:
@@ -95,17 +100,15 @@ jobs:
95100
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
96101
shell: bash
97102
- name: Cache pnpm modules
98-
uses: actions/cache@v4
103+
uses: actions/cache/restore@v4
99104
with:
100-
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
105+
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}
101106
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
102-
restore-keys: ${{ runner.os }}-pnpm-
103107
- name: Cache lerna
104-
uses: actions/cache@v4
108+
uses: actions/cache/restore@v4
105109
with:
106-
key: lerna-${{ runner.os }}
110+
key: lerna-${{ github.sha }}
107111
path: ./.cache
108-
restore-keys: lerna-${{ runner.os }}-
109112
- uses: actions-rs/toolchain@v1
110113
with:
111114
toolchain: stable
@@ -264,6 +267,7 @@ jobs:
264267
flags: packages
265268

266269
integration:
270+
name: "Integration"
267271
needs:
268272
- build
269273
strategy:
@@ -301,17 +305,15 @@ jobs:
301305
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
302306
shell: bash
303307
- name: Cache pnpm modules
304-
uses: actions/cache@v4
308+
uses: actions/cache/restore@v4
305309
with:
306-
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
310+
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}
307311
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
308-
restore-keys: ${{ runner.os }}-pnpm-
309312
- name: Cache lerna
310-
uses: actions/cache@v4
313+
uses: actions/cache/restore@v4
311314
with:
312-
key: lerna-${{ runner.os }}
315+
key: lerna-${{ github.sha }}
313316
path: ./.cache
314-
restore-keys: lerna-${{ runner.os }}-
315317
- name: Install dependencies
316318
run: pnpm install
317319
- name: Build
@@ -353,17 +355,15 @@ jobs:
353355
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
354356
shell: bash
355357
- name: Cache pnpm modules
356-
uses: actions/cache@v4
358+
uses: actions/cache/restore@v4
357359
with:
358-
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
360+
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}
359361
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
360-
restore-keys: ${{ runner.os }}-pnpm-
361362
- name: Cache lerna
362-
uses: actions/cache@v4
363+
uses: actions/cache/restore@v4
363364
with:
364-
key: lerna-${{ runner.os }}
365+
key: lerna-${{ github.sha }}
365366
path: ./.cache
366-
restore-keys: lerna-${{ runner.os }}-
367367
- name: Install dependencies
368368
run: pnpm install
369369
- name: Build
@@ -439,17 +439,15 @@ jobs:
439439
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
440440
shell: bash
441441
- name: Cache pnpm modules
442-
uses: actions/cache@v4
442+
uses: actions/cache/restore@v4
443443
with:
444-
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
444+
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}
445445
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
446-
restore-keys: ${{ runner.os }}-pnpm-
447446
- name: Cache lerna
448-
uses: actions/cache@v4
447+
uses: actions/cache/restore@v4
449448
with:
450-
key: lerna-${{ runner.os }}
449+
key: lerna-${{ github.sha }}
451450
path: ./.cache
452-
restore-keys: lerna-${{ runner.os }}-
453451
- name: Install dependencies
454452
run: pnpm install
455453
- name: Build
@@ -498,17 +496,15 @@ jobs:
498496
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
499497
shell: bash
500498
- name: Cache pnpm modules
501-
uses: actions/cache@v4
499+
uses: actions/cache/restore@v4
502500
with:
503-
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
501+
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}
504502
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
505-
restore-keys: ${{ runner.os }}-pnpm-
506503
- name: Cache lerna
507-
uses: actions/cache@v4
504+
uses: actions/cache/restore@v4
508505
with:
509-
key: lerna-${{ runner.os }}
506+
key: lerna-${{ github.sha }}
510507
path: ./.cache
511-
restore-keys: lerna-${{ runner.os }}-
512508
- name: Install dependencies
513509
run: pnpm install
514510
- name: Build
@@ -544,3 +540,62 @@ jobs:
544540
- name: Show logs - checks
545541
if: always()
546542
run: docker logs snapshot-checks-1
543+
544+
functional:
545+
name: "Functional - ${{matrix.name}}"
546+
needs:
547+
- build
548+
concurrency:
549+
cancel-in-progress: true
550+
group: ${{ github.head_ref }}-functional-${{matrix.name}}
551+
runs-on: ubuntu-latest
552+
553+
strategy:
554+
matrix:
555+
node-version: [22.x]
556+
name: ["transaction-pool-api"]
557+
558+
services:
559+
postgres:
560+
image: postgres:16
561+
env:
562+
POSTGRES_DB: test_db
563+
POSTGRES_USER: test_db
564+
POSTGRES_PASSWORD: password
565+
ports:
566+
- 127.0.0.1:5432:5432
567+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
568+
569+
steps:
570+
- uses: actions/checkout@v4
571+
with:
572+
ref: ${{ github.head_ref }}
573+
- uses: actions/setup-node@v4
574+
with:
575+
node-version: ${{ matrix.node-version }}
576+
- name: Setup pnpm
577+
uses: pnpm/action-setup@v4
578+
with:
579+
run_install: false
580+
version: latest
581+
- name: Get pnpm store directory
582+
id: pnpm-cache
583+
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
584+
shell: bash
585+
- name: Cache pnpm modules
586+
uses: actions/cache/restore@v4
587+
with:
588+
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}
589+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
590+
- name: Cache lerna
591+
uses: actions/cache/restore@v4
592+
with:
593+
key: lerna-${{ github.sha }}
594+
path: ./.cache
595+
- name: Install dependencies
596+
run: pnpm install
597+
- name: Build
598+
run: pnpm run build
599+
600+
- name: Test ${{ matrix.name }}
601+
run: cd tests/functional/${{ matrix.name }} && pnpm run test:full

0 commit comments

Comments
 (0)