You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

180 lines
4.9 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. ---
  2. name: Continuous Integration
  3. on:
  4. pull_request:
  5. branches: ["*", series/*]
  6. paths-ignore:
  7. - ".dockerignore"
  8. - ".github/workflow/ci.yml"
  9. - "Changelog.md"
  10. - "Dockerfile"
  11. - "doc/**"
  12. - "docker/**"
  13. - "LICENSE"
  14. - "README.md"
  15. # - "tests/e2e/**"
  16. push:
  17. branches: ["*", series/*]
  18. tags: [v*]
  19. paths-ignore:
  20. - ".dockerignore"
  21. - ".github/workflow/ci.yml"
  22. - "Changelog.md"
  23. - "Dockerfile"
  24. - "doc/**"
  25. - "docker/**"
  26. - "LICENSE"
  27. - "README.md"
  28. # - "tests/e2e/**"
  29. jobs:
  30. build:
  31. name: Build and Test
  32. runs-on: ubuntu-latest
  33. env:
  34. CODEGEN_DB_HOST: localhost
  35. CODEGEN_DB_PORT: 5432
  36. CODEGEN_DB_USER: codegenuser
  37. CODEGEN_DB_PASSWORD: postgres
  38. CODEGEN_DB_NAME: codegendb
  39. services:
  40. postgres:
  41. image: postgres:12-alpine
  42. env:
  43. POSTGRES_PASSWORD: postgres
  44. POSTGRES_USER: codegenuser
  45. POSTGRES_DB: codegendb
  46. # Set health checks to wait until postgres has started
  47. options: >-
  48. --health-cmd pg_isready
  49. --health-interval 10s
  50. --health-timeout 5s
  51. --health-retries 5
  52. ports:
  53. - 5432:5432
  54. steps:
  55. - name: Check out repository code
  56. uses: actions/checkout@v2
  57. - name: Coursier cache
  58. uses: coursier/cache-action@v6
  59. - name: Setup
  60. uses: olafurpg/setup-scala@v10
  61. with:
  62. java-version: adopt@1.11
  63. - name: Migrate
  64. run: csbt flyway/flywayMigrate
  65. - name: Lint
  66. run: csbt "scalafmtCheckAll;scalafixAll --check"
  67. - name: Compile
  68. run: |
  69. csbt "compile; test:compile"
  70. - name: Run Unit Tests
  71. run: |
  72. csbt test
  73. - name: Run Integration Tests
  74. run: |
  75. csbt it:test
  76. publish:
  77. name: Publish Release Docker Image
  78. needs: [build]
  79. if: |
  80. github.event_name != 'pull_request' && \
  81. (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
  82. runs-on: ubuntu-latest
  83. env:
  84. CODEGEN_DB_HOST: localhost
  85. CODEGEN_DB_PORT: 5432
  86. CODEGEN_DB_USER: codegenuser
  87. CODEGEN_DB_PASSWORD: postgres
  88. CODEGEN_DB_NAME: codegendb
  89. DOCKER_JAVA_IMAGE: azul/zulu-openjdk-alpine:11-jre-headless
  90. services:
  91. postgres:
  92. image: postgres:12-alpine
  93. env:
  94. POSTGRES_PASSWORD: postgres
  95. POSTGRES_USER: codegenuser
  96. POSTGRES_DB: codegendb
  97. # Set health checks to wait until postgres has started
  98. options: >-
  99. --health-cmd pg_isready
  100. --health-interval 10s
  101. --health-timeout 5s
  102. --health-retries 5
  103. ports:
  104. - 5432:5432
  105. steps:
  106. - name: Check out repository code
  107. uses: actions/checkout@v2
  108. - name: Coursier cache
  109. uses: coursier/cache-action@v6
  110. - name: Setup
  111. uses: olafurpg/setup-scala@v10
  112. with:
  113. java-version: adopt@1.11
  114. - name: Login to Docker Hub
  115. uses: docker/login-action@v1
  116. with:
  117. username: rohansircar
  118. password: ${{ secrets.DOCKER_LOGIN_PASSWORD }}
  119. - name: Migrate
  120. run: csbt flyway/flywayMigrate
  121. - name: Publish Tag
  122. if: startsWith(github.ref, 'refs/tags/v')
  123. run: |
  124. csbt docker:publish
  125. - name: Publish Latest
  126. if: github.ref == 'refs/heads/main'
  127. env:
  128. DOCKER_PUBLISH_TAG: latest
  129. run: |
  130. csbt docker:publish
  131. publish-devel:
  132. name: Publish Devel Docker Image
  133. needs: [build]
  134. if: github.event_name != 'pull_request' && github.ref == 'refs/heads/devel'
  135. runs-on: ubuntu-latest
  136. env:
  137. CODEGEN_DB_HOST: localhost
  138. CODEGEN_DB_PORT: 5432
  139. CODEGEN_DB_USER: codegenuser
  140. CODEGEN_DB_PASSWORD: postgres
  141. CODEGEN_DB_NAME: codegendb
  142. DOCKER_JAVA_IMAGE: azul/zulu-openjdk-alpine:11-jre-headless
  143. DOCKER_PUBLISH_TAG: devel
  144. services:
  145. postgres:
  146. image: postgres:12-alpine
  147. env:
  148. POSTGRES_PASSWORD: postgres
  149. POSTGRES_USER: codegenuser
  150. POSTGRES_DB: codegendb
  151. # Set health checks to wait until postgres has started
  152. options: >-
  153. --health-cmd pg_isready
  154. --health-interval 10s
  155. --health-timeout 5s
  156. --health-retries 5
  157. ports:
  158. - 5432:5432
  159. steps:
  160. - name: Check out repository code
  161. uses: actions/checkout@v2
  162. - name: Coursier cache
  163. uses: coursier/cache-action@v6
  164. - name: Setup
  165. uses: olafurpg/setup-scala@v10
  166. with:
  167. java-version: adopt@1.11
  168. - name: Login to Docker Hub
  169. uses: docker/login-action@v1
  170. with:
  171. username: rohansircar
  172. password: ${{ secrets.DOCKER_LOGIN_PASSWORD }}
  173. - name: Migrate
  174. run: csbt flyway/flywayMigrate
  175. - name: Publish
  176. run: |
  177. csbt docker:publish