<commit_before>name: CAS

env:
  JAVA_OPTS: "-Xms512m -Xmx6048m -Xss128m -XX:ReservedCodeCacheSize=512m -server -XX:+UseG1GC"
  GRADLE_OPTS: "-Xms512m -Xmx6048m -Xss128m -XX:ReservedCodeCacheSize=512m -server -XX:+UseG1GC"
  TERM: xterm-256color
  SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
  SONATYPE_PWD: ${{ secrets.SONATYPE_PWD }}
  DOCKER_USER: ${{ secrets.DOCKER_USER }}
  DOCKER_PWD: ${{ secrets.DOCKER_PWD }}
  GH_PAGES_TOKEN: ${{ secrets.GH_PAGES_TOKEN }}
  RENOVATE_TOKEN: ${{ secrets.RENOVATE_TOKEN }}
  GRADLE_BUILDCACHE_USER: ${{ secrets.GRADLE_BUILDCACHE_USER }}
  GRADLE_BUILDCACHE_PSW: ${{ secrets.GRADLE_BUILDCACHE_PSW }}
  CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
  SONARCLOUD_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  PYTHON_VERSION: 3.8.2
  JDK_CURRENT: 11.0.10
  JDK_LATEST: 15
  
##########################################################################

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

##########################################################################

