continuous-integration-workflow.yml 4.9 KB

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