Commit | Line | Data |
---|---|---|
a9c0de45 | 1 | name: CI |
69d993b0 JB |
2 | on: |
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 | 9 | jobs: |
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: | |
27 | python: | |
28 | - 3.12 | |
40f37d8e | 29 | name: Build OCPP mock server with Python ${{ matrix.python }} |
ffccbf22 JB |
30 | runs-on: ubuntu-latest |
31 | defaults: | |
32 | run: | |
33 | working-directory: tests/ocpp-server | |
34 | steps: | |
35 | - uses: actions/checkout@v4 | |
36 | - name: Setup Python ${{ matrix.python }} | |
67782acd | 37 | uses: actions/setup-python@v5 |
ffccbf22 JB |
38 | with: |
39 | python-version: ${{ matrix.python }} | |
40 | - name: Install Poetry | |
a4beba2d | 41 | run: pip install poetry |
ffccbf22 | 42 | - name: Install Dependencies |
40f37d8e | 43 | run: poetry install --no-root |
ffccbf22 JB |
44 | - name: Lint |
45 | run: poetry run task lint | |
17cec4f7 | 46 | build-simulator: |
61a54e7b | 47 | needs: [check-secrets] |
69d993b0 JB |
48 | strategy: |
49 | matrix: | |
c1eafbfc | 50 | os: [windows-latest, macos-latest, ubuntu-latest] |
6dd374b2 | 51 | node: ['20.x', 'latest'] |
ebb77a4c | 52 | name: Build simulator with Node ${{ matrix.node }} on ${{ matrix.os }} |
916678e9 | 53 | runs-on: ${{ matrix.os }} |
69d993b0 | 54 | steps: |
49722c24 | 55 | - uses: actions/checkout@v4 |
e7aeea18 JB |
56 | with: |
57 | fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
b36a0f94 | 58 | - name: Dependency Review |
cd49faeb | 59 | if: ${{ github.event_name == 'push' && matrix.os == 'ubuntu-latest' && matrix.node == '20.x' }} |
f3bf03c7 | 60 | uses: actions/dependency-review-action@v4 |
b131d478 | 61 | with: |
3a389887 | 62 | base-ref: ${{ github.ref_name }} |
cc92c810 | 63 | head-ref: ${{ github.sha }} |
b36a0f94 | 64 | - name: Pull Request Dependency Review |
cd49faeb | 65 | if: ${{ github.event_name == 'pull_request' && matrix.os == 'ubuntu-latest' && matrix.node == '20.x' }} |
f3bf03c7 | 66 | uses: actions/dependency-review-action@v4 |
e6453293 | 67 | - uses: pnpm/action-setup@v4 |
d5d2241e | 68 | - name: Setup node ${{ matrix.node }} |
f70b733f | 69 | uses: actions/setup-node@v4 |
e7aeea18 | 70 | with: |
0642c3d2 | 71 | node-version: ${{ matrix.node }} |
e3874421 | 72 | cache: 'pnpm' |
881f450c | 73 | - name: pnpm install |
d9d8bb32 | 74 | run: pnpm install --ignore-scripts --frozen-lockfile |
52cdd8a1 JB |
75 | - name: pnpm audit |
76 | if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '20.x' }} | |
9c6af3b0 | 77 | run: pnpm audit --prod |
e3874421 | 78 | - name: pnpm lint |
cd49faeb | 79 | if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '20.x' }} |
e3874421 JB |
80 | run: pnpm lint |
81 | - name: pnpm build | |
82 | run: pnpm build | |
881f450c JB |
83 | - name: pnpm test |
84 | run: pnpm test | |
e3874421 | 85 | - name: pnpm coverage |
cd49faeb | 86 | if: ${{ github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '20.x' }} |
e3874421 | 87 | run: pnpm coverage |
e7aeea18 | 88 | - name: SonarCloud Scan |
cd49faeb | 89 | if: ${{ needs.check-secrets.outputs.sonar-token-exists == 'true' && github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '20.x' }} |
45609cfb | 90 | uses: sonarsource/sonarcloud-github-action@v2.3.0 |
e7aeea18 | 91 | env: |
18b41d7e | 92 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
e7aeea18 | 93 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
32de5a57 | 94 | build-dashboard: |
61a54e7b | 95 | needs: [check-secrets] |
32de5a57 LM |
96 | strategy: |
97 | matrix: | |
98 | os: [windows-latest, macos-latest, ubuntu-latest] | |
6dd374b2 | 99 | node: ['18.x', '20.x', 'latest'] |
ebb77a4c | 100 | name: Build dashboard with Node ${{ matrix.node }} on ${{ matrix.os }} |
916678e9 JB |
101 | runs-on: ${{ matrix.os }} |
102 | defaults: | |
103 | run: | |
104 | working-directory: ui/web | |
32de5a57 | 105 | steps: |
49722c24 | 106 | - uses: actions/checkout@v4 |
32de5a57 LM |
107 | with: |
108 | fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
b36a0f94 | 109 | - name: Dependency Review |
cd49faeb | 110 | if: ${{ github.event_name == 'push' && matrix.os == 'ubuntu-latest' && matrix.node == '20.x' }} |
f3bf03c7 | 111 | uses: actions/dependency-review-action@v4 |
b131d478 | 112 | with: |
3a389887 | 113 | base-ref: ${{ github.ref_name }} |
cc92c810 | 114 | head-ref: ${{ github.sha }} |
b36a0f94 | 115 | - name: Pull Request Dependency Review |
cd49faeb | 116 | if: ${{ github.event_name == 'pull_request' && matrix.os == 'ubuntu-latest' && matrix.node == '20.x' }} |
f3bf03c7 | 117 | uses: actions/dependency-review-action@v4 |
e6453293 | 118 | - uses: pnpm/action-setup@v4 |
d5d2241e | 119 | - name: Setup node ${{ matrix.node }} |
f70b733f | 120 | uses: actions/setup-node@v4 |
32de5a57 LM |
121 | with: |
122 | node-version: ${{ matrix.node }} | |
e3874421 | 123 | cache: 'pnpm' |
603f1011 | 124 | - name: pnpm install |
d9d8bb32 | 125 | run: pnpm install --ignore-scripts --frozen-lockfile |
52cdd8a1 JB |
126 | - name: pnpm audit |
127 | if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '20.x' }} | |
9c6af3b0 | 128 | run: pnpm audit --prod |
e3874421 | 129 | - name: pnpm lint |
cd49faeb | 130 | if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '20.x' }} |
e3874421 JB |
131 | run: pnpm lint |
132 | - name: pnpm build | |
9d76f5ec | 133 | run: pnpm build |
603f1011 JB |
134 | - name: pnpm test |
135 | run: pnpm test | |
2de63014 | 136 | - name: pnpm coverage |
cd49faeb | 137 | if: ${{ github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '20.x' }} |
2de63014 JB |
138 | run: pnpm coverage |
139 | - name: SonarCloud Scan | |
cd49faeb | 140 | if: ${{ needs.check-secrets.outputs.sonar-token-exists == 'true' && github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '20.x' }} |
45609cfb | 141 | uses: sonarsource/sonarcloud-github-action@v2.3.0 |
2de63014 JB |
142 | with: |
143 | projectBaseDir: ui/web | |
144 | env: | |
18b41d7e | 145 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
2de63014 | 146 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
17cec4f7 | 147 | build-docker-image: |
4bfd22de | 148 | runs-on: ubuntu-latest |
73321f43 | 149 | name: Build docker image |
c168e7ad | 150 | steps: |
49722c24 | 151 | - uses: actions/checkout@v4 |
d5d2241e | 152 | - name: Setup Docker Buildx |
e7aeea18 | 153 | id: buildx |
5c555092 | 154 | uses: docker/setup-buildx-action@v3 |
e7aeea18 JB |
155 | - name: Build docker image |
156 | run: | | |
157 | cd docker | |
158 | make SUBMODULES_INIT=false |