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