736af2eb8d3954fb81851bc2f00d1558657b5232
[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 strategy:
12 matrix:
13 os: [windows-latest, macos-latest, ubuntu-latest]
14 node: ['16.x', '18.x', '20.x']
15 name: Build simulator with Node ${{ matrix.node }} on ${{ matrix.os }}
16 runs-on: ${{ matrix.os }}
17 steps:
18 - uses: actions/checkout@v4
19 with:
20 fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
21 - name: 'Dependency Review'
22 uses: actions/dependency-review-action@v3
23 - uses: pnpm/action-setup@v2
24 with:
25 version: 8
26 - name: Setup node ${{ matrix.node }}
27 uses: actions/setup-node@v3
28 with:
29 node-version: ${{ matrix.node }}
30 cache: 'pnpm'
31 - name: pnpm install
32 run: pnpm install --ignore-scripts
33 - name: pnpm lint
34 if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }}
35 run: pnpm lint
36 - name: pnpm build
37 run: pnpm build
38 - name: pnpm test
39 run: pnpm test
40 - name: pnpm coverage
41 if: ${{ github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }}
42 run: pnpm coverage
43 - name: SonarCloud Scan
44 if: ${{ github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }}
45 uses: sonarsource/sonarcloud-github-action@v2.0.1
46 env:
47 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48 SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
49 build-dashboard:
50 strategy:
51 matrix:
52 os: [windows-latest, macos-latest, ubuntu-latest]
53 node: ['16.x', '18.x', '20.x']
54 name: Build dashboard with Node ${{ matrix.node }} on ${{ matrix.os }}
55 runs-on: ${{ matrix.os }}
56 defaults:
57 run:
58 working-directory: ui/web
59 steps:
60 - uses: actions/checkout@v4
61 with:
62 fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
63 - name: 'Dependency Review'
64 uses: actions/dependency-review-action@v3
65 - uses: pnpm/action-setup@v2
66 with:
67 version: 8
68 - name: Setup node ${{ matrix.node }}
69 uses: actions/setup-node@v3
70 with:
71 node-version: ${{ matrix.node }}
72 cache: 'pnpm'
73 - name: pnpm install
74 run: pnpm install --ignore-scripts
75 - name: pnpm lint
76 if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }}
77 run: pnpm lint
78 - name: pnpm build
79 run: pnpm build
80 - name: pnpm test
81 run: pnpm test
82 - name: pnpm coverage
83 if: ${{ github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }}
84 run: pnpm coverage
85 - name: SonarCloud Scan
86 if: ${{ github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }}
87 uses: sonarsource/sonarcloud-github-action@v2.0.1
88 with:
89 projectBaseDir: ui/web
90 env:
91 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
92 SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
93 build-docker:
94 runs-on: ubuntu-latest
95 name: Build docker image
96 steps:
97 - uses: actions/checkout@v4
98 - name: Setup Docker Buildx
99 id: buildx
100 uses: docker/setup-buildx-action@v2
101 - name: Build docker image
102 run: |
103 cd docker
104 make SUBMODULES_INIT=false