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.

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