Skip to content

Commit e9fa14e

Browse files
committed
ci: blocklist package installation in GitHub workflows
Create install action and update all workflows: ✅ Added Yarn constraints infrastructure - Installed @yarnpkg/plugin-constraints - Configured in .yarnrc.yml - Created empty .yarn/constraints.pro for rules - Updated .gitignore to track constraints.pro ✅ Created .github/actions/install/action.yml - Centralized yarn install with security flags - Configurable install args and memory settings - Clean max-old-space-size input (MB only) - Mandatory yarn constraints verification ✅ Updated 9 workflows to use action: - continuous-integration-unit-tests.yaml - continuous-integration-e2e.yaml - continuous-integration-side-tests.yaml - continuous-integration-blockfrost-e2e.yaml - test-deploy-e2e.yaml - k6-web-socket.yaml - k6-wallets.yaml - release.yaml - post_integration.yml 🎯 Benefits: - Single source of truth for install logic - Easy to add constraint checks later - Consistent security posture across all workflows - Reduced duplication and maintenance burden - Foundation ready for security policy enforcement
1 parent 08dafd6 commit e9fa14e

14 files changed

+112
-24
lines changed

.github/actions/install/action.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: 'Install Dependencies'
2+
description: 'Install dependencies with yarn and run security constraint checks'
3+
inputs:
4+
install-args:
5+
description: 'Additional arguments for yarn install'
6+
required: false
7+
default: '--inline-builds --mode=skip-build'
8+
max-old-space-size:
9+
description: 'Maximum old space size in MB for Node.js'
10+
required: false
11+
default: '8192'
12+
runs:
13+
using: 'composite'
14+
steps:
15+
- name: 🔨 Install
16+
shell: bash
17+
run: yarn install --immutable --immutable-cache ${{ inputs.install-args }}
18+
env:
19+
NODE_OPTIONS: '--max_old_space_size=${{ inputs.max-old-space-size }}'
20+
npm_config_ignore_scripts: ${{ vars.DISABLE_NPM_SCRIPTS || 'false' }}
21+
22+
- name: 🛡️ Security Constraints Check
23+
shell: bash
24+
run: yarn constraints

.github/workflows/continuous-integration-blockfrost-e2e.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,16 @@ jobs:
5353
with:
5454
node-version: 18.12.0
5555

56+
- name: 🔨 Install
57+
uses: ./.github/actions/install
58+
5659
- name: 🔨 Build
5760
run: |
58-
yarn install --immutable --inline-builds --mode=skip-build
5961
yarn workspace @cardano-sdk/cardano-services-client build:cjs
6062
yarn workspace @cardano-sdk/cardano-services build:cjs
6163
yarn workspace @cardano-sdk/e2e build:cjs
6264
yarn workspace @cardano-sdk/util-dev build:cjs
6365
docker build --no-cache .
64-
env:
65-
NODE_OPTIONS: '--max_old_space_size=8192'
6666
6767
- name: 🌐 Setup local test network
6868
working-directory: packages/e2e

.github/workflows/continuous-integration-e2e.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,11 @@ jobs:
5353
with:
5454
node-version: 18.12.0
5555

56+
- name: 🔨 Install
57+
uses: ./.github/actions/install
58+
5659
- name: 🔨 Build
5760
run: |
58-
yarn install --immutable --inline-builds --mode=skip-build
5961
yarn workspace @cardano-sdk/cardano-services-client build:cjs
6062
yarn workspace @cardano-sdk/cardano-services build:cjs
6163
yarn workspace @cardano-sdk/e2e build:cjs

.github/workflows/continuous-integration-side-tests.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@ jobs:
2525
with:
2626
node-version: 18.12.0
2727

28+
- name: 🔨 Install
29+
uses: ./.github/actions/install
30+
2831
- name: 🔨 Build
29-
run: |
30-
yarn install --immutable --inline-builds --mode=skip-build
31-
yarn build
32+
run: yarn build
3233
env:
3334
NODE_OPTIONS: '--max_old_space_size=8192'
3435

.github/workflows/continuous-integration-unit-tests.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@ jobs:
2525
with:
2626
node-version: 18.12.0
2727

28+
- name: 🔨 Install
29+
uses: ./.github/actions/install
30+
2831
- name: 🔨 Build
29-
run: |
30-
yarn install --immutable --inline-builds --mode=skip-build
31-
yarn build
32+
run: yarn build
3233
env:
3334
NODE_OPTIONS: '--max_old_space_size=8192'
3435

.github/workflows/k6-wallets.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,11 @@ jobs:
6767
uses: actions/setup-node@v3
6868
with:
6969
node-version: 18.12.0
70+
- name: 🔨 Install
71+
uses: ./.github/actions/install
72+
7073
- name: 🔨 Build
71-
run: |
72-
yarn install --immutable --inline-builds --mode=skip-build
73-
yarn workspace @cardano-sdk/util-dev build:cjs
74+
run: yarn workspace @cardano-sdk/util-dev build:cjs
7475
env:
7576
NODE_OPTIONS: '--max_old_space_size=8192'
7677
- name: Run k6 cloud test

.github/workflows/k6-web-socket.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,11 @@ jobs:
5959
uses: actions/setup-node@v3
6060
with:
6161
node-version: 18.12.0
62+
- name: 🔨 Install
63+
uses: ./.github/actions/install
64+
6265
- name: 🔨 Build
63-
run: |
64-
yarn install --immutable --inline-builds --mode=skip-build
65-
yarn workspace @cardano-sdk/util-dev build:cjs
66+
run: yarn workspace @cardano-sdk/util-dev build:cjs
6667
env:
6768
NODE_OPTIONS: '--max_old_space_size=8192'
6869
- name: Run k6 cloud test

.github/workflows/post_integration.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ jobs:
1717
with:
1818
node-version: 18.12.0
1919

20+
- name: 🔨 Install
21+
uses: ./.github/actions/install
22+
with:
23+
max-old-space-size: '10240'
24+
2025
- name: 🔨 Build Docs
21-
env:
22-
NODE_OPTIONS: '--max-old-space-size=10240'
2326
run: |
24-
yarn install --immutable --inline-builds
2527
yarn build
2628
yarn docs
2729

.github/workflows/release.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ jobs:
3434
git_commit_gpgsign: true
3535

3636
- name: 💽 Install dependencies
37-
run: |
38-
yarn install --immutable --inline-builds --mode=skip-build
37+
uses: ./.github/actions/install
3938
env:
4039
YARN_ENABLE_IMMUTABLE_INSTALLS: false
4140

.github/workflows/test-deploy-e2e.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ jobs:
6565
with:
6666
node-version: 18.12.0
6767

68+
- name: 🔨 Install
69+
uses: ./.github/actions/install
70+
6871
- name: 🔨 Build
6972
run: |
70-
yarn install --immutable --inline-builds --mode=skip-build
7173
yarn build:cjs
7274
docker build --no-cache .
73-
env:
74-
NODE_OPTIONS: '--max_old_space_size=8192'
7575
7676
- name: 🔬 Test - e2e - wallet
7777
env:

0 commit comments

Comments
 (0)