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