diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 53803da..2bc22b2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,36 +5,81 @@ on: branches: [ main ] pull_request: branches: [ main ] + workflow_dispatch: # Allow manual workflow execution + +# Allow only one running workflow per branch +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: test: + name: Test (Node.js ${{ matrix.node-version }}) runs-on: ubuntu-latest + timeout-minutes: 10 strategy: + fail-fast: false # Test all Node versions even if one fails matrix: node-version: [lts/*, current] steps: - name: Checkout uses: actions/checkout@v5 + with: + # For better coverage reports + fetch-depth: 0 - - name: Use Node.js ${{ matrix.node-version }} + - name: Setup Node.js ${{ matrix.node-version }} uses: actions/setup-node@v5 with: node-version: ${{ matrix.node-version }} + cache: 'npm' - name: Install dependencies - run: npm ci + run: npm ci --prefer-offline --no-audit - name: Analyze JavaScript files run: npm run-script lint - name: Run test suite - run: | - npm test - npm run-script coverage + run: npm test + + - name: Generate coverage report + run: npm run-script coverage - - name: Push coverage report - uses: coverallsapp/github-action@master + - name: Upload coverage report to Coveralls + if: matrix.node-version == 'lts/*' # Only upload once + uses: coverallsapp/github-action@v2 with: github-token: ${{ secrets.GITHUB_TOKEN }} + path-to-lcov: ./coverage/lcov.info + + jquery-compatibility: + name: jQuery Compatibility Tests + runs-on: ubuntu-latest + timeout-minutes: 10 + + strategy: + fail-fast: false + matrix: + jquery-version: ['3.7.1', '4.0.0-rc.1'] + + steps: + - name: Checkout + uses: actions/checkout@v5 + + - name: Setup Node.js + uses: actions/setup-node@v5 + with: + node-version: 'lts/*' + cache: 'npm' + + - name: Install dependencies + run: npm ci --prefer-offline --no-audit + + - name: Install jQuery ${{ matrix.jquery-version }} + run: npm install jquery@${{ matrix.jquery-version }} + + - name: Run test suite with jQuery ${{ matrix.jquery-version }} + run: npm test diff --git a/README.md b/README.md index 0344177..a61a9dd 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ The most common use case would be: ```html

Go to example site - + +