build(ci): use monorepo setup on sonarcloud
[e-mobility-charging-stations-simulator.git] / .github / workflows / ci.yml
1 name: CI
2 on:
3 push:
4 branches: [main]
5 pull_request:
6 types: [opened, synchronize, reopened]
7 merge_group:
8 branches: [main]
9 jobs:
10 build:
11 runs-on: ${{ matrix.os }}
12 strategy:
13 matrix:
14 os: [windows-latest, macos-latest, ubuntu-latest]
15 node: ['16.x', '18.x', '20.x']
16 steps:
17 - uses: actions/checkout@v3
18 with:
19 fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
20 - uses: pnpm/action-setup@v2
21 with:
22 version: 8
23 - name: Setup node ${{ matrix.node }}
24 uses: actions/setup-node@v3
25 with:
26 node-version: ${{ matrix.node }}
27 cache: 'pnpm'
28 - name: pnpm install
29 run: pnpm install
30 - name: pnpm lint
31 run: pnpm lint
32 - name: pnpm build
33 run: pnpm build
34 - name: pnpm test
35 run: pnpm test
36 - name: pnpm coverage
37 if: "github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x'"
38 run: pnpm coverage
39 - name: SonarCloud Scan
40 if: "github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x'"
41 uses: sonarsource/sonarcloud-github-action@v1.9.1
42 env:
43 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
44 SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
45 build-dashboard:
46 runs-on: ${{ matrix.os }}
47 defaults:
48 run:
49 working-directory: ui/web
50 strategy:
51 matrix:
52 os: [windows-latest, macos-latest, ubuntu-latest]
53 node: ['16.x', '18.x', '20.x']
54 steps:
55 - uses: actions/checkout@v3
56 with:
57 fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
58 - uses: pnpm/action-setup@v2
59 with:
60 version: 8
61 - name: Setup node ${{ matrix.node }}
62 uses: actions/setup-node@v3
63 with:
64 node-version: ${{ matrix.node }}
65 cache: 'pnpm'
66 - name: pnpm install
67 run: pnpm install
68 - name: pnpm lint
69 run: pnpm lint
70 - name: pnpm build
71 run: pnpm build
72 - name: pnpm test
73 run: pnpm test
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 }}
85 build-docker:
86 runs-on: ubuntu-latest
87 steps:
88 - uses: actions/checkout@v3
89 - name: Setup Docker Buildx
90 id: buildx
91 uses: docker/setup-buildx-action@v2
92 - name: Build docker image
93 run: |
94 cd docker
95 make SUBMODULES_INIT=false