name: Test coverage for main branch # default-branch.yml

on:
    push:
        branches:
            - main

permissions:
    # allow dependabot to execute this workflow
    pull-requests: write

jobs:
    hello_world_job:
        runs-on: ubuntu-latest
        name: Test and upload coverage
        steps:
            - name: Checkout
              uses: actions/checkout@v6
              with:
                  ref: ${{ github.event.ref }}
                  fetch-depth: 1000

            - uses: actions/setup-node@v6
              with:
                  node-version-file: ./package.json

            - run: npm ci --ignore-scripts

            - name: Run mcdev-tests with coverage
              run: npm run coverage

            - name: Prepare for Report Coverage (mini)
              run: |
                  npx c8 report --reporter json-summary --exclude-after-remap false

            - name: Upload coverage artifact
              uses: actions/upload-artifact@v7
              with:
                  name: test-coverage-output
                  path: coverage
                  overwrite: true
                  retention-days: 90
