ci.yml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. name: Node CI
  2. on:
  3. push:
  4. branches-ignore:
  5. - tmp/**
  6. jobs:
  7. test:
  8. runs-on: ubuntu-latest
  9. strategy:
  10. matrix:
  11. node-version: [10.x, 12.x, 14.x]
  12. steps:
  13. - uses: actions/checkout@v2
  14. - name: Use Node.js ${{ matrix.node-version }}
  15. uses: actions/setup-node@v1
  16. with:
  17. node-version: ${{ matrix.node-version }}
  18. - name: Cache/Restore node_modules
  19. id: cache-dependencies
  20. uses: actions/cache@v1
  21. with:
  22. path: node_modules
  23. key: ${{ runner.OS }}-node_modules-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
  24. - name: Get yarn cache dir
  25. if: steps.cache-dependencies.outputs.cache-hit != 'true'
  26. id: cache-yarn
  27. run: echo "::set-output name=dir::$(yarn cache dir)"
  28. - name: Cache/Restore yarn cache
  29. if: steps.cache-dependencies.outputs.cache-hit != 'true'
  30. uses: actions/cache@v1
  31. with:
  32. path: ${{ steps.cache-yarn.outputs.dir }}
  33. key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
  34. restore-keys: |
  35. ${{ runner.os }}-yarn-${{ matrix.node-version }}-
  36. - name: Print dependencies
  37. run: |
  38. echo -n "node " && node -v
  39. echo -n "npm " && npm -v
  40. yarn list --depth=0
  41. - name: yarn lint
  42. run: |
  43. yarn lint
  44. - name: yarn test
  45. run: |
  46. yarn test
  47. - name: Slack Notification
  48. uses: weseek/ghaction-slack-notification@master
  49. if: failure()
  50. with:
  51. type: ${{ job.status }}
  52. job_name: '*test (${{ matrix.node-version }})*'
  53. channel: '#ci'
  54. isCompactMode: true
  55. url: ${{ secrets.SLACK_WEBHOOK_URL }}