]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/blame - .github/workflows/ci.yml
build(deps-dev): bump ruff in /tests/ocpp-server in the regular group (#1457)
[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 9jobs:
61a54e7b
JB
10 check-secrets:
11 runs-on: ubuntu-latest
12 outputs:
13 sonar-token-exists: ${{ steps.sonar-token.outputs.defined }}
14 steps:
15 - name: Check for SonarCloud Token Availability
16 id: sonar-token
17 shell: bash
18 run: |
19 if [ "${{ secrets.SONAR_TOKEN }}" != '' ]; then
20 echo "defined=true" >> $GITHUB_OUTPUT;
21 else
22 echo "defined=false" >> $GITHUB_OUTPUT;
23 fi
ffccbf22
JB
24 build-ocpp-server:
25 strategy:
26 matrix:
1752bacf 27 os: [ubuntu-latest, windows-latest, macos-latest]
e35a7717 28 python: [3.12, 3.13]
1752bacf
JB
29 name: Build OCPP mock server with Python ${{ matrix.python }} on ${{ matrix.os }}
30 runs-on: ${{ matrix.os }}
ffccbf22
JB
31 defaults:
32 run:
33 working-directory: tests/ocpp-server
34 steps:
35 - uses: actions/checkout@v4
52238c63
JB
36 - name: Install Poetry
37 run: pipx install poetry
ffccbf22 38 - name: Setup Python ${{ matrix.python }}
67782acd 39 uses: actions/setup-python@v5
ffccbf22
JB
40 with:
41 python-version: ${{ matrix.python }}
52238c63 42 cache: poetry
ffccbf22 43 - name: Install Dependencies
40f37d8e 44 run: poetry install --no-root
ffccbf22 45 - name: Lint
dfc35436 46 if: ${{ matrix.os == 'ubuntu-latest' && matrix.python == '3.13' }}
ffccbf22 47 run: poetry run task lint
17cec4f7 48 build-simulator:
61a54e7b 49 needs: [check-secrets]
69d993b0
JB
50 strategy:
51 matrix:
c1eafbfc 52 os: [windows-latest, macos-latest, ubuntu-latest]
dfc35436 53 node: ['20.x', '22.x', '24.x', 'latest']
ebb77a4c 54 name: Build simulator with Node ${{ matrix.node }} on ${{ matrix.os }}
916678e9 55 runs-on: ${{ matrix.os }}
69d993b0 56 steps:
49722c24 57 - uses: actions/checkout@v4
e7aeea18
JB
58 with:
59 fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
b36a0f94 60 - name: Dependency Review
e61682b9 61 if: ${{ github.event_name == 'push' && matrix.os == 'ubuntu-latest' && matrix.node == '22.x' }}
f3bf03c7 62 uses: actions/dependency-review-action@v4
b131d478 63 with:
3a389887 64 base-ref: ${{ github.ref_name }}
cc92c810 65 head-ref: ${{ github.sha }}
b36a0f94 66 - name: Pull Request Dependency Review
e61682b9 67 if: ${{ github.event_name == 'pull_request' && matrix.os == 'ubuntu-latest' && matrix.node == '22.x' }}
f3bf03c7 68 uses: actions/dependency-review-action@v4
e6453293 69 - uses: pnpm/action-setup@v4
d5d2241e 70 - name: Setup node ${{ matrix.node }}
f70b733f 71 uses: actions/setup-node@v4
e7aeea18 72 with:
0642c3d2 73 node-version: ${{ matrix.node }}
e3874421 74 cache: 'pnpm'
881f450c 75 - name: pnpm install
d9d8bb32 76 run: pnpm install --ignore-scripts --frozen-lockfile
f1fb5563
JB
77 # - name: pnpm audit
78 # if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '22.x' }}
79 # run: pnpm audit --prod
e3874421 80 - name: pnpm lint
e61682b9 81 if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '22.x' }}
e3874421
JB
82 run: pnpm lint
83 - name: pnpm build
84 run: pnpm build
881f450c
JB
85 - name: pnpm test
86 run: pnpm test
e3874421 87 - name: pnpm coverage
e61682b9 88 if: ${{ github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '22.x' }}
e3874421 89 run: pnpm coverage
e7aeea18 90 - name: SonarCloud Scan
e61682b9 91 if: ${{ needs.check-secrets.outputs.sonar-token-exists == 'true' && github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '22.x' }}
7a64458c 92 uses: sonarsource/sonarqube-scan-action@v5.2.0
e7aeea18 93 env:
18b41d7e 94 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
e7aeea18 95 SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
32de5a57 96 build-dashboard:
61a54e7b 97 needs: [check-secrets]
32de5a57
LM
98 strategy:
99 matrix:
100 os: [windows-latest, macos-latest, ubuntu-latest]
dfc35436 101 node: ['20.x', '22.x', '24.x', 'latest']
ebb77a4c 102 name: Build dashboard with Node ${{ matrix.node }} on ${{ matrix.os }}
916678e9
JB
103 runs-on: ${{ matrix.os }}
104 defaults:
105 run:
106 working-directory: ui/web
32de5a57 107 steps:
49722c24 108 - uses: actions/checkout@v4
32de5a57
LM
109 with:
110 fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
b36a0f94 111 - name: Dependency Review
e61682b9 112 if: ${{ github.event_name == 'push' && matrix.os == 'ubuntu-latest' && matrix.node == '22.x' }}
f3bf03c7 113 uses: actions/dependency-review-action@v4
b131d478 114 with:
3a389887 115 base-ref: ${{ github.ref_name }}
cc92c810 116 head-ref: ${{ github.sha }}
b36a0f94 117 - name: Pull Request Dependency Review
e61682b9 118 if: ${{ github.event_name == 'pull_request' && matrix.os == 'ubuntu-latest' && matrix.node == '22.x' }}
f3bf03c7 119 uses: actions/dependency-review-action@v4
e6453293 120 - uses: pnpm/action-setup@v4
d5d2241e 121 - name: Setup node ${{ matrix.node }}
f70b733f 122 uses: actions/setup-node@v4
32de5a57
LM
123 with:
124 node-version: ${{ matrix.node }}
e3874421 125 cache: 'pnpm'
603f1011 126 - name: pnpm install
d9d8bb32 127 run: pnpm install --ignore-scripts --frozen-lockfile
f1fb5563
JB
128 # - name: pnpm audit
129 # if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '22.x' }}
130 # run: pnpm audit --prod
5a1832ce 131 - name: pnpm lint
e61682b9 132 if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '22.x' }}
5a1832ce 133 run: pnpm lint
e3874421 134 - name: pnpm build
9d76f5ec 135 run: pnpm build
603f1011
JB
136 - name: pnpm test
137 run: pnpm test
2de63014 138 - name: pnpm coverage
e61682b9 139 if: ${{ github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '22.x' }}
2de63014
JB
140 run: pnpm coverage
141 - name: SonarCloud Scan
e61682b9 142 if: ${{ needs.check-secrets.outputs.sonar-token-exists == 'true' && github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '22.x' }}
7a64458c 143 uses: sonarsource/sonarqube-scan-action@v5.2.0
2de63014
JB
144 with:
145 projectBaseDir: ui/web
146 env:
18b41d7e 147 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2de63014 148 SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
20fb1094 149 build-simulator-docker-image:
4bfd22de 150 runs-on: ubuntu-latest
20fb1094
JB
151 name: Build simulator docker image
152 steps:
153 - uses: actions/checkout@v4
154 - name: Setup Docker Buildx
155 id: buildx
156 uses: docker/setup-buildx-action@v3
157 - name: Build docker image
158 run: |
159 cd docker
160 make SUBMODULES_INIT=false
161 build-dashboard-docker-image:
162 runs-on: ubuntu-latest
163 defaults:
164 run:
165 working-directory: ui/web
166 name: Build dashboard docker image
c168e7ad 167 steps:
49722c24 168 - uses: actions/checkout@v4
d5d2241e 169 - name: Setup Docker Buildx
e7aeea18 170 id: buildx
5c555092 171 uses: docker/setup-buildx-action@v3
e7aeea18
JB
172 - name: Build docker image
173 run: |
174 cd docker
175 make SUBMODULES_INIT=false