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