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