tests.yml 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. name: Tests CI
  2. on: [push, pull_request]
  3. jobs:
  4. test:
  5. runs-on: ubuntu-latest
  6. steps:
  7. - uses: actions/checkout@v2
  8. - name: Test using Node.js
  9. uses: actions/setup-node@v1
  10. with:
  11. node-version: '18'
  12. - run: npm install
  13. - run: npm run test:ci
  14. - name: Tests ✅
  15. if: ${{ success() }}
  16. run: |
  17. curl --request POST \
  18. --url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} \
  19. --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
  20. --header 'content-type: application/json' \
  21. --data '{
  22. "context": "tests",
  23. "state": "success",
  24. "description": "Tests passed",
  25. "target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
  26. }'
  27. - name: Tests 🚨
  28. if: ${{ failure() }}
  29. run: |
  30. curl --request POST \
  31. --url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} \
  32. --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
  33. --header 'content-type: application/json' \
  34. --data '{
  35. "context": "tests",
  36. "state": "failure",
  37. "description": "Tests failed",
  38. "target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
  39. }'