build(ci): use monorepo setup on sonarcloud
[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:
c1eafbfc 11 runs-on: ${{ matrix.os }}
69d993b0
JB
12 strategy:
13 matrix:
c1eafbfc 14 os: [windows-latest, macos-latest, ubuntu-latest]
4fc9b19e 15 node: ['16.x', '18.x', '20.x']
69d993b0 16 steps:
0642c3d2 17 - uses: actions/checkout@v3
e7aeea18
JB
18 with:
19 fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
e3874421
JB
20 - uses: pnpm/action-setup@v2
21 with:
22 version: 8
d5d2241e 23 - name: Setup node ${{ matrix.node }}
0642c3d2 24 uses: actions/setup-node@v3
e7aeea18 25 with:
0642c3d2 26 node-version: ${{ matrix.node }}
e3874421 27 cache: 'pnpm'
881f450c 28 - name: pnpm install
e3874421
JB
29 run: pnpm install
30 - name: pnpm lint
31 run: pnpm lint
32 - name: pnpm build
33 run: pnpm build
881f450c
JB
34 - name: pnpm test
35 run: pnpm test
e3874421 36 - name: pnpm coverage
c774abf5 37 if: "github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x'"
e3874421 38 run: pnpm coverage
e7aeea18 39 - name: SonarCloud Scan
c774abf5 40 if: "github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x'"
c4afbdd5 41 uses: sonarsource/sonarcloud-github-action@v1.9.1
e7aeea18
JB
42 env:
43 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
44 SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
32de5a57
LM
45 build-dashboard:
46 runs-on: ${{ matrix.os }}
47 defaults:
48 run:
ebbfbf1c 49 working-directory: ui/web
32de5a57
LM
50 strategy:
51 matrix:
52 os: [windows-latest, macos-latest, ubuntu-latest]
4fc9b19e 53 node: ['16.x', '18.x', '20.x']
32de5a57
LM
54 steps:
55 - uses: actions/checkout@v3
56 with:
57 fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
e3874421
JB
58 - uses: pnpm/action-setup@v2
59 with:
60 version: 8
d5d2241e 61 - name: Setup node ${{ matrix.node }}
32de5a57
LM
62 uses: actions/setup-node@v3
63 with:
64 node-version: ${{ matrix.node }}
e3874421 65 cache: 'pnpm'
603f1011 66 - name: pnpm install
e3874421
JB
67 run: pnpm install
68 - name: pnpm lint
69 run: pnpm lint
70 - name: pnpm build
71 run: pnpm build
603f1011
JB
72 - name: pnpm test
73 run: pnpm test
2de63014
JB
74 - name: pnpm coverage
75 if: "github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x'"
76 run: pnpm coverage
77 - name: SonarCloud Scan
78 if: "github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x'"
79 uses: sonarsource/sonarcloud-github-action@v1.9.1
80 with:
81 projectBaseDir: ui/web
82 env:
83 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
84 SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
a9c0de45 85 build-docker:
4bfd22de 86 runs-on: ubuntu-latest
c168e7ad 87 steps:
0642c3d2 88 - uses: actions/checkout@v3
d5d2241e 89 - name: Setup Docker Buildx
e7aeea18 90 id: buildx
c1eafbfc 91 uses: docker/setup-buildx-action@v2
e7aeea18
JB
92 - name: Build docker image
93 run: |
94 cd docker
95 make SUBMODULES_INIT=false