unitTest.yml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. ports:
  25. - 3306:3306
  26. options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
  27. container:
  28. image: golang
  29. env:
  30. REPOSITORY: ${{ github.repository }}
  31. TRIGGERING_ACTOR: ${{ github.triggering_actor }}
  32. SOURCE_BRANCH: ${{ github.ref_name }}
  33. COMMIT: ${{ github.workflow_sha }}
  34. EVENT: ${{ github.event_name}}
  35. steps:
  36. - name: Checkout
  37. uses: actions/checkout@v4
  38. - name: Pull Request Labeler
  39. if: ${{ failure() }}
  40. uses: actions-cool/issues-helper@v3
  41. with:
  42. actions: 'add-labels'
  43. token: ${{ secrets.GITHUB_TOKEN }}
  44. issue-number: ${{ github.event.pull_request.number }}
  45. labels: 'Auto: Test Failed'
  46. - name: Setup Node.js environment
  47. run: apt update && apt install -y nodejs npm
  48. - name: Install Dependencies
  49. run: npm install --global yarn
  50. - name: FE build
  51. run: make build_fe
  52. - name: Run Test
  53. run: make test
  54. - name: Run Test Mysql
  55. run: make test_mysql