ci.yml 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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: Install dependencies
  37. if: steps.cache-dependencies.outputs.cache-hit != 'true'
  38. run: |
  39. yarn
  40. - name: Print dependencies
  41. run: |
  42. echo -n "node " && node -v
  43. echo -n "npm " && npm -v
  44. yarn list --depth=0
  45. - name: yarn lint
  46. run: |
  47. yarn lint
  48. - name: yarn test
  49. run: |
  50. yarn test
  51. - name: Slack Notification
  52. uses: weseek/ghaction-slack-notification@master
  53. if: failure()
  54. with:
  55. type: ${{ job.status }}
  56. job_name: '*test (${{ matrix.node-version }})*'
  57. channel: '#ci'
  58. isCompactMode: true
  59. url: ${{ secrets.SLACK_WEBHOOK_URL }}