Refine condition on CI jobs
[e-mobility-charging-stations-simulator.git] / .github / workflows / ci.yml
CommitLineData
a9c0de45 1name: CI
69d993b0
JB
2on:
3 push:
4 branches:
9c1b1b03 5 - main
c4f11906 6 pull_request:
613dc1b7 7 types: [opened, synchronize, reopened]
69d993b0
JB
8jobs:
9 build:
c1eafbfc 10 runs-on: ${{ matrix.os }}
69d993b0
JB
11 strategy:
12 matrix:
c1eafbfc 13 os: [windows-latest, macos-latest, ubuntu-latest]
1f7fa4de 14 node: ['16.x', '18.x']
69d993b0 15 steps:
0642c3d2 16 - uses: actions/checkout@v3
e7aeea18
JB
17 with:
18 fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
0642c3d2
JB
19 - name: Use Node.js ${{ matrix.node }}
20 uses: actions/setup-node@v3
e7aeea18 21 with:
0642c3d2 22 node-version: ${{ matrix.node }}
e7aeea18
JB
23 - name: npm install
24 run: npm ci
25 - name: npm run lint
26 run: npm run lint
27 continue-on-error: true
28 - name: npm run build
6b9a6b07 29 if: "matrix.os != 'windows-latest' || matrix.node != '16.x'"
e7aeea18
JB
30 run: npm run build
31 - name: npm test
9cef5729 32 if: "matrix.os != 'windows-latest' && matrix.node != '16.x'"
e7aeea18
JB
33 run: npm test
34 - name: npm run coverage
df954599 35 if: "github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '16.x'"
e7aeea18
JB
36 run: npm run coverage
37 - name: SonarCloud Scan
7f774a55 38 if: "github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '16.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:
47 working-directory: src/ui/web
48 strategy:
49 matrix:
50 os: [windows-latest, macos-latest, ubuntu-latest]
1f7fa4de 51 node: ['16.x', '18.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
56 - name: Use Node.js ${{ 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 continue-on-error: true
65 - name: npm run build
66 run: npm run build
67 - name: npm test
68 run: npm test
69 # - name: npm run coverage
70 # if: "github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '16.x'"
71 # run: npm run coverage
72 # - name: SonarCloud Scan
73 # if: "github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '16.x'"
74 # uses: sonarsource/sonarcloud-github-action@master
75 # env:
76 # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
77 # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
a9c0de45 78 build-docker:
4bfd22de 79 runs-on: ubuntu-latest
c168e7ad 80 steps:
0642c3d2 81 - uses: actions/checkout@v3
e7aeea18
JB
82 - name: Set up Docker Buildx
83 id: buildx
c1eafbfc 84 uses: docker/setup-buildx-action@v2
e7aeea18
JB
85 - name: Build docker image
86 run: |
87 cd docker
88 make SUBMODULES_INIT=false