|
| 1 | +name: Feature |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - 'feature/**' |
| 7 | + |
| 8 | +concurrency: |
| 9 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 10 | + cancel-in-progress: true |
| 11 | + |
| 12 | +jobs: |
| 13 | + install: |
| 14 | + if: "!contains(github.event.head_commit.message, 'skip ci')" |
| 15 | + name: Install |
| 16 | + runs-on: ${{ matrix.os }} |
| 17 | + |
| 18 | + strategy: |
| 19 | + matrix: |
| 20 | + os: [ubuntu-latest] |
| 21 | + node: [20] |
| 22 | + |
| 23 | + steps: |
| 24 | + - uses: actions/setup-node@v4 |
| 25 | + with: |
| 26 | + node-version: ${{ matrix.node }} |
| 27 | + - name: Checkout Repo |
| 28 | + uses: actions/checkout@v4 |
| 29 | + - name: cache node_modules |
| 30 | + uses: actions/cache@v4 |
| 31 | + id: cache |
| 32 | + with: |
| 33 | + path: | |
| 34 | + node_modules |
| 35 | + key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/package-lock.json')) }} |
| 36 | + |
| 37 | + - name: Install Dependencies |
| 38 | + if: steps.cache.outputs.cache-hit != 'true' |
| 39 | + run: npm ci |
| 40 | + |
| 41 | + - name: Lint |
| 42 | + run: npm run lint |
| 43 | + |
| 44 | + - name: Vitest - Test & Coverage |
| 45 | + run: npm run coverage |
| 46 | + |
| 47 | + - name: Archive vitest code coverage results |
| 48 | + uses: actions/upload-artifact@v4 |
| 49 | + with: |
| 50 | + name: vitest-code-coverage-report |
| 51 | + path: ./coverage/ |
| 52 | + |
| 53 | + sonarcloud: |
| 54 | + name: SonarCloud |
| 55 | + needs: install |
| 56 | + runs-on: ${{ matrix.os }} |
| 57 | + |
| 58 | + strategy: |
| 59 | + matrix: |
| 60 | + os: [ubuntu-latest] |
| 61 | + node: [20] |
| 62 | + |
| 63 | + steps: |
| 64 | + - uses: actions/checkout@v4 |
| 65 | + with: |
| 66 | + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis |
| 67 | + - name: Download vitest code coverage results |
| 68 | + uses: actions/download-artifact@v4 |
| 69 | + with: |
| 70 | + name: vitest-code-coverage-report |
| 71 | + path: ./coverage/ |
| 72 | + - name: check |
| 73 | + run: cd coverage && find . |
| 74 | + - name: SonarCloud Scan |
| 75 | + uses: SonarSource/sonarcloud-github-action@master |
| 76 | + env: |
| 77 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any |
| 78 | + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
0 commit comments