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