# Custom tests for mcdev
#
name: "Code Testing"

on:
    push:
        branches: [main, develop, hotfix]
    pull_request:
        # The branches below must be a subset of the branches above
        branches: [main, develop, hotfix]

jobs:
    lintandTesting:
        runs-on: ubuntu-latest
        strategy:
            fail-fast: false
            matrix:
                node: ["20.19", 21, 22, 23, 24, 25]
        name: lint & test w/ node v${{ matrix.node }}
        permissions:
            actions: read
            contents: read
            security-events: write

        steps:
            - name: Checkout repository
              uses: actions/checkout@v6

            - name: Setup node
              uses: actions/setup-node@v6
              with:
                  node-version: ${{ matrix.node }}
                  registry-url: https://registry.npmjs.org/

            - run: npm ci --ignore-scripts

            - run: npm run lint

            # Assuming code passes, run tests
            - name: Run mcdev-tests
              run: npm run test
