aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/test.yml
blob: a513e67538fef8478cafc98e6f36d2a3d00ecdc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Grunt tests

on: [push, pull_request]

jobs:
  grunt:
    name: Grunt based tests with Node.js ${{ matrix.node-version }}

    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [12.x, 14.x]

    steps:
      - uses: actions/checkout@v3

      - uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node-version }}

      - name: Get npm cache directory
        id: npm-cache-dir
        run: |
          echo "::set-output name=dir::$(npm config get cache)"

      - name: Cache npm dependencies
        uses: actions/cache@v3
        with:
          path: ${{ steps.npm-cache-dir.outputs.dir }}
          key: ${{ runner.os }}-node-${{ matrix.node-version }}-npm-${{ hashFiles('**/package.json') }}
          restore-keys: |
            ${{ runner.os }}-node-${{ matrix.node-version }}-npm-
            ${{ runner.os }}-node-${{ matrix.node-version }}-
            ${{ runner.os }}-node-
            ${{ runner.os }}-

      - name: Install npm dependencies
        run: npm install

      #  Keep these steps in sync with the default command tasks in our Gruntfile!
      - name: Run lint
        run: node_modules/.bin/grunt lint

      - name: Run RequireJS
        run: node_modules/.bin/grunt requirejs

      - name: Run Qunit
        run: node_modules/.bin/grunt test

  valid:
    name: Build & tests

    needs: grunt

    runs-on: ubuntu-latest

    steps:
      - name: Grunt based tests passed
        run: echo "✅"