Fix CI job condition
[e-mobility-charging-stations-simulator.git] / .github / workflows / ci.yml
1 name: CI
2 on:
3 push:
4 branches:
5 - main
6 pull_request:
7 types: [opened, synchronize, reopened]
8 jobs:
9 build:
10 runs-on: ${{ matrix.os }}
11 strategy:
12 matrix:
13 os: [windows-latest, macos-latest, ubuntu-latest]
14 node: ['16.x', '18.x']
15 steps:
16 - uses: actions/checkout@v3
17 with:
18 fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
19 - name: Use Node.js ${{ matrix.node }}
20 uses: actions/setup-node@v3
21 with:
22 node-version: ${{ matrix.node }}
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
29 if: "matrix.os != 'windows-latest' || matrix.node != '16.x'"
30 run: npm run build
31 - name: npm test
32 if: "matrix.os != 'windows-latest' || matrix.node != '16.x'"
33 run: npm test
34 - name: npm run coverage
35 if: "github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '16.x'"
36 run: npm run coverage
37 - name: SonarCloud Scan
38 if: "github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '16.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: src/ui/web
48 strategy:
49 matrix:
50 os: [windows-latest, macos-latest, ubuntu-latest]
51 node: ['16.x', '18.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: 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 }}
78 build-docker:
79 runs-on: ubuntu-latest
80 steps:
81 - uses: actions/checkout@v3
82 - name: Set up Docker Buildx
83 id: buildx
84 uses: docker/setup-buildx-action@v2
85 - name: Build docker image
86 run: |
87 cd docker
88 make SUBMODULES_INIT=false