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