build(ui): switch to pnpm
[e-mobility-charging-stations-simulator.git] / .github / workflows / ci.yml
CommitLineData
a9c0de45 1name: CI
69d993b0
JB
2on:
3 push:
a1deee04 4 branches: [main]
c4f11906 5 pull_request:
613dc1b7 6 types: [opened, synchronize, reopened]
b58224be
JB
7 merge_group:
8 branches: [main]
69d993b0
JB
9jobs:
10 build:
c1eafbfc 11 runs-on: ${{ matrix.os }}
69d993b0
JB
12 strategy:
13 matrix:
c1eafbfc 14 os: [windows-latest, macos-latest, ubuntu-latest]
aab42745 15 node: ['16.x', '18.x', '19.x']
69d993b0 16 steps:
0642c3d2 17 - uses: actions/checkout@v3
e7aeea18
JB
18 with:
19 fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
d5d2241e 20 - name: Setup node ${{ matrix.node }}
0642c3d2 21 uses: actions/setup-node@v3
e7aeea18 22 with:
0642c3d2 23 node-version: ${{ matrix.node }}
881f450c
JB
24 - name: corepack enable
25 run: corepack enable
26 - name: pnpm install
12909bc9 27 run: pnpm install
881f450c
JB
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
c774abf5 35 if: "github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x'"
881f450c 36 run: pnpm run coverage
e7aeea18 37 - name: SonarCloud Scan
c774abf5 38 if: "github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x'"
e7aeea18
JB
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 }}
32de5a57
LM
43 build-dashboard:
44 runs-on: ${{ matrix.os }}
45 defaults:
46 run:
ebbfbf1c 47 working-directory: ui/web
32de5a57
LM
48 strategy:
49 matrix:
50 os: [windows-latest, macos-latest, ubuntu-latest]
aab42745 51 node: ['16.x', '18.x', '19.x']
32de5a57
LM
52 steps:
53 - uses: actions/checkout@v3
54 with:
55 fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
d5d2241e 56 - name: Setup node ${{ matrix.node }}
32de5a57
LM
57 uses: actions/setup-node@v3
58 with:
59 node-version: ${{ matrix.node }}
603f1011
JB
60 - name: corepack enable
61 run: corepack enable
62 - name: pnpm install
63 run: pnpm install
64 - name: pnpm run lint
65 run: pnpm run lint
66 - name: pnpm run build
67 run: pnpm run build --if-present
68 - name: pnpm test
69 run: pnpm test
70 # - name: pnpm run coverage
c774abf5 71 # if: "github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x'"
603f1011 72 # run: pnpm run coverage
c2d3028f 73 # - name: SonarCloud Scan
c774abf5 74 # if: "github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x'"
c2d3028f
JB
75 # uses: sonarsource/sonarcloud-github-action@master
76 # with:
77 # projectBaseDir: ui/web
78 # env:
79 # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
80 # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
a9c0de45 81 build-docker:
4bfd22de 82 runs-on: ubuntu-latest
c168e7ad 83 steps:
0642c3d2 84 - uses: actions/checkout@v3
d5d2241e 85 - name: Setup Docker Buildx
e7aeea18 86 id: buildx
c1eafbfc 87 uses: docker/setup-buildx-action@v2
e7aeea18
JB
88 - name: Build docker image
89 run: |
90 cd docker
91 make SUBMODULES_INIT=false