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 | |
17cec4f7 | 24 | build-simulator: |
61a54e7b | 25 | needs: [check-secrets] |
69d993b0 JB |
26 | strategy: |
27 | matrix: | |
c1eafbfc | 28 | os: [windows-latest, macos-latest, ubuntu-latest] |
33885870 | 29 | node: ['20.x'] |
ebb77a4c | 30 | name: Build simulator with Node ${{ matrix.node }} on ${{ matrix.os }} |
916678e9 | 31 | runs-on: ${{ matrix.os }} |
69d993b0 | 32 | steps: |
49722c24 | 33 | - uses: actions/checkout@v4 |
e7aeea18 JB |
34 | with: |
35 | fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
b36a0f94 | 36 | - name: Dependency Review |
3a389887 | 37 | if: ${{ github.event_name == 'push' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }} |
76ec7220 | 38 | uses: actions/dependency-review-action@v3 |
b131d478 | 39 | with: |
3a389887 | 40 | base-ref: ${{ github.ref_name }} |
cc92c810 | 41 | head-ref: ${{ github.sha }} |
b36a0f94 | 42 | - name: Pull Request Dependency Review |
3a389887 JB |
43 | if: ${{ github.event_name == 'pull_request' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }} |
44 | uses: actions/dependency-review-action@v3 | |
e3874421 JB |
45 | - uses: pnpm/action-setup@v2 |
46 | with: | |
47 | version: 8 | |
d5d2241e | 48 | - name: Setup node ${{ matrix.node }} |
0642c3d2 | 49 | uses: actions/setup-node@v3 |
e7aeea18 | 50 | with: |
0642c3d2 | 51 | node-version: ${{ matrix.node }} |
e3874421 | 52 | cache: 'pnpm' |
881f450c | 53 | - name: pnpm install |
916678e9 | 54 | run: pnpm install --ignore-scripts |
e3874421 | 55 | - name: pnpm lint |
906ba5c5 | 56 | if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }} |
e3874421 JB |
57 | run: pnpm lint |
58 | - name: pnpm build | |
59 | run: pnpm build | |
881f450c JB |
60 | - name: pnpm test |
61 | run: pnpm test | |
e3874421 | 62 | - name: pnpm coverage |
ef28112f | 63 | if: ${{ github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }} |
e3874421 | 64 | run: pnpm coverage |
e7aeea18 | 65 | - name: SonarCloud Scan |
61a54e7b | 66 | if: ${{ needs.check-secrets.outputs.sonar-token-exists == 'true' && github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }} |
b0992947 | 67 | uses: sonarsource/sonarcloud-github-action@v2.0.2 |
e7aeea18 | 68 | env: |
18b41d7e | 69 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
e7aeea18 | 70 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
32de5a57 | 71 | build-dashboard: |
61a54e7b | 72 | needs: [check-secrets] |
32de5a57 LM |
73 | strategy: |
74 | matrix: | |
75 | os: [windows-latest, macos-latest, ubuntu-latest] | |
33885870 | 76 | node: ['18.x', '20.x'] |
ebb77a4c | 77 | name: Build dashboard with Node ${{ matrix.node }} on ${{ matrix.os }} |
916678e9 JB |
78 | runs-on: ${{ matrix.os }} |
79 | defaults: | |
80 | run: | |
81 | working-directory: ui/web | |
32de5a57 | 82 | steps: |
49722c24 | 83 | - uses: actions/checkout@v4 |
32de5a57 LM |
84 | with: |
85 | fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
b36a0f94 | 86 | - name: Dependency Review |
3a389887 | 87 | if: ${{ github.event_name == 'push' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }} |
76ec7220 | 88 | uses: actions/dependency-review-action@v3 |
b131d478 | 89 | with: |
3a389887 | 90 | base-ref: ${{ github.ref_name }} |
cc92c810 | 91 | head-ref: ${{ github.sha }} |
b36a0f94 | 92 | - name: Pull Request Dependency Review |
3a389887 JB |
93 | if: ${{ github.event_name == 'pull_request' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }} |
94 | uses: actions/dependency-review-action@v3 | |
e3874421 JB |
95 | - uses: pnpm/action-setup@v2 |
96 | with: | |
97 | version: 8 | |
d5d2241e | 98 | - name: Setup node ${{ matrix.node }} |
32de5a57 LM |
99 | uses: actions/setup-node@v3 |
100 | with: | |
101 | node-version: ${{ matrix.node }} | |
e3874421 | 102 | cache: 'pnpm' |
603f1011 | 103 | - name: pnpm install |
916678e9 | 104 | run: pnpm install --ignore-scripts |
e3874421 | 105 | - name: pnpm lint |
906ba5c5 | 106 | if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }} |
e3874421 JB |
107 | run: pnpm lint |
108 | - name: pnpm build | |
109 | run: pnpm build | |
603f1011 JB |
110 | - name: pnpm test |
111 | run: pnpm test | |
2de63014 | 112 | - name: pnpm coverage |
ef28112f | 113 | if: ${{ github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }} |
2de63014 JB |
114 | run: pnpm coverage |
115 | - name: SonarCloud Scan | |
61a54e7b | 116 | if: ${{ needs.check-secrets.outputs.sonar-token-exists == 'true' && github.repository == 'sap/e-mobility-charging-stations-simulator' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }} |
b0992947 | 117 | uses: sonarsource/sonarcloud-github-action@v2.0.2 |
2de63014 JB |
118 | with: |
119 | projectBaseDir: ui/web | |
120 | env: | |
18b41d7e | 121 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
2de63014 | 122 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
17cec4f7 | 123 | build-docker-image: |
4bfd22de | 124 | runs-on: ubuntu-latest |
73321f43 | 125 | name: Build docker image |
c168e7ad | 126 | steps: |
49722c24 | 127 | - uses: actions/checkout@v4 |
d5d2241e | 128 | - name: Setup Docker Buildx |
e7aeea18 | 129 | id: buildx |
5c555092 | 130 | uses: docker/setup-buildx-action@v3 |
e7aeea18 JB |
131 | - name: Build docker image |
132 | run: | | |
133 | cd docker | |
134 | make SUBMODULES_INIT=false |