unitTest.yml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. name: PR - Docker unit test
  2. on:
  3. pull_request:
  4. branches:
  5. - master
  6. types: [opened, reopened, synchronize, edited]
  7. # Please, always create a pull request instead of push to master.
  8. permissions:
  9. contents: read
  10. pull-requests: write
  11. concurrency:
  12. group: docker-test-${{ github.ref_name }}
  13. cancel-in-progress: true
  14. jobs:
  15. test:
  16. name: Docker tests
  17. runs-on: ubuntu-latest
  18. services:
  19. mysql:
  20. image: mysql
  21. env:
  22. MYSQL_DATABASE: pmail
  23. MYSQL_ROOT_PASSWORD: githubTest
  24. options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
  25. container:
  26. image: golang
  27. env:
  28. REPOSITORY: ${{ github.repository }}
  29. TRIGGERING_ACTOR: ${{ github.triggering_actor }}
  30. SOURCE_BRANCH: ${{ github.ref_name }}
  31. COMMIT: ${{ github.workflow_sha }}
  32. EVENT: ${{ github.event_name}}
  33. steps:
  34. - name: Checkout
  35. uses: actions/checkout@v4
  36. - name: Pull Request Labeler
  37. if: ${{ failure() }}
  38. uses: actions-cool/issues-helper@v3
  39. with:
  40. actions: 'add-labels'
  41. token: ${{ secrets.GITHUB_TOKEN }}
  42. issue-number: ${{ github.event.pull_request.number }}
  43. labels: 'Auto: Test Failed'
  44. - name: Setup Node.js environment
  45. run: apt update && apt install -y nodejs npm
  46. - name: Install Dependencies
  47. run: npm install --global yarn
  48. - name: FE build
  49. run: make build_fe
  50. - name: Run Test
  51. run: make test
  52. - uses: actions/upload-artifact@v4
  53. with:
  54. name: dbfile
  55. path: server/config/pmail_temp.db
  56. - name: Run Test Mysql
  57. run: make test_mysql