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