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