continuous-integration-workflow.yml 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. name: CI
  2. on:
  3. push:
  4. schedule:
  5. - cron: '0 10 * * *' # Once per day at 10am UTC
  6. workflow_dispatch: # Manual trigger
  7. env:
  8. SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
  9. GRADLE_ENTERPRISE_CACHE_USER: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USER }}
  10. GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
  11. GRADLE_ENTERPRISE_SECRET_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }}
  12. COMMIT_OWNER: ${{ github.event.pusher.name }}
  13. COMMIT_SHA: ${{ github.sha }}
  14. ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
  15. ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
  16. RUN_JOBS: ${{ github.repository == 'spring-projects/spring-security' }}
  17. jobs:
  18. prerequisites:
  19. name: Pre-requisites for building
  20. runs-on: ubuntu-latest
  21. outputs:
  22. runjobs: ${{ steps.continue.outputs.runjobs }}
  23. steps:
  24. - id: continue
  25. name: Determine if should continue
  26. if: env.RUN_JOBS == 'true'
  27. run: echo "::set-output name=runjobs::true"
  28. build_jdk_8:
  29. name: Build JDK 8
  30. needs: [prerequisites]
  31. runs-on: ubuntu-latest
  32. if: needs.prerequisites.outputs.runjobs
  33. steps:
  34. - uses: actions/checkout@v2
  35. - name: Set up JDK 8
  36. uses: actions/setup-java@v1
  37. with:
  38. java-version: '8'
  39. - name: Setup gradle user name
  40. run: |
  41. mkdir -p ~/.gradle
  42. echo 'systemProp.user.name=spring-builds+github' >> ~/.gradle/gradle.properties
  43. - name: Cache Gradle packages
  44. uses: actions/cache@v2
  45. with:
  46. path: ~/.gradle/caches
  47. key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
  48. - name: Build with Gradle
  49. env:
  50. GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USER }}
  51. GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
  52. GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }}
  53. run: ./gradlew clean build --continue -PartifactoryUsername="$ARTIFACTORY_USERNAME" -PartifactoryPassword="$ARTIFACTORY_PASSWORD"
  54. test_jdk_11:
  55. name: Test JDK 11
  56. needs: [prerequisites]
  57. runs-on: ubuntu-latest
  58. if: needs.prerequisites.outputs.runjobs
  59. steps:
  60. - uses: actions/checkout@v2
  61. - name: Set up JDK 11
  62. uses: actions/setup-java@v1
  63. with:
  64. java-version: '11'
  65. - name: Setup gradle user name
  66. run: |
  67. mkdir -p ~/.gradle
  68. echo 'systemProp.user.name=spring-builds+github' >> ~/.gradle/gradle.properties
  69. - name: Cache Gradle packages
  70. uses: actions/cache@v2
  71. with:
  72. path: ~/.gradle/caches
  73. key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
  74. - name: Build with Gradle
  75. env:
  76. GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USER }}
  77. GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
  78. GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }}
  79. run: ./gradlew clean test --continue -PartifactoryUsername="$ARTIFACTORY_USERNAME" -PartifactoryPassword="$ARTIFACTORY_PASSWORD"
  80. snapshot_tests:
  81. name: Test against snapshots
  82. needs: [prerequisites]
  83. runs-on: ubuntu-latest
  84. if: needs.prerequisites.outputs.runjobs
  85. steps:
  86. - uses: actions/checkout@v2
  87. - name: Set up JDK
  88. uses: actions/setup-java@v1
  89. with:
  90. java-version: '11'
  91. - name: Setup gradle user name
  92. run: |
  93. mkdir -p ~/.gradle
  94. echo 'systemProp.user.name=spring-builds+github' >> ~/.gradle/gradle.properties
  95. - name: Snapshot Tests
  96. run: |
  97. export GRADLE_ENTERPRISE_CACHE_USERNAME="$GRADLE_ENTERPRISE_CACHE_USER"
  98. export GRADLE_ENTERPRISE_CACHE_PASSWORD="$GRADLE_ENTERPRISE_CACHE_PASSWORD"
  99. export GRADLE_ENTERPRISE_ACCESS_KEY="$GRADLE_ENTERPRISE_SECRET_ACCESS_KEY"
  100. ./gradlew test --refresh-dependencies -PartifactoryUsername="$ARTIFACTORY_USERNAME" -PartifactoryPassword="$ARTIFACTORY_PASSWORD" -PforceMavenRepositories=snapshot -PspringVersion='5.2.+' -PreactorVersion=Dysprosium-BUILD-SNAPSHOT -PspringDataVersion=Lovelace-BUILD-SNAPSHOT -PlocksDisabled --stacktrace
  101. deploy_artifacts:
  102. name: Deploy Artifacts
  103. needs: [test_jdk_11, build_jdk_8, snapshot_tests]
  104. runs-on: ubuntu-latest
  105. steps:
  106. - uses: actions/checkout@v2
  107. - name: Set up JDK
  108. uses: actions/setup-java@v1
  109. with:
  110. java-version: '11'
  111. - name: Setup gradle user name
  112. run: |
  113. mkdir -p ~/.gradle
  114. echo 'systemProp.user.name=spring-builds+github' >> ~/.gradle/gradle.properties
  115. - name: Deploy artifacts
  116. run: |
  117. export GRADLE_ENTERPRISE_CACHE_USERNAME="$GRADLE_ENTERPRISE_CACHE_USER"
  118. export GRADLE_ENTERPRISE_CACHE_PASSWORD="$GRADLE_ENTERPRISE_CACHE_PASSWORD"
  119. export GRADLE_ENTERPRISE_ACCESS_KEY="$GRADLE_ENTERPRISE_SECRET_ACCESS_KEY"
  120. ./gradlew deployArtifacts -PossrhTokenUsername="$OSSRH_TOKEN_USERNAME" -PossrhTokenPassword="$OSSRH_TOKEN_PASSWORD" -PartifactoryUsername="$ARTIFACTORY_USERNAME" -PartifactoryPassword="$ARTIFACTORY_PASSWORD" --stacktrace --no-parallel
  121. ./gradlew finalizeDeployArtifacts -PossrhTokenUsername="$OSSRH_TOKEN_USERNAME" -PossrhTokenPassword="$OSSRH_TOKEN_PASSWORD" -PartifactoryUsername="$ARTIFACTORY_USERNAME" -PartifactoryPassword="$ARTIFACTORY_PASSWORD" --stacktrace --no-parallel
  122. env:
  123. ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }}
  124. ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_PASSPHRASE }}
  125. OSSRH_TOKEN_USERNAME: ${{ secrets.OSSRH_S01_TOKEN_USERNAME }}
  126. OSSRH_TOKEN_PASSWORD: ${{ secrets.OSSRH_S01_TOKEN_PASSWORD }}
  127. ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
  128. ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
  129. deploy_docs:
  130. name: Deploy Docs
  131. needs: [test_jdk_11, build_jdk_8, snapshot_tests]
  132. runs-on: ubuntu-latest
  133. steps:
  134. - uses: actions/checkout@v2
  135. - name: Set up JDK
  136. uses: actions/setup-java@v1
  137. with:
  138. java-version: '11'
  139. - name: Setup gradle user name
  140. run: |
  141. mkdir -p ~/.gradle
  142. echo 'systemProp.user.name=spring-builds+github' >> ~/.gradle/gradle.properties
  143. - name: Deploy Docs
  144. run: |
  145. export GRADLE_ENTERPRISE_CACHE_USERNAME="$GRADLE_ENTERPRISE_CACHE_USER"
  146. export GRADLE_ENTERPRISE_CACHE_PASSWORD="$GRADLE_ENTERPRISE_CACHE_PASSWORD"
  147. export GRADLE_ENTERPRISE_ACCESS_KEY="$GRADLE_ENTERPRISE_SECRET_ACCESS_KEY"
  148. ./gradlew deployDocs -PdeployDocsSshKey="$DOCS_SSH_KEY" -PdeployDocsSshUsername="$DOCS_USERNAME" -PdeployDocsHost="$DOCS_HOST" --stacktrace
  149. env:
  150. DOCS_USERNAME: ${{ secrets.DOCS_USERNAME }}
  151. DOCS_SSH_KEY: ${{ secrets.DOCS_SSH_KEY }}
  152. DOCS_HOST: ${{ secrets.DOCS_HOST }}
  153. deploy_schema:
  154. name: Deploy Schema
  155. needs: [test_jdk_11, build_jdk_8, snapshot_tests]
  156. runs-on: ubuntu-latest
  157. steps:
  158. - uses: actions/checkout@v2
  159. - name: Set up JDK
  160. uses: actions/setup-java@v1
  161. with:
  162. java-version: '11'
  163. - name: Setup gradle user name
  164. run: |
  165. mkdir -p ~/.gradle
  166. echo 'systemProp.user.name=spring-builds+github' >> ~/.gradle/gradle.properties
  167. - name: Deploy Schema
  168. run: |
  169. export GRADLE_ENTERPRISE_CACHE_USERNAME="$GRADLE_ENTERPRISE_CACHE_USER"
  170. export GRADLE_ENTERPRISE_CACHE_PASSWORD="$GRADLE_ENTERPRISE_CACHE_PASSWORD"
  171. export GRADLE_ENTERPRISE_ACCESS_KEY="$GRADLE_ENTERPRISE_SECRET_ACCESS_KEY"
  172. ./gradlew deploySchema -PdeployDocsSshKey="$DOCS_SSH_KEY" -PdeployDocsSshUsername="$DOCS_USERNAME" -PdeployDocsHost="$DOCS_HOST" --stacktrace --info
  173. env:
  174. DOCS_USERNAME: ${{ secrets.DOCS_USERNAME }}
  175. DOCS_SSH_KEY: ${{ secrets.DOCS_SSH_KEY }}
  176. DOCS_HOST: ${{ secrets.DOCS_HOST }}
  177. notify_result:
  178. name: Check for failures
  179. needs: [test_jdk_11, build_jdk_8, snapshot_tests, deploy_artifacts, deploy_docs, deploy_schema]
  180. if: failure()
  181. runs-on: ubuntu-latest
  182. steps:
  183. - name: Send Slack message
  184. uses: Gamesight/slack-workflow-status@v1.0.1
  185. with:
  186. repo_token: ${{ secrets.GITHUB_TOKEN }}
  187. slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}
  188. channel: '#spring-security-ci'
  189. name: 'CI Notifier'