| 1 | name: css-loader |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | branches: |
| 6 | - master |
| 7 | - next |
| 8 | pull_request: |
| 9 | branches: |
| 10 | - master |
| 11 | - next |
| 12 | |
| 13 | permissions: |
| 14 | contents: read |
| 15 | |
| 16 | jobs: |
| 17 | lint: |
| 18 | name: Lint - ${{ matrix.os }} - Node v${{ matrix.node-version }} |
| 19 | |
| 20 | env: |
| 21 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 22 | |
| 23 | strategy: |
| 24 | matrix: |
| 25 | os: [ubuntu-latest] |
| 26 | node-version: [lts/*] |
| 27 | |
| 28 | runs-on: ${{ matrix.os }} |
| 29 | |
| 30 | concurrency: |
| 31 | group: lint-${{ matrix.os }}-v${{ matrix.node-version }}-${{ github.ref }} |
| 32 | cancel-in-progress: true |
| 33 | |
| 34 | steps: |
| 35 | - uses: actions/checkout@v3 |
| 36 | with: |
| 37 | fetch-depth: 0 |
| 38 | |
| 39 | - name: Use Node.js ${{ matrix.node-version }} |
| 40 | uses: actions/setup-node@v3 |
| 41 | with: |
| 42 | node-version: ${{ matrix.node-version }} |
| 43 | cache: "npm" |
| 44 | |
| 45 | - name: Install dependencies |
| 46 | run: npm ci |
| 47 | |
| 48 | - name: Lint |
| 49 | run: npm run lint |
| 50 | |
| 51 | - name: Security audit |
| 52 | run: npm run security |
| 53 | |
| 54 | - name: Check commit message |
| 55 | uses: wagoid/commitlint-github-action@v5 |
| 56 | |
| 57 | test: |
| 58 | name: Test - ${{ matrix.os }} - Node v${{ matrix.node-version }}, Webpack ${{ matrix.webpack-version }} |
| 59 | |
| 60 | strategy: |
| 61 | matrix: |
| 62 | os: [ubuntu-latest, windows-latest, macos-latest] |
| 63 | node-version: [12.x, 14.x, 16.x, 18.x, 20.x] |
| 64 | webpack-version: [latest] |
| 65 | |
| 66 | runs-on: ${{ matrix.os }} |
| 67 | |
| 68 | concurrency: |
| 69 | group: test-${{ matrix.os }}-v${{ matrix.node-version }}-${{ matrix.webpack-version }}-${{ github.ref }} |
| 70 | cancel-in-progress: true |
| 71 | |
| 72 | steps: |
| 73 | - name: Setup Git |
| 74 | if: matrix.os == 'windows-latest' |
| 75 | run: git config --global core.autocrlf input |
| 76 | |
| 77 | - uses: actions/checkout@v3 |
| 78 | |
| 79 | - name: Use Node.js ${{ matrix.node-version }} |
| 80 | uses: actions/setup-node@v3 |
| 81 | with: |
| 82 | node-version: ${{ matrix.node-version }} |
| 83 | cache: "npm" |
| 84 | |
| 85 | - name: Install dependencies |
| 86 | run: npm ci |
| 87 | |
| 88 | - name: Install webpack ${{ matrix.webpack-version }} |
| 89 | if: matrix.webpack-version != 'latest' |
| 90 | run: npm i webpack@${{ matrix.webpack-version }} |
| 91 | |
| 92 | - name: Run tests for webpack version ${{ matrix.webpack-version }} |
| 93 | run: npm run test:coverage -- --ci |
| 94 | |
| 95 | - name: Submit coverage data to codecov |
| 96 | uses: codecov/codecov-action@v3 |
| 97 | with: |
| 98 | token: ${{ secrets.CODECOV_TOKEN }} |