jobs:
  cancel-previous-runs:
    runs-on: ubuntu-latest
    timeout-minutes: 1
    steps:
      - uses: styfle/cancel-workflow-action@0.3.1
        with:
          workflow_id: 1291155,1328268
          access_token: ${{ github.token }}
          
  initialize:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: Initialize
        run: ls ./ci && chmod -R 777 ./ci/*.sh && ./ci/init-build.sh

##########################################################################
  cache:
    runs-on: ubuntu-latest
    needs: [initialize]
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/checkout@v2
      - name: Download Dependencies
        run: ./gradlew --build-cache --configure-on-demand --no-daemon downloadDependencies --parallel --refresh-dependencies
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-

##########################################################################

  build:
    needs: [cache]
    if: ${{ !contains(github.event.head_commit.message, 'trigger dependency update') }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, windows-latest, macos-latest]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v2
#      - name: Setup tmate session
#        uses: mxschmitt/action-tmate@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
      - name: Build with Gradle
        run: ./gradlew --build-cache --configure-on-demand --no-daemon build -x test -x javadoc -x check --parallel
      - uses: actions/upload-artifact@v2
        if: ${{ matrix.os == 'ubuntu-latest' }}
        with:
          name: binary-artifacts
          path: ./**/build/libs/*.*

##########################################################################

  build-latest-jdk:
    runs-on: ubuntu-latest
    if: ${{ !contains(github.event.head_commit.message, 'trigger dependency update') }}
    needs: [cache]
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_LATEST }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
      - name: Build with Gradle
        run: ./gradlew --build-cache --configure-on-demand --no-daemon build -x test -x javadoc -x check --parallel
        
##########################################################################

  validate-docs:
    runs-on: ubuntu-latest
    if: ${{ !contains(github.head_ref, 'renovate') && github.event_name == 'push' && !contains(github.event.head_commit.message, 'trigger dependency update') }}
    needs: [cache]
    steps:
      - uses: actions/checkout@v2
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
      - name: Validate Documentation
        run: ./ci/validate-documentation.sh

##########################################################################
  
  static-analysis:
    runs-on: ubuntu-latest
    needs: [build]
    continue-on-error: true
    if: ${{ !contains(github.head_ref, 'renovate') }}
    strategy:
      matrix:
        category:
          - spotbugsMain
          - spotbugsTest
          - checkstyleMain
          - checkstyleTest
          - checkLicense
    steps:
      - uses: actions/checkout@v2
#      - name: Setup tmate session
#        uses: mxschmitt/action-tmate@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
      - uses: actions/download-artifact@v2
        with:
          name: binary-artifacts
      - name: Run Analysis
        run: ./gradlew --build-cache --configure-on-demand --parallel --no-daemon ${{ matrix.category }} -x test -x javadoc -DskipNestedConfigMetadataGen=true -DshowStandardStreams=true
        
##########################################################################

  validate-codebase:
    runs-on: ubuntu-latest
    if: ${{ !contains(github.head_ref, 'renovate') && !contains(github.event.head_commit.message, 'trigger dependency update') }}
    needs: [cache]
    strategy:
      fail-fast: false
      matrix:
        check:
          - CheckDuplicateGradleConfiguration
          - CheckDuplicateTestConfiguration
          - CheckMissingClassInTestsSuite
          - CheckMissingTestsSuiteClassAnnotation
          - CheckMissingUtilityClassAnnotation
          - CheckRedundantTestConfigurationInheritance
          - CheckSpringConfigurationBeanProxying
          - CheckSpringConfigurationFactories
          - CheckMissingTestTagAnnotation
          - CheckEnforceLombokAnnotations
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
      - name: Validate Codebase
        run: java ./ci/checks/${{ matrix.check }}.java .
        
##########################################################################

  validate-javadocs:
    runs-on: ubuntu-latest
    needs: [build]
    if: ${{ !contains(github.head_ref, 'renovate') }}
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
      - uses: actions/download-artifact@v2
        with:
          name: binary-artifacts
      - name: Validate Javadocs
        run: ./gradlew --build-cache --configure-on-demand --no-daemon --parallel javadoc -x test -x check -DskipNestedConfigMetadataGen=true --parallel

##########################################################################

  validate-commandline-shell:
    runs-on: ubuntu-latest
    needs: [build]
    if: ${{ !contains(github.head_ref, 'renovate') }}
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
      - uses: actions/download-artifact@v2
        with:
          name: binary-artifacts
      - name: Validate CAS Command-line Shell
        run: |
          casVersion=$(./gradlew casVersion --no-daemon -q)
          java -jar support/cas-server-support-shell/build/libs/cas-server-support-shell-${casVersion}.jar @ci/tests/shell/cas-shell-script.sh

##########################################################################

  validate-webapp-embedded:
    runs-on: ubuntu-latest
    needs: [build]
    if: ${{ !contains(github.head_ref, 'renovate') }}
    strategy:
      fail-fast: false
      matrix:
        category:
          - tomcat
          - jetty
          - undertow
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
      - uses: actions/download-artifact@v2
        with:
          name: binary-artifacts
      - name: Validate Web Application Server
        run: ./ci/tests/webapp/validate-embedded-webapp.sh ${{ matrix.category }}

##########################################################################

  validate-webapp-external-tomcat:
    runs-on: ubuntu-latest
    needs: [build]
    if: ${{ !contains(github.head_ref, 'renovate') }}
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
      - uses: actions/download-artifact@v2
        with:
          name: binary-artifacts
      - name: Validate Web Application Server via External Apache Tomcat
        run: ./ci/tests/webapp/validate-external-webapp.sh tomcat

##########################################################################

  validate-spring-cloud-config-server:
    runs-on: ubuntu-latest
    needs: [build]
    if: ${{ !contains(github.head_ref, 'renovate') }}
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
      - uses: actions/download-artifact@v2
        with:
          name: binary-artifacts
      - name: Validate Spring Cloud Configuration Server
        run: ./ci/tests/webapp/validate-configserver-webapp.sh

##########################################################################

  validate-eureka-discovery-server:
    runs-on: ubuntu-latest
    needs: [build]
    if: ${{ !contains(github.head_ref, 'renovate') }}
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
      - uses: actions/download-artifact@v2
        with:
          name: binary-artifacts
      - name: Validate Eureka Discovery Server
        run: ./ci/tests/webapp/validate-eurekaserver-webapp.sh

##########################################################################

  validate-spring-boot-admin-server:
    runs-on: ubuntu-latest
    needs: [build]
    if: ${{ !contains(github.head_ref, 'renovate') }}
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
      - uses: actions/download-artifact@v2
        with:
          name: binary-artifacts
      - name: Validate Spring Boot Admin Server
        run: ./ci/tests/webapp/validate-bootadmin-webapp.sh


##########################################################################

  publish-snapshots:
    runs-on: ubuntu-latest
    needs: [build]
    if: ${{ github.event_name == 'push' }}
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
      - uses: actions/download-artifact@v2
        with:
          name: binary-artifacts
      - name: Publish SNAPSHOTs
        if: ${{ env.SONATYPE_USER != null && env.SONATYPE_PWD != null }}
        run: ./gradlew -DpublishSnapshots=true --build-cache --configure-on-demand --no-daemon --parallel -Dorg.gradle.internal.http.socketTimeout=180000 -Dorg.gradle.internal.http.connectionTimeout=180000 build publish -x test -x javadoc -x check -DsonatypeUsername="${SONATYPE_USER}" -DsonatypePassword="${<PASSWORD>}"

  ##########################################################################

  publish-docker-image:
    runs-on: ubuntu-latest
    needs: [publish-snapshots]
    steps:
      - name: Prepare
        run: |
          mkdir work
          cd work
          curl https://casinit.herokuapp.com/starter.tgz | tar -xzvf -
          chmod -R 777 ./*.sh
          ls
      - name: Build Docker Image
        run: |
          cd work
          ./docker-build.sh latest
      - name: Publish Docker Image
        if: ${{ github.event_name == 'push' && env.DOCKER_USER != null && env.DOCKER_PWD != null }}
        run: |
          cd work
          ls
          ./docker-push.sh "${DOCKER_USER}" "${DOCKER_PWD}" latest

##########################################################################

  publish-docs:
    runs-on: ubuntu-latest
    needs: [validate-docs]
    if: ${{ github.event_name == 'push' }}
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
      - name: Publish Documentation
        if: ${{ env.GH_PAGES_TOKEN != null  }}
        run: ./ci/push-docs-ghpages.sh

##########################################################################

  tests:
    runs-on: ubuntu-latest
    if: ${{ !contains(github.event.head_commit.message, 'trigger dependency update') }}
    needs: [cache]
    continue-on-error: false
    strategy:
      fail-fast: false
      matrix:
        category:
          - simple
          - groovy
          - filesystem
          - webflow
          - webflow-config
          - webflow-actions
          - webflow-events
          - webflow-mfa-actions
          - attributes
          - services
          - expiration-policy
          - rest
          - password-ops
          - mfa
          - web
          - metrics
          - cas
          - logout
          - util
          - authentication
          - tickets
          - cas-config
          - actuator
          - webapp
          - ldap
          - x509
          - oauth
          - wsfed
          - uma
          - oidc
          - audit
          - saml
          - infinispan
          - spnego
          - hazelcast
          - jmx
          - shell
          - mongo
          - memcached
          - sms
          - jdbc
          - mariadb
          - postgres
          - mssql
          - oracle
          - mysql
          - aws
          - ehcache
          - redis
          - dynamodb
          - radius
          - couchdb
          - couchbase
          - mail
          - kafka
          - ignite
          - cassandra
          - influxdb
          - zookeeper
          - jms
          - cosmosdb
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
#      - uses: actions/download-artifact@v2
#        with:
#          name: binary-artifacts
#      - name: Setup tmate session
#        uses: mxschmitt/action-tmate@v2
      - name: Run Tests
        run: ./testcas.sh --with-coverage --category ${{ matrix.category }}
      - name: "Upload to Codecov"
        uses: "codecov/codecov-action@v1"
        with:
          file: ./build/reports/jacoco/jacocoRootReport/jacocoRootReport.xml
          flags: ${{ matrix.category }}
          name: ${{ matrix.category }}
      - name: "Upload coverage file"
        uses: "actions/upload-artifact@v2"
        with:
          name: "cas-tests-${{ matrix.category }}.coverage"
          path: "./build/reports/jacoco/jacocoRootReport/jacocoRootReport.xml"
##########################################################################
  upload_coverage:
    runs-on: ubuntu-latest
    needs: [tests]
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: "Download coverage files"
        uses: "actions/download-artifact@v2"
        with:
          path: "reports"
      - name: "Collect Files for SonarCloud"
        run: |
          find $PWD -type f -name 'jacocoRootReport.xml'
          export files=''
          for file in $(find $PWD -type f -name 'jacocoRootReport.xml'); do export files="$file,${files}"; done
          export files="${files%?}"
          echo $files
          echo "SONAR_COVERAGE_REPORTS=${files}" >> $GITHUB_ENV
      - name: Upload Coverage to SonarCloud
        if: ${{ !contains(github.head_ref, 'renovate') && github.event_name == 'push' && env.SONARCLOUD_TOKEN != null }}
        run: ./gradlew --build-cache --configure-on-demand --no-daemon --parallel sonarqube -x javadoc -Dsonar.login="${SONARCLOUD_TOKEN}" -DskipNestedConfigMetadataGen=true -DshowStandardStreams=true -Dsonar.coverage.jacoco.xmlReportPaths="${SONAR_COVERAGE_REPORTS}"
      - name: "Collect Files for Codacy"
        run: |
          find $PWD -type f -name 'jacocoRootReport.xml'
          export files=''
          for file in $(find . -type f -name 'jacocoRootReport.xml'); do export files="$file,${files}"; done
          export files="${files%?}"
          echo $files
          echo "CODACY_COVERAGE_REPORTS=${files}" >> $GITHUB_ENV
      - name: Upload Coverage to Codacy
        if: ${{ !contains(github.head_ref, 'renovate') && github.event_name == 'push' && env.CODACY_PROJECT_TOKEN != null }}
        uses: codacy/codacy-coverage-reporter-action@master
        with:
          project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
          coverage-reports: ${{ env.CODACY_COVERAGE_REPORTS }}
  ##########################################################################
  
  tests-performance-locust:
    runs-on: ubuntu-latest
    needs: [build]
    continue-on-error: true
    strategy:
      fail-fast: false
      matrix:
        category:
          - tomcat
          - jetty
          - undertow
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - uses: actions/setup-python@v2
        with:
          python-version: ${{ env.PYTHON_VERSION }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
      - uses: actions/download-artifact@v2
        with:
          name: binary-artifacts
      - name: Locust Performance Tests
        run: ./ci/tests/perf/perftests-locust.sh ${{ matrix.category }}

##########################################################################

  tests-performance-jmeter:
    runs-on: ubuntu-latest
    needs: [build]
    continue-on-error: true
    strategy:
      fail-fast: false
      matrix:
        category:
          - tomcat
          - jetty
          - undertow
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
      - uses: actions/download-artifact@v2
        with:
          name: binary-artifacts
      - name: JMeter Performance Tests
        run: ./ci/tests/perf/perftests-jmeter.sh ${{ matrix.category }}

##########################################################################

  report-dependency-updates:
    runs-on: ubuntu-latest
    needs: [cache]
    if: ${{ !contains(github.head_ref, 'renovate') && github.event_name == 'push' && contains(github.event.head_commit.message, 'dependency') }}
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
      - name: Report Dependency Updates
        run: |
          ./gradlew --build-cache --configure-on-demand --no-daemon --parallel -x test -x javadoc dependencyUpdates -Drevision=release -DskipNestedConfigMetadataGen=true -DgradleReleaseChannel=current

##########################################################################

#  renovate-dependency-updates:
#    runs-on: ubuntu-latest
#    needs: [cache]
#    if: ${{ !contains(github.head_ref, 'renovate') && github.event_name == 'push' && env.RENOVATE_TOKEN != null }}
#    steps:
#      - uses: actions/checkout@v2
#      - name: Set up JDK
#        uses: actions/setup-java@v1.4.3
#        with:
#          java-version: ${{ env.JDK_CURRENT }}
#      - name: Initialize
#        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
#      - uses: actions/cache@v2
#        with:
#          path: ~/.gradle/caches
#          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
#          restore-keys: |
#            ${{ runner.os }}-gradle-
#      - uses: renovatebot/github-action@v23.79.0
#        with:
#          configurationFile: .github/renovate.js
#          token: ${{ secrets.RENOVATE_TOKEN }}

##########################################################################

  puppeteer-tests:
    runs-on: ubuntu-latest
    needs: [cache]
    if: ${{ !contains(github.event.head_commit.message, 'trigger dependency update') }}
    strategy:
      fail-fast: false
      matrix:
        scenario:
          - login-success
          - block-missing-service
          - default-service
          - invalid-pswd-reset
          - locale-param
          - generate-service-ticket
          - webauthn-primary-authn
          - authn-throttle
          - qrauthn-login
          - gauth-register
          - duo-websdk-login
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh
      - name: Run Tests
        run: ./ci/tests/puppeteer/run.sh $PWD/ci/tests/puppeteer/scenarios/${{matrix.scenario}}
##########################################################################

<commit_msg>clean up tests<commit_after>name: CAS

env:
  JAVA_OPTS: "-Xms512m -Xmx6048m -Xss128m -XX:ReservedCodeCacheSize=512m -server -XX:+UseG1GC"
  GRADLE_OPTS: "-Xms512m -Xmx6048m -Xss128m -XX:ReservedCodeCacheSize=512m -server -XX:+UseG1GC"
  TERM: xterm-256color
  SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
  SONATYPE_PWD: ${{ secrets.SONATYPE_PWD }}
  DOCKER_USER: ${{ secrets.DOCKER_USER }}
  DOCKER_PWD: ${{ secrets.DOCKER_PWD }}
  GH_PAGES_TOKEN: ${{ secrets.GH_PAGES_TOKEN }}
  RENOVATE_TOKEN: ${{ secrets.RENOVATE_TOKEN }}
  GRADLE_BUILDCACHE_USER: ${{ secrets.GRADLE_BUILDCACHE_USER }}
  GRADLE_BUILDCACHE_PSW: ${{ secrets.GRADLE_BUILDCACHE_PSW }}
  CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
  SONARCLOUD_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  PYTHON_VERSION: 3.8.2
  JDK_CURRENT: 11.0.9
  JDK_LATEST: 15
  
##########################################################################

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

##########################################################################

jobs:
  cancel-previous-runs:
    runs-on: ubuntu-latest
    timeout-minutes: 1
    steps:
      - uses: styfle/cancel-workflow-action@0.3.1
        with:
          workflow_id: 1291155,1328268
          access_token: ${{ github.token }}
          
  initialize:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: Initialize
        run: ls ./ci && chmod -R 777 ./ci/*.sh && ./ci/init-build.sh

##########################################################################
  cache:
    runs-on: ubuntu-latest
    needs: [initialize]
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/checkout@v2
      - name: Download Dependencies
        run: ./gradlew --build-cache --configure-on-demand --no-daemon downloadDependencies --parallel --refresh-dependencies
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-

##########################################################################

  build:
    needs: [cache]
    if: ${{ !contains(github.event.head_commit.message, 'trigger dependency update') }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, windows-latest, macos-latest]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v2
#      - name: Setup tmate session
#        uses: mxschmitt/action-tmate@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
      - name: Build with Gradle
        run: ./gradlew --build-cache --configure-on-demand --no-daemon build -x test -x javadoc -x check --parallel
      - uses: actions/upload-artifact@v2
        if: ${{ matrix.os == 'ubuntu-latest' }}
        with:
          name: binary-artifacts
          path: ./**/build/libs/*.*

##########################################################################

  build-latest-jdk:
    runs-on: ubuntu-latest
    if: ${{ !contains(github.event.head_commit.message, 'trigger dependency update') }}
    needs: [cache]
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_LATEST }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
      - name: Build with Gradle
        run: ./gradlew --build-cache --configure-on-demand --no-daemon build -x test -x javadoc -x check --parallel
        
##########################################################################

  validate-docs:
    runs-on: ubuntu-latest
    if: ${{ !contains(github.head_ref, 'renovate') && github.event_name == 'push' && !contains(github.event.head_commit.message, 'trigger dependency update') }}
    needs: [cache]
    steps:
      - uses: actions/checkout@v2
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
      - name: Validate Documentation
        run: ./ci/validate-documentation.sh

##########################################################################
  
  static-analysis:
    runs-on: ubuntu-latest
    needs: [build]
    continue-on-error: true
    if: ${{ !contains(github.head_ref, 'renovate') }}
    strategy:
      matrix:
        category:
          - spotbugsMain
          - spotbugsTest
          - checkstyleMain
          - checkstyleTest
          - checkLicense
    steps:
      - uses: actions/checkout@v2
#      - name: Setup tmate session
#        uses: mxschmitt/action-tmate@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
      - uses: actions/download-artifact@v2
        with:
          name: binary-artifacts
      - name: Run Analysis
        run: ./gradlew --build-cache --configure-on-demand --parallel --no-daemon ${{ matrix.category }} -x test -x javadoc -DskipNestedConfigMetadataGen=true -DshowStandardStreams=true
        
##########################################################################

  validate-codebase:
    runs-on: ubuntu-latest
    if: ${{ !contains(github.head_ref, 'renovate') && !contains(github.event.head_commit.message, 'trigger dependency update') }}
    needs: [cache]
    strategy:
      fail-fast: false
      matrix:
        check:
          - CheckDuplicateGradleConfiguration
          - CheckDuplicateTestConfiguration
          - CheckMissingClassInTestsSuite
          - CheckMissingTestsSuiteClassAnnotation
          - CheckMissingUtilityClassAnnotation
          - CheckRedundantTestConfigurationInheritance
          - CheckSpringConfigurationBeanProxying
          - CheckSpringConfigurationFactories
          - CheckMissingTestTagAnnotation
          - CheckEnforceLombokAnnotations
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
      - name: Validate Codebase
        run: java ./ci/checks/${{ matrix.check }}.java .
        
##########################################################################

  validate-javadocs:
    runs-on: ubuntu-latest
    needs: [build]
    if: ${{ !contains(github.head_ref, 'renovate') }}
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
      - uses: actions/download-artifact@v2
        with:
          name: binary-artifacts
      - name: Validate Javadocs
        run: ./gradlew --build-cache --configure-on-demand --no-daemon --parallel javadoc -x test -x check -DskipNestedConfigMetadataGen=true --parallel

##########################################################################

  validate-commandline-shell:
    runs-on: ubuntu-latest
    needs: [build]
    if: ${{ !contains(github.head_ref, 'renovate') }}
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
      - uses: actions/download-artifact@v2
        with:
          name: binary-artifacts
      - name: Validate CAS Command-line Shell
        run: |
          casVersion=$(./gradlew casVersion --no-daemon -q)
          java -jar support/cas-server-support-shell/build/libs/cas-server-support-shell-${casVersion}.jar @ci/tests/shell/cas-shell-script.sh

##########################################################################

  validate-webapp-embedded:
    runs-on: ubuntu-latest
    needs: [build]
    if: ${{ !contains(github.head_ref, 'renovate') }}
    strategy:
      fail-fast: false
      matrix:
        category:
          - tomcat
          - jetty
          - undertow
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
      - uses: actions/download-artifact@v2
        with:
          name: binary-artifacts
      - name: Validate Web Application Server
        run: ./ci/tests/webapp/validate-embedded-webapp.sh ${{ matrix.category }}

##########################################################################

  validate-webapp-external-tomcat:
    runs-on: ubuntu-latest
    needs: [build]
    if: ${{ !contains(github.head_ref, 'renovate') }}
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
      - uses: actions/download-artifact@v2
        with:
          name: binary-artifacts
      - name: Validate Web Application Server via External Apache Tomcat
        run: ./ci/tests/webapp/validate-external-webapp.sh tomcat

##########################################################################

  validate-spring-cloud-config-server:
    runs-on: ubuntu-latest
    needs: [build]
    if: ${{ !contains(github.head_ref, 'renovate') }}
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
      - uses: actions/download-artifact@v2
        with:
          name: binary-artifacts
      - name: Validate Spring Cloud Configuration Server
        run: ./ci/tests/webapp/validate-configserver-webapp.sh

##########################################################################

  validate-eureka-discovery-server:
    runs-on: ubuntu-latest
    needs: [build]
    if: ${{ !contains(github.head_ref, 'renovate') }}
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
      - uses: actions/download-artifact@v2
        with:
          name: binary-artifacts
      - name: Validate Eureka Discovery Server
        run: ./ci/tests/webapp/validate-eurekaserver-webapp.sh

##########################################################################

  validate-spring-boot-admin-server:
    runs-on: ubuntu-latest
    needs: [build]
    if: ${{ !contains(github.head_ref, 'renovate') }}
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
      - uses: actions/download-artifact@v2
        with:
          name: binary-artifacts
      - name: Validate Spring Boot Admin Server
        run: ./ci/tests/webapp/validate-bootadmin-webapp.sh


##########################################################################

  publish-snapshots:
    runs-on: ubuntu-latest
    needs: [build]
    if: ${{ github.event_name == 'push' }}
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
      - uses: actions/download-artifact@v2
        with:
          name: binary-artifacts
      - name: Publish SNAPSHOTs
        if: ${{ env.SONATYPE_USER != null && env.SONATYPE_PWD != null }}
        run: ./gradlew -DpublishSnapshots=true --build-cache --configure-on-demand --no-daemon --parallel -Dorg.gradle.internal.http.socketTimeout=180000 -Dorg.gradle.internal.http.connectionTimeout=180000 build publish -x test -x javadoc -x check -DsonatypeUsername="${SONATYPE_USER}" -DsonatypePassword="${<PASSWORD>}"

  ##########################################################################

  publish-docker-image:
    runs-on: ubuntu-latest
    needs: [publish-snapshots]
    steps:
      - name: Prepare
        run: |
          mkdir work
          cd work
          curl https://casinit.herokuapp.com/starter.tgz | tar -xzvf -
          chmod -R 777 ./*.sh
          ls
      - name: Build Docker Image
        run: |
          cd work
          ./docker-build.sh latest
      - name: Publish Docker Image
        if: ${{ github.event_name == 'push' && env.DOCKER_USER != null && env.DOCKER_PWD != null }}
        run: |
          cd work
          ls
          ./docker-push.sh "${DOCKER_USER}" "${DOCKER_PWD}" latest

##########################################################################

  publish-docs:
    runs-on: ubuntu-latest
    needs: [validate-docs]
    if: ${{ github.event_name == 'push' }}
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
      - name: Publish Documentation
        if: ${{ env.GH_PAGES_TOKEN != null  }}
        run: ./ci/push-docs-ghpages.sh

##########################################################################

  tests:
    runs-on: ubuntu-latest
    if: ${{ !contains(github.event.head_commit.message, 'trigger dependency update') }}
    needs: [cache]
    continue-on-error: false
    strategy:
      fail-fast: false
      matrix:
        category:
          - simple
          - groovy
          - filesystem
          - webflow
          - webflow-config
          - webflow-actions
          - webflow-events
          - webflow-mfa-actions
          - attributes
          - services
          - expiration-policy
          - rest
          - password-ops
          - mfa
          - web
          - metrics
          - cas
          - logout
          - util
          - authentication
          - tickets
          - cas-config
          - actuator
          - webapp
          - ldap
          - x509
          - oauth
          - wsfed
          - uma
          - oidc
          - audit
          - saml
          - infinispan
          - spnego
          - hazelcast
          - jmx
          - shell
          - mongo
          - memcached
          - sms
          - jdbc
          - mariadb
          - postgres
          - mssql
          - oracle
          - mysql
          - aws
          - ehcache
          - redis
          - dynamodb
          - radius
          - couchdb
          - couchbase
          - mail
          - kafka
          - ignite
          - cassandra
          - influxdb
          - zookeeper
          - jms
          - cosmosdb
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
#      - uses: actions/download-artifact@v2
#        with:
#          name: binary-artifacts
#      - name: Setup tmate session
#        uses: mxschmitt/action-tmate@v2
      - name: Run Tests
        run: ./testcas.sh --with-coverage --category ${{ matrix.category }}
      - name: "Upload to Codecov"
        uses: "codecov/codecov-action@v1"
        with:
          file: ./build/reports/jacoco/jacocoRootReport/jacocoRootReport.xml
          flags: ${{ matrix.category }}
          name: ${{ matrix.category }}
      - name: "Upload coverage file"
        uses: "actions/upload-artifact@v2"
        with:
          name: "cas-tests-${{ matrix.category }}.coverage"
          path: "./build/reports/jacoco/jacocoRootReport/jacocoRootReport.xml"
##########################################################################
  upload_coverage:
    runs-on: ubuntu-latest
    needs: [tests]
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: "Download coverage files"
        uses: "actions/download-artifact@v2"
        with:
          path: "reports"
      - name: "Collect Files for SonarCloud"
        run: |
          find $PWD -type f -name 'jacocoRootReport.xml'
          export files=''
          for file in $(find $PWD -type f -name 'jacocoRootReport.xml'); do export files="$file,${files}"; done
          export files="${files%?}"
          echo $files
          echo "SONAR_COVERAGE_REPORTS=${files}" >> $GITHUB_ENV
      - name: Upload Coverage to SonarCloud
        if: ${{ !contains(github.head_ref, 'renovate') && github.event_name == 'push' && env.SONARCLOUD_TOKEN != null }}
        run: ./gradlew --build-cache --configure-on-demand --no-daemon --parallel sonarqube -x javadoc -Dsonar.login="${SONARCLOUD_TOKEN}" -DskipNestedConfigMetadataGen=true -DshowStandardStreams=true -Dsonar.coverage.jacoco.xmlReportPaths="${SONAR_COVERAGE_REPORTS}"
      - name: "Collect Files for Codacy"
        run: |
          find $PWD -type f -name 'jacocoRootReport.xml'
          export files=''
          for file in $(find . -type f -name 'jacocoRootReport.xml'); do export files="$file,${files}"; done
          export files="${files%?}"
          echo $files
          echo "CODACY_COVERAGE_REPORTS=${files}" >> $GITHUB_ENV
      - name: Upload Coverage to Codacy
        if: ${{ !contains(github.head_ref, 'renovate') && github.event_name == 'push' && env.CODACY_PROJECT_TOKEN != null }}
        uses: codacy/codacy-coverage-reporter-action@master
        with:
          project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
          coverage-reports: ${{ env.CODACY_COVERAGE_REPORTS }}
  ##########################################################################
  
  tests-performance-locust:
    runs-on: ubuntu-latest
    needs: [build]
    continue-on-error: true
    strategy:
      fail-fast: false
      matrix:
        category:
          - tomcat
          - jetty
          - undertow
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - uses: actions/setup-python@v2
        with:
          python-version: ${{ env.PYTHON_VERSION }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
      - uses: actions/download-artifact@v2
        with:
          name: binary-artifacts
      - name: Locust Performance Tests
        run: ./ci/tests/perf/perftests-locust.sh ${{ matrix.category }}

##########################################################################

  tests-performance-jmeter:
    runs-on: ubuntu-latest
    needs: [build]
    continue-on-error: true
    strategy:
      fail-fast: false
      matrix:
        category:
          - tomcat
          - jetty
          - undertow
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
      - uses: actions/download-artifact@v2
        with:
          name: binary-artifacts
      - name: JMeter Performance Tests
        run: ./ci/tests/perf/perftests-jmeter.sh ${{ matrix.category }}

##########################################################################

  report-dependency-updates:
    runs-on: ubuntu-latest
    needs: [cache]
    if: ${{ !contains(github.head_ref, 'renovate') && github.event_name == 'push' && contains(github.event.head_commit.message, 'dependency') }}
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
      - uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
          restore-keys: |
            ${{ runner.os }}-gradle-
      - name: Report Dependency Updates
        run: |
          ./gradlew --build-cache --configure-on-demand --no-daemon --parallel -x test -x javadoc dependencyUpdates -Drevision=release -DskipNestedConfigMetadataGen=true -DgradleReleaseChannel=current

##########################################################################

#  renovate-dependency-updates:
#    runs-on: ubuntu-latest
#    needs: [cache]
#    if: ${{ !contains(github.head_ref, 'renovate') && github.event_name == 'push' && env.RENOVATE_TOKEN != null }}
#    steps:
#      - uses: actions/checkout@v2
#      - name: Set up JDK
#        uses: actions/setup-java@v1.4.3
#        with:
#          java-version: ${{ env.JDK_CURRENT }}
#      - name: Initialize
#        run: chmod -R 777 ./ci/*.sh && ./ci/init-build.sh
#      - uses: actions/cache@v2
#        with:
#          path: ~/.gradle/caches
#          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
#          restore-keys: |
#            ${{ runner.os }}-gradle-
#      - uses: renovatebot/github-action@v23.79.0
#        with:
#          configurationFile: .github/renovate.js
#          token: ${{ secrets.RENOVATE_TOKEN }}

##########################################################################

  puppeteer-tests:
    runs-on: ubuntu-latest
    needs: [cache]
    if: ${{ !contains(github.event.head_commit.message, 'trigger dependency update') }}
    strategy:
      fail-fast: false
      matrix:
        scenario:
          - login-success
          - block-missing-service
          - default-service
          - invalid-pswd-reset
          - locale-param
          - generate-service-ticket
          - webauthn-primary-authn
          - authn-throttle
          - qrauthn-login
          - gauth-register
          - duo-websdk-login
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1.4.3
        with:
          java-version: ${{ env.JDK_CURRENT }}
      - name: Initialize
        run: chmod -R 777 ./ci/*.sh
      - name: Run Tests
        run: ./ci/tests/puppeteer/run.sh $PWD/ci/tests/puppeteer/scenarios/${{matrix.scenario}}
##########################################################################


{'fraction_non_alphanumeric': 0.204531057867869, 'fraction_numerical': 0.010340201959980623, 'mean_word_length': 1.9987708810548075, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 14}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 32, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5977849', 'n_tokens_mistral': 17292, 'n_tokens_neox': 16225, 'n_words': 3234}