Skip to content

Commit c70827f

Browse files
J12934Weltraumschaf
authored andcommitted
Replace custom nvm setup with the official action
Signed-off-by: Jannik Hollenbach <jannik.hollenbach@iteratec.com>
1 parent 0326804 commit c70827f

1 file changed

Lines changed: 12 additions & 82 deletions

File tree

‎.github/workflows/ci.yaml‎

Lines changed: 12 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -18,62 +18,22 @@ env:
1818

1919
GO_VERSION: "1.19"
2020
PYTHON_VERSION: "3.9.16"
21-
NVM_VERSION: "0.39.3" # Does not need to be updated as often as the Node.js version or the NPM version
2221
KIND_NODE_IMAGE: "kindest/node:v1.28.0@sha256:b7a4cad12c197af3ba43202d3efe03246b3f0793f162afb40a33c923952d5b31"
2322
KIND_BINARY_VERSION: "v0.20.0"
2423
KUBECTL_VERSION: "v1.27.4"
2524
HELM_VERSION: "v3.12.2"
2625
HELM_PLUGIN_UNITTEST: "0.4.1"
2726

2827
jobs:
29-
# ---- NVM Setup ----
30-
# It is more efficient to do the installation process of nvm only once and upload it as an archive.
31-
# This can later be imported and extracted quickly in the hooks/scanners testing containers.
32-
# It also ensures that we pull from an external source to install nvm only once, instead of x number of hooks + y number of scanners
33-
nvm-setup:
34-
name: "Configuration"
35-
runs-on: ubuntu-22.04
36-
steps:
37-
- uses: actions/checkout@v4
38-
39-
- name: Install nvm and Node.js
40-
run: |
41-
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v${{ env.NVM_VERSION }}/install.sh | bash
42-
export NVM_DIR="$HOME/.nvm"
43-
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
44-
nvm install "$(cat .nvmrc)"
45-
46-
- name: Archive nvm and Node.js
47-
run: |
48-
tar czf nvm-node.tar.gz -C $HOME .nvm
49-
50-
- name: Upload nvm and Node.js
51-
uses: actions/upload-artifact@v4
52-
with:
53-
name: nvm-node
54-
path: ./nvm-node.tar.gz
55-
retention-days: 1
56-
5728
test-nodejs-scanner-test-helpers:
5829
name: "Unit Test | Node.js Scanner Test Helpers"
59-
needs:
60-
- nvm-setup
6130
runs-on: ubuntu-22.04
6231
steps:
6332
- uses: actions/checkout@v4
6433

65-
- name: Download nvm and Node.js
66-
uses: actions/download-artifact@v4
34+
- uses: actions/setup-node@v4
6735
with:
68-
name: nvm-node
69-
path: nvm-node
70-
71-
- name: Extract nvm and Node.js
72-
run: |
73-
tar xzf nvm-node/nvm-node.tar.gz -C $HOME
74-
export NVM_DIR="$HOME/.nvm"
75-
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
76-
nvm use
36+
node-version-file: ".nvmrc"
7737

7838
- name: Install dependencies
7939
working-directory: tests/integration
@@ -296,7 +256,6 @@ jobs:
296256
name: "Autodiscovery | Kubernetes | SecretExtractionInitContainer"
297257
runs-on: ubuntu-22.04
298258
needs:
299-
- nvm-setup
300259
- k8s-setup
301260
steps:
302261
- name: Checkout
@@ -307,18 +266,9 @@ jobs:
307266
with:
308267
python-version: "${{ env.PYTHON_VERSION }}"
309268

310-
- name: Download nvm and Node.js
311-
uses: actions/download-artifact@v4
269+
- uses: actions/setup-node@v4
312270
with:
313-
name: nvm-node
314-
path: nvm-node
315-
316-
- name: Extract nvm and Node.js
317-
run: |
318-
tar xzf nvm-node/nvm-node.tar.gz -C $HOME
319-
export NVM_DIR="$HOME/.nvm"
320-
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
321-
nvm use
271+
node-version-file: ".nvmrc"
322272

323273
- name: Download Kind
324274
uses: actions/download-artifact@v4
@@ -458,7 +408,6 @@ jobs:
458408
needs:
459409
- sdk
460410
- operator
461-
- nvm-setup
462411
- k8s-setup
463412
runs-on: ubuntu-22.04
464413
strategy:
@@ -494,18 +443,9 @@ jobs:
494443
- name: Checkout
495444
uses: actions/checkout@v4
496445

497-
- name: Download nvm and Node.js
498-
uses: actions/download-artifact@v4
446+
- uses: actions/setup-node@v4
499447
with:
500-
name: nvm-node
501-
path: nvm-node
502-
503-
- name: Extract nvm and Node.js
504-
run: |
505-
tar xzf nvm-node/nvm-node.tar.gz -C $HOME
506-
export NVM_DIR="$HOME/.nvm"
507-
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
508-
nvm use
448+
node-version-file: ".nvmrc"
509449

510450
- name: Download Kind
511451
uses: actions/download-artifact@v4
@@ -645,7 +585,6 @@ jobs:
645585
name: Test | Hook ${{ matrix.hook }}
646586
needs:
647587
- operator
648-
- nvm-setup
649588
- k8s-setup
650589
runs-on: ubuntu-22.04
651590
strategy:
@@ -662,6 +601,11 @@ jobs:
662601
# - persistence-static-report (WIP)
663602
steps:
664603
- uses: actions/checkout@master
604+
605+
- uses: actions/setup-node@v4
606+
with:
607+
node-version-file: '.nvmrc'
608+
665609
- name: "Start kind cluster"
666610
run: |
667611
kind version
@@ -797,19 +741,6 @@ jobs:
797741
working-directory: ./hooks/${{ matrix.hook }}
798742
run: make kind-import
799743

800-
- name: Download nvm and Node.js
801-
uses: actions/download-artifact@v4
802-
with:
803-
name: nvm-node
804-
path: ./nvm-node
805-
806-
- name: Extract nvm and Node.js
807-
run: |
808-
tar xzf nvm-node/nvm-node.tar.gz -C $HOME
809-
export NVM_DIR="$HOME/.nvm"
810-
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
811-
nvm use
812-
813744
- name: "Install Test Dependencies"
814745
working-directory: ./hooks
815746
run: npm ci
@@ -881,7 +812,7 @@ jobs:
881812
- name: "Delete kind cluster"
882813
run: |
883814
kind delete cluster
884-
815+
885816
sbctcl-tests:
886817
name: "Run sbctcl Tests"
887818
runs-on: ubuntu-22.04
@@ -897,4 +828,3 @@ jobs:
897828
- name: Run tests
898829
working-directory: scbctl
899830
run: go test -v ./...
900-

0 commit comments

Comments
 (0)