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.

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