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.

153 lines
4.3 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
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: Compile
  47. run: |
  48. csbt "compile; test:compile"
  49. - name: Run Tests
  50. run: |
  51. echo $GITHUB_REF
  52. echo ${GITHUB_REF#refs/*/}
  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: Set env
  97. run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
  98. - name: Migrate
  99. run: csbt flyway/flywayMigrate
  100. - name: Publish
  101. run: |
  102. csbt docker:publish
  103. publish-devel:
  104. name: Publish Devel Docker Image
  105. needs: [build]
  106. if: github.event_name != 'pull_request' && github.ref == 'refs/heads/devel'
  107. runs-on: ubuntu-latest
  108. # container: node:12-buster
  109. env:
  110. CODEGEN_DB_HOST: localhost
  111. CODEGEN_DB_PORT: 5432
  112. CODEGEN_DB_USER: codegenuser
  113. CODEGEN_DB_PASSWORD: postgres
  114. CODEGEN_DB_NAME: codegendb
  115. DOCKER_JAVA_IMAGE: azul/zulu-openjdk-alpine:11-jre-headless
  116. DOCKER_PUBLISH_TAG: latest
  117. services:
  118. postgres:
  119. image: postgres:12-alpine
  120. env:
  121. POSTGRES_PASSWORD: postgres
  122. POSTGRES_USER: codegenuser
  123. POSTGRES_DB: codegendb
  124. # Set health checks to wait until postgres has started
  125. options: >-
  126. --health-cmd pg_isready
  127. --health-interval 10s
  128. --health-timeout 5s
  129. --health-retries 5
  130. ports:
  131. - 5432:5432
  132. steps:
  133. - name: Check out repository code
  134. uses: actions/checkout@v2
  135. - name: Coursier cache
  136. uses: coursier/cache-action@v6
  137. - name: Setup
  138. uses: olafurpg/setup-scala@v10
  139. with:
  140. java-version: adopt@1.11
  141. - name: Login to Docker Hub
  142. uses: docker/login-action@v1
  143. with:
  144. username: rohansircar
  145. password: ${{ secrets.DOCKER_LOGIN_PASSWORD }}
  146. - name: Migrate
  147. run: csbt flyway/flywayMigrate
  148. - name: Publish
  149. run: |
  150. csbt docker:publish