2020-11-10 10:25:16 -05:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2021-04-26 17:50:35 -04:00
|
|
|
- main
|
2020-11-10 10:25:16 -05:00
|
|
|
schedule:
|
|
|
|
- cron: '0 10 * * *' # Once per day at 10am UTC
|
2021-01-21 08:02:54 -05:00
|
|
|
workflow_dispatch: # Manual trigger
|
2020-11-10 10:25:16 -05:00
|
|
|
|
|
|
|
env:
|
|
|
|
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
|
|
|
GRADLE_ENTERPRISE_CACHE_USER: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USER }}
|
|
|
|
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
|
|
|
|
GRADLE_ENTERPRISE_SECRET_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }}
|
|
|
|
COMMIT_OWNER: ${{ github.event.pusher.name }}
|
|
|
|
COMMIT_SHA: ${{ github.sha }}
|
2020-11-16 14:02:11 -05:00
|
|
|
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
|
|
|
|
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
|
2021-05-03 16:12:12 -04:00
|
|
|
RUN_JOBS: ${{ github.repository == 'spring-projects/spring-security' }}
|
2020-11-10 10:25:16 -05:00
|
|
|
|
|
|
|
jobs:
|
2021-05-03 16:12:12 -04:00
|
|
|
prerequisites:
|
|
|
|
name: Pre-requisites for building
|
2020-11-10 10:25:16 -05:00
|
|
|
runs-on: ubuntu-latest
|
2021-05-03 16:12:12 -04:00
|
|
|
outputs:
|
|
|
|
runjobs: ${{ steps.continue.outputs.runjobs }}
|
2020-11-10 10:25:16 -05:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Initiate error tracking
|
|
|
|
uses: spring-projects/track-build-errors-action@v1
|
|
|
|
with:
|
2021-05-03 16:12:12 -04:00
|
|
|
job-name: "prerequisites"
|
2020-11-10 10:25:16 -05:00
|
|
|
- name: Export errors file
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: errors
|
2021-05-03 16:12:12 -04:00
|
|
|
path: job-prerequisites.txt
|
|
|
|
- id: continue
|
|
|
|
name: Determine if should continue
|
2021-05-11 18:20:46 -04:00
|
|
|
if: env.RUN_JOBS == 'true'
|
|
|
|
run: echo "::set-output name=runjobs::true"
|
2021-02-05 17:21:07 -05:00
|
|
|
build_jdk_11:
|
|
|
|
name: Build JDK 11
|
2021-05-03 16:12:12 -04:00
|
|
|
needs: [prerequisites]
|
2020-11-10 10:25:16 -05:00
|
|
|
runs-on: ubuntu-latest
|
2021-05-11 18:20:46 -04:00
|
|
|
if: needs.prerequisites.outputs.runjobs
|
2020-11-10 10:25:16 -05:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2021-02-05 17:21:07 -05:00
|
|
|
- name: Set up JDK 11
|
2020-11-10 10:25:16 -05:00
|
|
|
uses: actions/setup-java@v1
|
|
|
|
with:
|
2021-02-05 17:21:07 -05:00
|
|
|
java-version: '11'
|
2020-11-10 10:25:16 -05:00
|
|
|
- name: Cache Gradle packages
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ~/.gradle/caches
|
|
|
|
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
|
|
|
|
- name: Build with Gradle
|
|
|
|
run: |
|
|
|
|
export GRADLE_ENTERPRISE_CACHE_USERNAME="$GRADLE_ENTERPRISE_CACHE_USER"
|
|
|
|
export GRADLE_ENTERPRISE_CACHE_PASSWORD="$GRADLE_ENTERPRISE_CACHE_PASSWORD"
|
|
|
|
export GRADLE_ENTERPRISE_ACCESS_KEY="$GRADLE_ENTERPRISE_SECRET_ACCESS_KEY"
|
2020-11-16 14:02:11 -05:00
|
|
|
./gradlew clean build --continue -PartifactoryUsername="$ARTIFACTORY_USERNAME" -PartifactoryPassword="$ARTIFACTORY_PASSWORD"
|
2020-11-10 10:25:16 -05:00
|
|
|
- name: Track error step
|
|
|
|
uses: spring-projects/track-build-errors-action@v1
|
|
|
|
if: ${{ failure() }}
|
|
|
|
with:
|
|
|
|
job-name: ${{ github.job }}
|
|
|
|
- name: Export errors file
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
if: ${{ failure() }}
|
|
|
|
with:
|
|
|
|
name: errors
|
|
|
|
path: job-${{ github.job }}.txt
|
2021-05-14 13:13:18 -04:00
|
|
|
build_windows:
|
|
|
|
name: Build Windows
|
2021-05-07 07:47:47 -04:00
|
|
|
needs: [prerequisites]
|
|
|
|
runs-on: windows-latest
|
|
|
|
if: needs.prerequisites.outputs.runjobs
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up JDK 11
|
|
|
|
uses: actions/setup-java@v1
|
|
|
|
with:
|
|
|
|
java-version: '11'
|
|
|
|
- name: Cache Gradle packages
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ~/.gradle/caches
|
|
|
|
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
|
2021-05-14 13:13:18 -04:00
|
|
|
- name: Build with Gradle
|
2021-05-07 07:47:47 -04:00
|
|
|
run: |
|
|
|
|
set GRADLE_ENTERPRISE_CACHE_USERNAME="$GRADLE_ENTERPRISE_CACHE_USER"
|
|
|
|
set GRADLE_ENTERPRISE_CACHE_PASSWORD="$GRADLE_ENTERPRISE_CACHE_PASSWORD"
|
|
|
|
set GRADLE_ENTERPRISE_ACCESS_KEY="$GRADLE_ENTERPRISE_SECRET_ACCESS_KEY"
|
2021-05-14 13:13:18 -04:00
|
|
|
./gradlew clean build --continue -PartifactoryUsername="$ARTIFACTORY_USERNAME" -PartifactoryPassword="$ARTIFACTORY_PASSWORD"
|
|
|
|
- name: Track error step
|
|
|
|
uses: spring-projects/track-build-errors-action@v1
|
|
|
|
if: ${{ failure() }}
|
|
|
|
with:
|
|
|
|
job-name: ${{ github.job }}
|
|
|
|
- name: Export errors file
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
if: ${{ failure() }}
|
|
|
|
with:
|
|
|
|
name: errors
|
|
|
|
path: job-${{ github.job }}.txt
|
2020-11-10 10:25:16 -05:00
|
|
|
snapshot_tests:
|
|
|
|
name: Test against snapshots
|
2021-05-03 16:12:12 -04:00
|
|
|
needs: [prerequisites]
|
2020-11-10 10:25:16 -05:00
|
|
|
runs-on: ubuntu-latest
|
2021-05-11 18:20:46 -04:00
|
|
|
if: needs.prerequisites.outputs.runjobs
|
2020-11-10 10:25:16 -05:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up JDK
|
|
|
|
uses: actions/setup-java@v1
|
|
|
|
with:
|
2021-02-05 17:21:07 -05:00
|
|
|
java-version: '11'
|
2020-11-10 10:25:16 -05:00
|
|
|
- name: Snapshot Tests
|
|
|
|
run: |
|
|
|
|
export GRADLE_ENTERPRISE_CACHE_USERNAME="$GRADLE_ENTERPRISE_CACHE_USER"
|
|
|
|
export GRADLE_ENTERPRISE_CACHE_PASSWORD="$GRADLE_ENTERPRISE_CACHE_PASSWORD"
|
|
|
|
export GRADLE_ENTERPRISE_ACCESS_KEY="$GRADLE_ENTERPRISE_SECRET_ACCESS_KEY"
|
2020-11-16 14:11:07 -05:00
|
|
|
./gradlew test --refresh-dependencies -PartifactoryUsername="$ARTIFACTORY_USERNAME" -PartifactoryPassword="$ARTIFACTORY_PASSWORD" -PforceMavenRepositories=snapshot -PspringVersion='5.+' -PreactorVersion='20+' -PspringDataVersion='Neumann-BUILD-SNAPSHOT' -PrsocketVersion=1.1.0-SNAPSHOT -PspringBootVersion=2.4.0-SNAPSHOT -PlocksDisabled --stacktrace
|
2020-11-10 10:25:16 -05:00
|
|
|
- name: Track error step
|
|
|
|
uses: spring-projects/track-build-errors-action@v1
|
|
|
|
if: ${{ failure() }}
|
|
|
|
with:
|
|
|
|
job-name: ${{ github.job }}
|
|
|
|
- name: Export errors file
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
if: ${{ failure() }}
|
|
|
|
with:
|
|
|
|
name: errors
|
|
|
|
path: job-${{ github.job }}.txt
|
|
|
|
sonar_analysis:
|
|
|
|
name: Static Code Analysis
|
2021-05-03 16:12:12 -04:00
|
|
|
needs: [prerequisites]
|
2020-11-10 10:25:16 -05:00
|
|
|
runs-on: ubuntu-latest
|
2021-05-11 18:20:46 -04:00
|
|
|
if: needs.prerequisites.outputs.runjobs
|
2020-11-10 10:25:16 -05:00
|
|
|
env:
|
|
|
|
SONAR_URL: ${{ secrets.SONAR_URL }}
|
|
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up JDK
|
|
|
|
uses: actions/setup-java@v1
|
|
|
|
with:
|
2021-02-05 17:21:07 -05:00
|
|
|
java-version: '11'
|
2021-04-26 17:50:35 -04:00
|
|
|
- name: Run Sonar on given (non-main) branch
|
|
|
|
if: ${{ github.ref != 'refs/heads/main' }}
|
2020-11-10 10:25:16 -05:00
|
|
|
run: |
|
|
|
|
export BRANCH=${GITHUB_REF#refs/heads/}
|
|
|
|
export GRADLE_ENTERPRISE_CACHE_USERNAME="$GRADLE_ENTERPRISE_CACHE_USER"
|
|
|
|
export GRADLE_ENTERPRISE_CACHE_PASSWORD="$GRADLE_ENTERPRISE_CACHE_PASSWORD"
|
|
|
|
export GRADLE_ENTERPRISE_ACCESS_KEY="$GRADLE_ENTERPRISE_SECRET_ACCESS_KEY"
|
2020-11-16 14:11:07 -05:00
|
|
|
./gradlew sonarqube -PartifactoryUsername="$ARTIFACTORY_USERNAME" -PartifactoryPassword="$ARTIFACTORY_PASSWORD" -PexcludeProjects='**/samples/**' -Dsonar.projectKey="spring-security-${GITHUB_REF#refs/heads/}" -Dsonar.projectName="spring-security-${GITHUB_REF#refs/heads/}" -Dsonar.host.url="$SONAR_URL" -Dsonar.login="$SONAR_TOKEN" --stacktrace
|
2021-04-26 17:50:35 -04:00
|
|
|
- name: Run Sonar on main
|
|
|
|
if: ${{ github.ref == 'refs/heads/main' }}
|
2020-11-10 10:25:16 -05:00
|
|
|
run: |
|
|
|
|
export GRADLE_ENTERPRISE_CACHE_USERNAME="$GRADLE_ENTERPRISE_CACHE_USER"
|
|
|
|
export GRADLE_ENTERPRISE_CACHE_PASSWORD="$GRADLE_ENTERPRISE_CACHE_PASSWORD"
|
|
|
|
export GRADLE_ENTERPRISE_ACCESS_KEY="$GRADLE_ENTERPRISE_SECRET_ACCESS_KEY"
|
2020-11-16 14:11:07 -05:00
|
|
|
./gradlew sonarqube -PartifactoryUsername="$ARTIFACTORY_USERNAME" -PartifactoryPassword="$ARTIFACTORY_PASSWORD" -PexcludeProjects='**/samples/**' -Dsonar.host.url="$SONAR_URL" -Dsonar.login="$SONAR_TOKEN" --stacktrace
|
2020-11-10 10:25:16 -05:00
|
|
|
- name: Track error step
|
|
|
|
uses: spring-projects/track-build-errors-action@v1
|
|
|
|
if: ${{ failure() }}
|
|
|
|
with:
|
|
|
|
job-name: ${{ github.job }}
|
|
|
|
- name: Export errors file
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
if: ${{ failure() }}
|
|
|
|
with:
|
|
|
|
name: errors
|
|
|
|
path: job-${{ github.job }}.txt
|
|
|
|
deploy_artifacts:
|
|
|
|
name: Deploy Artifacts
|
2021-05-14 13:13:18 -04:00
|
|
|
needs: [build_jdk_11, build_windows, snapshot_tests, sonar_analysis]
|
2020-11-10 10:25:16 -05:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up JDK
|
|
|
|
uses: actions/setup-java@v1
|
|
|
|
with:
|
2021-02-05 17:21:07 -05:00
|
|
|
java-version: '11'
|
2020-11-10 10:25:16 -05:00
|
|
|
- name: Deploy artifacts
|
|
|
|
run: |
|
|
|
|
export GRADLE_ENTERPRISE_CACHE_USERNAME="$GRADLE_ENTERPRISE_CACHE_USER"
|
|
|
|
export GRADLE_ENTERPRISE_CACHE_PASSWORD="$GRADLE_ENTERPRISE_CACHE_PASSWORD"
|
|
|
|
export GRADLE_ENTERPRISE_ACCESS_KEY="$GRADLE_ENTERPRISE_SECRET_ACCESS_KEY"
|
|
|
|
export VERSION_HEADER=$'Version: GnuPG v2\n\n'
|
2021-03-30 14:55:00 -04:00
|
|
|
export ORG_GRADLE_PROJECT_signingKey=${GPG_PRIVATE_KEY_NO_HEADER#"$VERSION_HEADER"}
|
2020-11-10 10:25:16 -05:00
|
|
|
export ORG_GRADLE_PROJECT_signingPassword="$GPG_PASSPHRASE"
|
|
|
|
./gradlew deployArtifacts -PossrhUsername="$OSSRH_TOKEN_USERNAME" -PossrhPassword="$OSSRH_TOKEN_PASSWORD" -PartifactoryUsername="$ARTIFACTORY_USERNAME" -PartifactoryPassword="$ARTIFACTORY_PASSWORD" --stacktrace --no-parallel
|
|
|
|
./gradlew finalizeDeployArtifacts -PossrhUsername="$OSSRH_TOKEN_USERNAME" -PossrhPassword="$OSSRH_TOKEN_PASSWORD" -PartifactoryUsername="$ARTIFACTORY_USERNAME" -PartifactoryPassword="$ARTIFACTORY_PASSWORD" --stacktrace --no-parallel
|
|
|
|
env:
|
|
|
|
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
|
|
|
|
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
|
|
|
|
OSSRH_TOKEN_USERNAME: ${{ secrets.OSSRH_TOKEN_USERNAME }}
|
|
|
|
OSSRH_TOKEN_PASSWORD: ${{ secrets.OSSRH_TOKEN_PASSWORD }}
|
|
|
|
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
|
|
|
|
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
|
|
|
|
- name: Track error step
|
|
|
|
uses: spring-projects/track-build-errors-action@v1
|
|
|
|
if: ${{ failure() }}
|
|
|
|
with:
|
|
|
|
job-name: ${{ github.job }}
|
|
|
|
- name: Export errors file
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
if: ${{ failure() }}
|
|
|
|
with:
|
|
|
|
name: errors
|
|
|
|
path: job-${{ github.job }}.txt
|
|
|
|
deploy_docs:
|
|
|
|
name: Deploy Docs
|
2021-05-14 13:13:18 -04:00
|
|
|
needs: [build_jdk_11, build_windows, snapshot_tests, sonar_analysis]
|
2020-11-10 10:25:16 -05:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up JDK
|
|
|
|
uses: actions/setup-java@v1
|
|
|
|
with:
|
2021-02-05 17:21:07 -05:00
|
|
|
java-version: '11'
|
2020-11-10 10:25:16 -05:00
|
|
|
- name: Deploy Docs
|
|
|
|
run: |
|
|
|
|
export GRADLE_ENTERPRISE_CACHE_USERNAME="$GRADLE_ENTERPRISE_CACHE_USER"
|
|
|
|
export GRADLE_ENTERPRISE_CACHE_PASSWORD="$GRADLE_ENTERPRISE_CACHE_PASSWORD"
|
|
|
|
export GRADLE_ENTERPRISE_ACCESS_KEY="$GRADLE_ENTERPRISE_SECRET_ACCESS_KEY"
|
|
|
|
./gradlew deployDocs -PdeployDocsSshKey="$DOCS_SSH_KEY" -PdeployDocsSshUsername="$DOCS_USERNAME" -PdeployDocsHost="$DOCS_HOST" --stacktrace
|
|
|
|
env:
|
|
|
|
DOCS_USERNAME: ${{ secrets.DOCS_USERNAME }}
|
|
|
|
DOCS_SSH_KEY: ${{ secrets.DOCS_SSH_KEY }}
|
|
|
|
DOCS_HOST: ${{ secrets.DOCS_HOST }}
|
|
|
|
- name: Track error step
|
|
|
|
uses: spring-projects/track-build-errors-action@v1
|
|
|
|
if: ${{ failure() }}
|
|
|
|
with:
|
|
|
|
job-name: ${{ github.job }}
|
|
|
|
- name: Export errors file
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
if: ${{ failure() }}
|
|
|
|
with:
|
|
|
|
name: errors
|
|
|
|
path: job-${{ github.job }}.txt
|
|
|
|
deploy_schema:
|
|
|
|
name: Deploy Schema
|
2021-05-14 13:13:18 -04:00
|
|
|
needs: [build_jdk_11, build_windows, snapshot_tests, sonar_analysis]
|
2020-11-10 10:25:16 -05:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up JDK
|
|
|
|
uses: actions/setup-java@v1
|
|
|
|
with:
|
2021-02-05 17:21:07 -05:00
|
|
|
java-version: '11'
|
2020-11-10 10:25:16 -05:00
|
|
|
- name: Deploy Schema
|
|
|
|
run: |
|
|
|
|
export GRADLE_ENTERPRISE_CACHE_USERNAME="$GRADLE_ENTERPRISE_CACHE_USER"
|
|
|
|
export GRADLE_ENTERPRISE_CACHE_PASSWORD="$GRADLE_ENTERPRISE_CACHE_PASSWORD"
|
|
|
|
export GRADLE_ENTERPRISE_ACCESS_KEY="$GRADLE_ENTERPRISE_SECRET_ACCESS_KEY"
|
|
|
|
./gradlew deploySchema -PdeployDocsSshKey="$DOCS_SSH_KEY" -PdeployDocsSshUsername="$DOCS_USERNAME" -PdeployDocsHost="$DOCS_HOST" --stacktrace --info
|
|
|
|
env:
|
|
|
|
DOCS_USERNAME: ${{ secrets.DOCS_USERNAME }}
|
|
|
|
DOCS_SSH_KEY: ${{ secrets.DOCS_SSH_KEY }}
|
|
|
|
DOCS_HOST: ${{ secrets.DOCS_HOST }}
|
|
|
|
- name: Track error step
|
|
|
|
uses: spring-projects/track-build-errors-action@v1
|
|
|
|
if: ${{ failure() }}
|
|
|
|
with:
|
|
|
|
job-name: ${{ github.job }}
|
|
|
|
- name: Export errors file
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
if: ${{ failure() }}
|
|
|
|
with:
|
|
|
|
name: errors
|
|
|
|
path: job-${{ github.job }}.txt
|
|
|
|
notify_result:
|
|
|
|
name: Check for failures
|
2021-05-14 13:13:18 -04:00
|
|
|
needs: [build_jdk_11, build_windows, snapshot_tests, sonar_analysis, deploy_artifacts, deploy_docs, deploy_schema]
|
2020-11-10 10:25:16 -05:00
|
|
|
if: always()
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Download errors folder
|
|
|
|
uses: actions/download-artifact@v2
|
|
|
|
with:
|
|
|
|
name: errors
|
|
|
|
- name: Send Slack message
|
|
|
|
uses: spring-projects/notify-slack-errors-action@v1
|
|
|
|
with:
|
|
|
|
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
|
|
|
|
branch-name: ${{ github.ref }}
|
|
|
|
commit-sha: ${{ github.sha }}
|
|
|
|
commit-owner: ${{ github.actor }}
|
|
|
|
repo-name: ${{ github.repository }}
|
|
|
|
run-id: ${{ github.run_id }}
|