Skip to content

Commit b8f7915

Browse files
IlyesbdlalaWeltraumschaf
authored andcommitted
Enforced use of nvm instead of npm
nvm is now installed in Configuration step and then bundled as an artifcat and passed to other jobs Signed-off-by: Ilyes Ben Dlala <[email protected]>
1 parent 2b43477 commit b8f7915

1 file changed

Lines changed: 63 additions & 16 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 63 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,34 @@ env:
1919
# ---- Language Versions ----
2020

2121
GO_VERSION: "1.19"
22-
PYTHON_VERSION: "3.9.16"
23-
NODE_VERSION: "16"
24-
NPM_VERSION: "8.19.2"
22+
PYTHON_VERSION: "3.8.10"
2523

2624
jobs:
25+
26+
# ---- Configuration ----
27+
config:
28+
name: "Configuration"
29+
runs-on: ubuntu-20.04
30+
steps:
31+
- uses: actions/checkout@v2
32+
33+
- name: Install nvm and Node.js
34+
run: |
35+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
36+
export NVM_DIR="$HOME/.nvm"
37+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
38+
nvm install "$(cat .nvmrc)"
39+
40+
- name: Archive nvm and Node.js
41+
run: |
42+
tar czf nvm-node.tar.gz -C $HOME .nvm
43+
44+
- name: Upload nvm and Node.js
45+
uses: actions/upload-artifact@v2
46+
with:
47+
name: nvm-node
48+
path: nvm-node.tar.gz
49+
2750
# ---- Unit-Test ----
2851

2952
# ---- Unit-Test | Java ----
@@ -206,6 +229,7 @@ jobs:
206229
needs:
207230
- sdk
208231
- operator
232+
- config
209233
runs-on: ubuntu-20.04
210234
strategy:
211235
fail-fast: false
@@ -235,13 +259,19 @@ jobs:
235259
- name: Checkout
236260
uses: actions/checkout@v2
237261

238-
- uses: actions/setup-node@v2
239-
name: Setup Node
262+
- name: Download nvm and Node.js
263+
uses: actions/download-artifact@v2
240264
with:
241-
node-version: ${{ env. NODE_VERSION }}
265+
name: nvm-node
266+
path: nvm-node.tar.gz
267+
268+
- name: Extract nvm and Node.js
269+
run: |
270+
tar xzf nvm-node.tar.gz -C $HOME
271+
export NVM_DIR="$HOME/.nvm"
272+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
273+
nvm use
242274
243-
- name: Update NPM
244-
run: npm i -g npm@${{ env.NPM_VERSION }}
245275
246276
- name: Install Dependencies
247277
working-directory: ./scanners/${{ matrix.unit }}/
@@ -356,18 +386,24 @@ jobs:
356386
needs:
357387
- sdk
358388
- operator
389+
- config
359390
runs-on: ubuntu-20.04
360391
steps:
361392
- name: Checkout
362393
uses: actions/checkout@v2
363394

364-
- uses: actions/setup-node@v2
365-
name: Setup Node
395+
- name: Download nvm and Node.js
396+
uses: actions/download-artifact@v2
366397
with:
367-
node-version: ${{ env. NODE_VERSION }}
398+
name: nvm-node
399+
path: nvm-node.tar.gz
368400

369-
- name: Update NPM
370-
run: npm i -g npm@${{ env.NPM_VERSION }}
401+
- name: Extract nvm and Node.js
402+
run: |
403+
tar xzf nvm-node.tar.gz -C $HOME
404+
export NVM_DIR="$HOME/.nvm"
405+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
406+
nvm use
371407
372408
- name: Install Dependencies
373409
working-directory: ./scanners/zap-advanced/
@@ -498,6 +534,7 @@ jobs:
498534
name: Test | Hook ${{ matrix.hook }} | k8s ${{ matrix.k8sVersion }}
499535
needs:
500536
- operator
537+
- config
501538
runs-on: ubuntu-20.04
502539
strategy:
503540
matrix:
@@ -620,9 +657,19 @@ jobs:
620657
working-directory: ./hooks/${{ matrix.hook }}
621658
run: make kind-import
622659

623-
# ---- Install Test Dependencies ----
624-
- name: Update NPM
625-
run: npm i -g npm@${{ env.NPM_VERSION }}
660+
- name: Download nvm and Node.js
661+
uses: actions/download-artifact@v2
662+
with:
663+
name: nvm-node
664+
path: nvm-node.tar.gz
665+
666+
- name: Extract nvm and Node.js
667+
run: |
668+
tar xzf nvm-node.tar.gz -C $HOME
669+
export NVM_DIR="$HOME/.nvm"
670+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
671+
nvm use
672+
626673
627674
- name: "Install Test Dependencies"
628675
working-directory: ./hooks

0 commit comments

Comments
 (0)