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