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