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