build(ci): add dependency review step
[e-mobility-charging-stations-simulator.git] / .github / workflows / ci.yml
CommitLineData
a9c0de45 1name: CI
69d993b0
JB
2on:
3 push:
a1deee04 4 branches: [main]
c4f11906 5 pull_request:
613dc1b7 6 types: [opened, synchronize, reopened]
b58224be
JB
7 merge_group:
8 branches: [main]
69d993b0
JB
9jobs:
10 build:
69d993b0
JB
11 strategy:
12 matrix:
c1eafbfc 13 os: [windows-latest, macos-latest, ubuntu-latest]
4fc9b19e 14 node: ['16.x', '18.x', '20.x']
ebb77a4c 15 name: Build simulator with Node ${{ matrix.node }} on ${{ matrix.os }}
916678e9 16 runs-on: ${{ matrix.os }}
69d993b0 17 steps:
49722c24 18 - uses: actions/checkout@v4
e7aeea18
JB
19 with:
20 fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
76ec7220
JB
21 - name: 'Dependency Review'
22 uses: actions/dependency-review-action@v3
e3874421
JB
23 - uses: pnpm/action-setup@v2
24 with:
25 version: 8
d5d2241e 26 - name: Setup node ${{ matrix.node }}
0642c3d2 27 uses: actions/setup-node@v3
e7aeea18 28 with:
0642c3d2 29 node-version: ${{ matrix.node }}
e3874421 30 cache: 'pnpm'
881f450c 31 - name: pnpm install
916678e9 32 run: pnpm install --ignore-scripts
e3874421 33 - name: pnpm lint
906ba5c5 34 if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }}
e3874421
JB
35 run: pnpm lint
36 - name: pnpm build
37 run: pnpm build
881f450c
JB
38 - name: pnpm test
39 run: pnpm test
e3874421 40 - name: pnpm coverage
ef28112f 41 if: ${{ github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }}
e3874421 42 run: pnpm coverage
e7aeea18 43 - name: SonarCloud Scan
ef28112f 44 if: ${{ github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }}
25b607de 45 uses: sonarsource/sonarcloud-github-action@v2.0.1
e7aeea18 46 env:
18b41d7e 47 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
e7aeea18 48 SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
32de5a57 49 build-dashboard:
32de5a57
LM
50 strategy:
51 matrix:
52 os: [windows-latest, macos-latest, ubuntu-latest]
4fc9b19e 53 node: ['16.x', '18.x', '20.x']
ebb77a4c 54 name: Build dashboard with Node ${{ matrix.node }} on ${{ matrix.os }}
916678e9
JB
55 runs-on: ${{ matrix.os }}
56 defaults:
57 run:
58 working-directory: ui/web
32de5a57 59 steps:
49722c24 60 - uses: actions/checkout@v4
32de5a57
LM
61 with:
62 fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
76ec7220
JB
63 - name: 'Dependency Review'
64 uses: actions/dependency-review-action@v3
e3874421
JB
65 - uses: pnpm/action-setup@v2
66 with:
67 version: 8
d5d2241e 68 - name: Setup node ${{ matrix.node }}
32de5a57
LM
69 uses: actions/setup-node@v3
70 with:
71 node-version: ${{ matrix.node }}
e3874421 72 cache: 'pnpm'
603f1011 73 - name: pnpm install
916678e9 74 run: pnpm install --ignore-scripts
e3874421 75 - name: pnpm lint
906ba5c5 76 if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }}
e3874421
JB
77 run: pnpm lint
78 - name: pnpm build
79 run: pnpm build
603f1011
JB
80 - name: pnpm test
81 run: pnpm test
2de63014 82 - name: pnpm coverage
ef28112f 83 if: ${{ github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }}
2de63014
JB
84 run: pnpm coverage
85 - name: SonarCloud Scan
ef28112f 86 if: ${{ github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }}
25b607de 87 uses: sonarsource/sonarcloud-github-action@v2.0.1
2de63014
JB
88 with:
89 projectBaseDir: ui/web
90 env:
18b41d7e 91 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2de63014 92 SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
a9c0de45 93 build-docker:
4bfd22de 94 runs-on: ubuntu-latest
73321f43 95 name: Build docker image
c168e7ad 96 steps:
49722c24 97 - uses: actions/checkout@v4
d5d2241e 98 - name: Setup Docker Buildx
e7aeea18 99 id: buildx
c1eafbfc 100 uses: docker/setup-buildx-action@v2
e7aeea18
JB
101 - name: Build docker image
102 run: |
103 cd docker
104 make SUBMODULES_INIT=false