2
0

continuous-integration-workflow.yml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. name: CI
  2. on:
  3. push:
  4. branches-ignore:
  5. - "dependabot/**"
  6. schedule:
  7. - cron: '0 10 * * *' # Once per day at 10am UTC
  8. workflow_dispatch: # Manual trigger
  9. env:
  10. GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USER }}
  11. GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
  12. GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }}
  13. permissions:
  14. contents: read
  15. jobs:
  16. build:
  17. name: Build
  18. uses: spring-io/spring-security-release-tools/.github/workflows/build.yml@v1
  19. strategy:
  20. matrix:
  21. os: [ ubuntu-latest, windows-latest ]
  22. jdk: [ 17 ]
  23. with:
  24. runs-on: ${{ matrix.os }}
  25. java-version: ${{ matrix.jdk }}
  26. distribution: temurin
  27. secrets: inherit
  28. test:
  29. name: Test Against Snapshots
  30. uses: spring-io/spring-security-release-tools/.github/workflows/test.yml@v1
  31. strategy:
  32. matrix:
  33. include:
  34. - java-version: 21-ea
  35. toolchain: 21
  36. - java-version: 17
  37. toolchain: 17
  38. with:
  39. java-version: ${{ matrix.java-version }}
  40. test-args: --refresh-dependencies -PforceMavenRepositories=snapshot -PisOverrideVersionCatalog -PtestToolchain=${{ matrix.toolchain }} -PspringFrameworkVersion=6.1.+ -PreactorVersion=2023.0.+ -PspringDataVersion=2023.1.+ --stacktrace
  41. secrets: inherit
  42. check-samples:
  43. name: Check Samples
  44. runs-on: ubuntu-latest
  45. if: ${{ github.repository_owner == 'spring-projects' }}
  46. steps:
  47. - uses: actions/checkout@v4
  48. - name: Set up gradle
  49. uses: spring-io/spring-gradle-build-action@v2
  50. with:
  51. java-version: 17
  52. distribution: temurin
  53. - name: Check samples project
  54. env:
  55. LOCAL_REPOSITORY_PATH: ${{ github.workspace }}/build/publications/repos
  56. SAMPLES_DIR: ../spring-security-samples
  57. run: |
  58. # Extract version from gradle.properties
  59. version=$(cat gradle.properties | grep "version=" | awk -F'=' '{print $2}')
  60. # Extract samplesBranch from gradle.properties
  61. samples_branch=$(cat gradle.properties | grep "samplesBranch=" | awk -F'=' '{print $2}')
  62. ./gradlew publishMavenJavaPublicationToLocalRepository
  63. ./gradlew cloneRepository -PrepositoryName="spring-projects/spring-security-samples" -Pref="$samples_branch" -PcloneOutputDirectory="$SAMPLES_DIR"
  64. ./gradlew --project-dir "$SAMPLES_DIR" --init-script spring-security-ci.gradle -PlocalRepositoryPath="$LOCAL_REPOSITORY_PATH" -PspringSecurityVersion="$version" :runAllTests
  65. check-tangles:
  66. name: Check for Package Tangles
  67. runs-on: ubuntu-latest
  68. if: ${{ github.repository_owner == 'spring-projects' }}
  69. steps:
  70. - uses: actions/checkout@v4
  71. - name: Set up gradle
  72. uses: spring-io/spring-gradle-build-action@v2
  73. with:
  74. java-version: 17
  75. distribution: temurin
  76. - name: Check for package tangles
  77. env:
  78. STRUCTURE101_LICENSEID: ${{ secrets.STRUCTURE101_LICENSEID }}
  79. run: |
  80. ./gradlew check s101 -Ps101.licenseId="$STRUCTURE101_LICENSEID" --stacktrace
  81. deploy-artifacts:
  82. name: Deploy Artifacts
  83. needs: [ build, test, check-samples, check-tangles ]
  84. uses: spring-io/spring-security-release-tools/.github/workflows/deploy-artifacts.yml@v1
  85. with:
  86. should-deploy-artifacts: ${{ needs.build.outputs.should-deploy-artifacts }}
  87. secrets: inherit
  88. deploy-docs:
  89. name: Deploy Docs
  90. needs: [ build, test, check-samples, check-tangles ]
  91. uses: spring-io/spring-security-release-tools/.github/workflows/deploy-docs.yml@v1
  92. with:
  93. should-deploy-docs: ${{ needs.build.outputs.should-deploy-artifacts }}
  94. secrets: inherit
  95. deploy-schema:
  96. name: Deploy Schema
  97. needs: [ build, test, check-samples, check-tangles ]
  98. uses: spring-io/spring-security-release-tools/.github/workflows/deploy-schema.yml@v1
  99. with:
  100. should-deploy-schema: ${{ needs.build.outputs.should-deploy-artifacts }}
  101. secrets: inherit
  102. perform-release:
  103. name: Perform Release
  104. needs: [ deploy-artifacts, deploy-docs, deploy-schema ]
  105. uses: spring-io/spring-security-release-tools/.github/workflows/perform-release.yml@v1
  106. with:
  107. should-perform-release: ${{ needs.deploy-artifacts.outputs.artifacts-deployed }}
  108. project-version: ${{ needs.deploy-artifacts.outputs.project-version }}
  109. milestone-repo-url: https://repo.spring.io/artifactory/milestone
  110. release-repo-url: https://repo1.maven.org/maven2
  111. artifact-path: org/springframework/security/spring-security-core
  112. slack-announcing-id: spring-security-announcing
  113. secrets: inherit
  114. notify_result:
  115. name: Check for failures
  116. needs: [ perform-release ]
  117. if: failure()
  118. runs-on: ubuntu-latest
  119. permissions:
  120. actions: read
  121. steps:
  122. - name: Send Slack message
  123. # Workaround while waiting for Gamesight/slack-workflow-status#38 to be fixed
  124. # See https://github.com/Gamesight/slack-workflow-status/issues/38
  125. uses: sjohnr/slack-workflow-status@v1-beta
  126. with:
  127. repo_token: ${{ secrets.GITHUB_TOKEN }}
  128. slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}
  129. channel: '#spring-security-ci'
  130. name: 'CI Notifier'