node.js.yml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. name: Node.js CI
  2. on:
  3. pull_request:
  4. branches: [ main ]
  5. push:
  6. branches: [ main ]
  7. permissions:
  8. contents: read
  9. jobs:
  10. test:
  11. name: Test
  12. runs-on: ubuntu-latest
  13. strategy:
  14. matrix:
  15. node-version: [14.x, 16.x, 18.x ]
  16. steps:
  17. - uses: actions/checkout@v3
  18. - name: Use Node.js ${{ matrix.node-version }}
  19. uses: actions/setup-node@v3
  20. with:
  21. node-version: ${{ matrix.node-version }}
  22. - uses: actions/cache@v3
  23. with:
  24. path: ~/.npm
  25. key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
  26. restore-keys: |
  27. ${{ runner.os }}-node-
  28. - run: npm ci
  29. name: Install dependencies
  30. - name: Test
  31. env:
  32. NCM_API_TEST_LOGIN_COUNTRY_CODE: ${{ secrets.NCM_API_TEST_LOGIN_COUNTRY_CODE }}
  33. NCM_API_TEST_LOGIN_PHONE: ${{ secrets.NCM_API_TEST_LOGIN_PHONE }}
  34. NCM_API_TEST_LOGIN_PASSWORD: ${{ secrets.NCM_API_TEST_LOGIN_PASSWORD }}
  35. run: npm test
  36. lint:
  37. name: Lint
  38. runs-on: ubuntu-latest
  39. strategy:
  40. matrix:
  41. node-version: [14.x]
  42. steps:
  43. - uses: actions/checkout@v3
  44. - name: Use Node.js ${{ matrix.node-version }}
  45. uses: actions/setup-node@v3
  46. with:
  47. node-version: ${{ matrix.node-version }}
  48. - uses: actions/cache@v3
  49. with:
  50. path: ~/.npm
  51. key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
  52. restore-keys: |
  53. ${{ runner.os }}-node-
  54. - run: npm ci
  55. name: Install dependencies
  56. - name: Lint
  57. run: npm run lint