Initializr Build #2305
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Initializr Build | |
env: | |
TERM: xterm-256color | |
JDK_CURRENT: 21 | |
JDK_DISTRO: 'corretto' | |
DOCKER_USER: ${{ secrets.DOCKER_USER }} | |
DOCKER_PWD: ${{ secrets.DOCKER_PWD }} | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
CAS_MODULE_METADATA_MONGODB_URL: ${{ secrets.CAS_MODULE_METADATA_MONGODB_URL }} | |
########################################################################## | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
schedule: | |
- cron: '0 0 * * *' | |
concurrency: | |
group: "workflow = ${{ github.workflow }}, ref = ${{ github.event.ref }}, pr = ${{ github.event.pull_request.id }}" | |
cancel-in-progress: ${{ github.event_name == 'pull_request' || github.repository != 'apereo/cas-initializr' }} | |
########################################################################## | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ env.JDK_CURRENT }} | |
distribution: ${{ env.JDK_DISTRO }} | |
- name: Build Initializr | |
run: ./gradlew --build-cache --configure-on-demand --no-daemon clean build -x test -x javadoc -x check --parallel | |
- name: Validate Initializr | |
run: ./ci/validate-initializr.sh | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: binary-artifacts | |
path: ./**/build/libs/*.* | |
########################################################################## | |
latest-versions-cas: | |
needs: [ build ] | |
runs-on: ubuntu-latest | |
outputs: | |
supported-versions: ${{ steps.get-supported-versions.outputs.supported-versions }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ env.JDK_CURRENT }} | |
distribution: ${{ env.JDK_DISTRO }} | |
- uses: actions/download-artifact@v4 | |
with: | |
name: binary-artifacts | |
- id: print-supported-versions | |
name: Print supported versions | |
run: ./gradlew --no-daemon -q latestCasVersion | |
- id: get-supported-versions | |
name: Get supported versions for matrix | |
run: echo "supported-versions=$(./gradlew --no-daemon -q latestCasVersion)" >> $GITHUB_OUTPUT | |
########################################################################## | |
supported-versions-cas: | |
needs: [ build ] | |
runs-on: ubuntu-latest | |
outputs: | |
supported-versions: ${{ steps.get-supported-versions.outputs.supported-versions }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ env.JDK_CURRENT }} | |
distribution: ${{ env.JDK_DISTRO }} | |
- uses: actions/download-artifact@v4 | |
with: | |
name: binary-artifacts | |
- id: print-supported-versions | |
name: Print supported versions | |
run: ./gradlew --no-daemon -q versions-cas | |
- id: get-supported-versions | |
name: Get supported versions for matrix | |
run: echo "supported-versions=$(./gradlew --no-daemon -q versions-cas)" >> $GITHUB_OUTPUT | |
########################################################################## | |
sync-cas-overlay: | |
needs: [ supported-versions-cas,validate-cas-overlay ] | |
runs-on: ubuntu-latest | |
# if: ${{ false }} | |
strategy: | |
matrix: | |
versions: ${{fromJSON(needs.supported-versions-cas.outputs.supported-versions)}} | |
name: Sync CAS Server ${{ matrix.versions.version }} Branch ${{ matrix.versions.branch }} | |
steps: | |
- uses: actions/checkout@v4 | |
if: ${{ matrix.versions.sync == true && github.event_name == 'push' && env.GH_TOKEN != null }} | |
- name: Initialize | |
if: ${{ matrix.versions.sync == true && github.event_name == 'push' && env.GH_TOKEN != null }} | |
run: ls ./ci && find ./ci -type f -name "*.sh" -exec chmod +x "{}" \; | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
if: ${{ matrix.versions.sync == true && github.event_name == 'push' && env.GH_TOKEN != null }} | |
with: | |
java-version: ${{ env.JDK_CURRENT }} | |
distribution: ${{ env.JDK_DISTRO }} | |
- uses: actions/download-artifact@v4 | |
if: ${{ matrix.versions.sync == true && github.event_name == 'push' && env.GH_TOKEN != null }} | |
with: | |
name: binary-artifacts | |
- name: Fetch Overlay | |
if: ${{ matrix.versions.sync == true && github.event_name == 'push' && env.GH_TOKEN != null }} | |
run: | | |
./ci/validate-cas-overlay.sh --fetch-only --cas ${{ matrix.versions.version }} \ | |
--apache-tomcat ${{ matrix.versions.tomcat-version }} | |
- name: Set up JDK | |
if: ${{ matrix.versions.sync == true && github.event_name == 'push' && env.GH_TOKEN != null }} | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ matrix.versions.java-version }} | |
distribution: ${{ env.JDK_DISTRO }} | |
- name: Sync Overlay | |
if: ${{ matrix.versions.sync == true && github.event_name == 'push' && env.GH_TOKEN != null }} | |
run: ./ci/sync-overlay.sh ${{ matrix.versions.version }} ${{ matrix.versions.boot-version }} ${{ matrix.versions.branch }} cas-overlay | |
########################################################################## | |
build-cas-overlay: | |
needs: [ supported-versions-cas ] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
versions: ${{fromJSON(needs.supported-versions-cas.outputs.supported-versions)}} | |
jvmVendor: ["AMAZON", "AZUL", "ADOPTIUM", "MICROSOFT", "ORACLE", "BELLSOFT"] | |
name: Build CAS Server ${{ matrix.versions.version }} / ${{ matrix.jvmVendor }} | |
steps: | |
- uses: actions/checkout@v4 | |
if: ${{ matrix.versions.validate == true }} | |
- name: Initialize | |
if: ${{ matrix.versions.validate == true }} | |
run: ls ./ci && find ./ci -type f -name "*.sh" -exec chmod +x "{}" \; | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
if: ${{ matrix.versions.validate == true }} | |
with: | |
java-version: ${{ env.JDK_CURRENT }} | |
distribution: ${{ env.JDK_DISTRO }} | |
- uses: actions/download-artifact@v4 | |
if: ${{ matrix.versions.validate == true }} | |
with: | |
name: binary-artifacts | |
- name: Build CAS Overlay / ${{ matrix.jvmVendor }} | |
if: ${{ matrix.versions.validate == true }} | |
run: | | |
./ci/validate-cas-overlay.sh --fetch-only --cas ${{ matrix.versions.version }} \ | |
--apache-tomcat ${{ matrix.versions.tomcat-version }} \ | |
--jvm-vendor ${{ matrix.jvmVendor }} | |
########################################################################## | |
validate-cas-overlay: | |
needs: [ supported-versions-cas ] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
versions: ${{fromJSON(needs.supported-versions-cas.outputs.supported-versions)}} | |
appServer: ["tomcat", "jetty", "undertow"] | |
name: Validate CAS Server ${{ matrix.versions.version }} / ${{ matrix.appServer }} | |
steps: | |
- uses: actions/checkout@v4 | |
if: ${{ matrix.versions.validate == true }} | |
- name: Initialize | |
if: ${{ matrix.versions.validate == true }} | |
run: ls ./ci && find ./ci -type f -name "*.sh" -exec chmod +x "{}" \; | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
if: ${{ matrix.versions.validate == true }} | |
with: | |
java-version: ${{ env.JDK_CURRENT }} | |
distribution: ${{ env.JDK_DISTRO }} | |
- uses: actions/download-artifact@v4 | |
if: ${{ matrix.versions.validate == true }} | |
with: | |
name: binary-artifacts | |
- name: Fetch CAS Overlay / ${{ matrix.appServer }} | |
if: ${{ matrix.versions.validate == true }} | |
run: | | |
./ci/validate-cas-overlay.sh --fetch-only --cas ${{ matrix.versions.version }} \ | |
--apache-tomcat ${{ matrix.versions.tomcat-version }} \ | |
--app-server ${{ matrix.appServer }} | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
if: ${{ matrix.versions.validate == true }} | |
with: | |
java-version: ${{ matrix.versions.java-version }} | |
distribution: ${{ env.JDK_DISTRO }} | |
- name: Validate Overlay / ${{ matrix.appServer }} | |
if: ${{ matrix.versions.validate == true }} | |
timeout-minutes: 40 | |
run: | | |
./ci/validate-cas-overlay.sh --cas ${{ matrix.versions.version }} \ | |
--apache-tomcat ${{ matrix.versions.tomcat-version }} \ | |
--app-server ${{ matrix.appServer }} | |
########################################################################## | |
validate-cas-configserver-overlay: | |
needs: [ supported-versions-cas ] | |
runs-on: ubuntu-latest | |
# if: ${{ false }} | |
strategy: | |
matrix: | |
versions: ${{fromJSON(needs.supported-versions-cas.outputs.supported-versions)}} | |
name: Validate Config Server ${{ matrix.versions.version }} | |
steps: | |
- uses: actions/checkout@v4 | |
if: ${{ matrix.versions.validate == true }} | |
- name: Initialize | |
if: ${{ matrix.versions.validate == true }} | |
run: ls ./ci && find ./ci -type f -name "*.sh" -exec chmod +x "{}" \; | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
if: ${{ matrix.versions.validate == true }} | |
with: | |
java-version: ${{ env.JDK_CURRENT }} | |
distribution: ${{ env.JDK_DISTRO }} | |
- uses: actions/download-artifact@v4 | |
if: ${{ matrix.versions.validate == true }} | |
with: | |
name: binary-artifacts | |
- name: Fetch Overlay | |
if: ${{ matrix.versions.validate == true }} | |
run: | | |
./ci/validate-cas-configserver-overlay.sh --fetch-only --cas ${{ matrix.versions.version }} \ | |
--apache-tomcat ${{ matrix.versions.tomcat-version }} | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
if: ${{ matrix.versions.validate == true }} | |
with: | |
java-version: ${{ matrix.versions.java-version }} | |
distribution: ${{ env.JDK_DISTRO }} | |
- name: Validate Overlay | |
if: ${{ matrix.versions.validate == true }} | |
timeout-minutes: 20 | |
run: | | |
./ci/validate-cas-configserver-overlay.sh --cas ${{ matrix.versions.version }} \ | |
--apache-tomcat ${{ matrix.versions.tomcat-version }} | |
########################################################################## | |
sync-cas-configserver-overlay: | |
needs: [ supported-versions-cas,validate-cas-configserver-overlay ] | |
runs-on: ubuntu-latest | |
# if: ${{ false }} | |
strategy: | |
matrix: | |
versions: ${{fromJSON(needs.supported-versions-cas.outputs.supported-versions)}} | |
name: Sync Config Server ${{ matrix.versions.version }} Branch ${{ matrix.versions.branch }} | |
steps: | |
- uses: actions/checkout@v4 | |
if: ${{ matrix.versions.sync == true && github.event_name == 'push' && env.GH_TOKEN != null }} | |
- name: Initialize | |
if: ${{ matrix.versions.sync == true && github.event_name == 'push' && env.GH_TOKEN != null }} | |
run: ls ./ci && find ./ci -type f -name "*.sh" -exec chmod +x "{}" \; | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
if: ${{ matrix.versions.validate == true }} | |
with: | |
java-version: ${{ env.JDK_CURRENT }} | |
distribution: ${{ env.JDK_DISTRO }} | |
- uses: actions/download-artifact@v4 | |
if: ${{ matrix.versions.sync == true && github.event_name == 'push' && env.GH_TOKEN != null }} | |
with: | |
name: binary-artifacts | |
- name: Fetch Overlay | |
if: ${{ matrix.versions.sync == true && github.event_name == 'push' && env.GH_TOKEN != null }} | |
run: | | |
./ci/validate-cas-configserver-overlay.sh --fetch-only --cas ${{ matrix.versions.version }} \ | |
--apache-tomcat ${{ matrix.versions.tomcat-version }} | |
- name: Set up JDK | |
if: ${{ matrix.versions.sync == true && github.event_name == 'push' && env.GH_TOKEN != null }} | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ matrix.versions.java-version }} | |
distribution: ${{ env.JDK_DISTRO }} | |
- name: Sync Overlay | |
if: ${{ matrix.versions.sync == true && github.event_name == 'push' && env.GH_TOKEN != null }} | |
run: ./ci/sync-overlay.sh ${{ matrix.versions.version }} ${{ matrix.versions.boot-version }} ${{ matrix.versions.branch }} cas-config-server-overlay | |
########################################################################## | |
publish: | |
needs: [ build ] | |
runs-on: ubuntu-latest | |
# if: ${{ false }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ env.JDK_CURRENT }} | |
distribution: ${{ env.JDK_DISTRO }} | |
- name: Initialize | |
run: ls ./ci && find ./ci -type f -name "*.sh" -exec chmod +x "{}" \; | |
- uses: actions/download-artifact@v4 | |
with: | |
name: binary-artifacts | |
- name: Build Docker Image | |
run: ./gradlew bootBuildImage | |
- name: Publish Docker Image | |
if: ${{ github.event_name == 'push' && env.DOCKER_USER != null && env.DOCKER_PWD != null }} | |
run: | | |
echo "${DOCKER_PWD}" | docker login --username "$DOCKER_USER" --password-stdin | |
imageTag=(`./gradlew initializrVersion --q`) | |
echo "Pushing Docker image with tag $imageTag" | |
docker push apereo/cas-initializr:"$imageTag" | |
########################################################################## | |
complete: | |
needs: [ build,publish,validate-cas-overlay,validate-cas-configserver-overlay ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Successful Build | |
run: echo "Build is a complete success" |