Skip to content

Commit 79d7404

Browse files
authored
Merge pull request #1477 from Adyen/fix-and-improve-github-workflows
Improve GitHub Node and release workflows
2 parents 7fd95fa + c8b5a1a commit 79d7404

File tree

5 files changed

+84
-113
lines changed

5 files changed

+84
-113
lines changed

.github/workflows/coveralls.yml

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

.github/workflows/node-ci.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Node CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- sdk-automation/models
8+
- promote/main
9+
pull_request:
10+
branches:
11+
- main
12+
- sdk-automation/models
13+
- promote/main
14+
workflow_dispatch: {}
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
node-check:
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
- name: Set up Node.js ${{ matrix.node-version }}
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: ${{ matrix.node-version }}
29+
- name: Cache Node.js modules
30+
uses: actions/cache@v3
31+
with:
32+
path: ~/.npm
33+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
34+
restore-keys: |
35+
${{ runner.os }}-node-
36+
- name: Install dependencies
37+
run: npm install
38+
- name: Lint code
39+
run: npm run lint:fix && npm run lint
40+
41+
node-test:
42+
runs-on: ubuntu-latest
43+
needs: node-check
44+
45+
strategy:
46+
matrix:
47+
node-version: [18.x, 20.x, 22.x]
48+
49+
steps:
50+
- uses: actions/checkout@v4
51+
- name: Set up Node.js ${{ matrix.node-version }}
52+
uses: actions/setup-node@v4
53+
with:
54+
node-version: ${{ matrix.node-version }}
55+
- name: Cache Node.js modules
56+
uses: actions/cache@v3
57+
with:
58+
path: ~/.npm
59+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
60+
restore-keys: |
61+
${{ runner.os }}-node-
62+
- name: Install dependencies
63+
run: npm install
64+
- name: Run tests
65+
run: npm test
66+
- name: Run tests with coverage
67+
run: npm run test:coverage
68+
69+
node-sonarqube:
70+
runs-on: ubuntu-latest
71+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
72+
needs: node-test
73+
permissions:
74+
pull-requests: write
75+
76+
steps:
77+
- uses: actions/checkout@v4
78+
with:
79+
fetch-depth: 0
80+
- name: SonarQube Scan
81+
uses: SonarSource/sonarqube-scan-action@v5
82+
env:
83+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.github/workflows/nodejs.yml

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

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ on:
2323

2424
jobs:
2525
release:
26+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
2627
permissions:
2728
contents: write
2829
pull-requests: write

.github/workflows/sonarcloud.yml

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

0 commit comments

Comments
 (0)