continuous-integration-workflow.yml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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. java-version: [ 17 ]
  34. with:
  35. java-version: ${{ matrix.java-version }}
  36. test-args: --refresh-dependencies -PforceMavenRepositories=snapshot -PisOverrideVersionCatalog -PspringFrameworkVersion=6.0.+ -PreactorVersion=2022.0.+ -PspringDataVersion=2022.0.+ --stacktrace
  37. secrets: inherit
  38. check-samples:
  39. name: Check Samples
  40. runs-on: ubuntu-latest
  41. if: ${{ github.repository_owner == 'spring-projects' }}
  42. steps:
  43. - uses: actions/checkout@v4
  44. - name: Set up gradle
  45. uses: spring-io/spring-gradle-build-action@v2
  46. with:
  47. java-version: 17
  48. distribution: temurin
  49. - name: Check samples project
  50. env:
  51. LOCAL_REPOSITORY_PATH: ${{ github.workspace }}/build/publications/repos
  52. SAMPLES_DIR: ../spring-security-samples
  53. run: |
  54. # Extract version from gradle.properties
  55. version=$(cat gradle.properties | grep "version=" | awk -F'=' '{print $2}')
  56. # Extract samplesBranch from gradle.properties
  57. samples_branch=$(cat gradle.properties | grep "samplesBranch=" | awk -F'=' '{print $2}')
  58. ./gradlew publishMavenJavaPublicationToLocalRepository
  59. ./gradlew cloneRepository -PrepositoryName="spring-projects/spring-security-samples" -Pref="$samples_branch" -PcloneOutputDirectory="$SAMPLES_DIR"
  60. ./gradlew --project-dir "$SAMPLES_DIR" --init-script spring-security-ci.gradle -PlocalRepositoryPath="$LOCAL_REPOSITORY_PATH" -PspringSecurityVersion="$version" :runAllTests
  61. check-tangles:
  62. name: Check for Package Tangles
  63. runs-on: ubuntu-latest
  64. if: ${{ github.repository_owner == 'spring-projects' }}
  65. steps:
  66. - uses: actions/checkout@v4
  67. - name: Set up gradle
  68. uses: spring-io/spring-gradle-build-action@v2
  69. with:
  70. java-version: 17
  71. distribution: temurin
  72. - name: Check for package tangles
  73. env:
  74. STRUCTURE101_LICENSEID: ${{ secrets.STRUCTURE101_LICENSEID }}
  75. run: |
  76. ./gradlew check s101 -Ps101.licenseId="$STRUCTURE101_LICENSEID" --stacktrace
  77. deploy-artifacts:
  78. name: Deploy Artifacts
  79. needs: [ build, test, check-samples, check-tangles ]
  80. uses: spring-io/spring-security-release-tools/.github/workflows/deploy-artifacts.yml@v1
  81. with:
  82. should-deploy-artifacts: ${{ needs.build.outputs.should-deploy-artifacts }}
  83. secrets: inherit
  84. deploy-docs:
  85. name: Deploy Docs
  86. needs: [ build, test, check-samples, check-tangles ]
  87. uses: spring-io/spring-security-release-tools/.github/workflows/deploy-docs.yml@v1
  88. with:
  89. should-deploy-docs: ${{ needs.build.outputs.should-deploy-artifacts }}
  90. secrets: inherit
  91. deploy-schema:
  92. name: Deploy Schema
  93. needs: [ build, test, check-samples, check-tangles ]
  94. uses: spring-io/spring-security-release-tools/.github/workflows/deploy-schema.yml@v1
  95. with:
  96. should-deploy-schema: ${{ needs.build.outputs.should-deploy-artifacts }}
  97. secrets: inherit
  98. perform-release:
  99. name: Perform Release
  100. needs: [ deploy-artifacts, deploy-docs, deploy-schema ]
  101. uses: spring-io/spring-security-release-tools/.github/workflows/perform-release.yml@v1
  102. with:
  103. should-perform-release: ${{ needs.deploy-artifacts.outputs.artifacts-deployed }}
  104. project-version: ${{ needs.deploy-artifacts.outputs.project-version }}
  105. milestone-repo-url: https://repo.spring.io/artifactory/milestone
  106. release-repo-url: https://repo1.maven.org/maven2
  107. artifact-path: org/springframework/security/spring-security-core
  108. slack-announcing-id: spring-security-announcing
  109. secrets: inherit
  110. notify_result:
  111. name: Check for failures
  112. needs: [ perform-release ]
  113. if: failure()
  114. runs-on: ubuntu-latest
  115. permissions:
  116. actions: read
  117. steps:
  118. - name: Send Slack message
  119. # Workaround while waiting for Gamesight/slack-workflow-status#38 to be fixed
  120. # See https://github.com/Gamesight/slack-workflow-status/issues/38
  121. uses: sjohnr/slack-workflow-status@v1-beta
  122. with:
  123. repo_token: ${{ secrets.GITHUB_TOKEN }}
  124. slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}
  125. channel: '#spring-security-ci'
  126. name: 'CI Notifier'