Skip to content

Initializr Build

Initializr Build #1525

name: Initializr Build
env:
TERM: xterm-256color
JDK_CURRENT: 17
JDK_DISTRO: 'corretto'
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PWD: ${{ secrets.DOCKER_PWD }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
CAS_PROJECT_DB_URL_ENDPOINT: ${{ secrets.CAS_PROJECT_DB_URL_ENDPOINT }}
CAS_PROJECT_DB_API_KEY: ${{ secrets.CAS_PROJECT_DB_API_KEY }}
##########################################################################
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
schedule:
- cron: '0 0 * * *'
##########################################################################
jobs:
cancel-previous-runs:
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/[email protected]
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@v3
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/[email protected]
with:
java-version: ${{ env.JDK_CURRENT }}
distribution: ${{ env.JDK_DISTRO }}
- uses: actions/download-artifact@v3
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/[email protected]
with:
java-version: ${{ env.JDK_CURRENT }}
distribution: ${{ env.JDK_DISTRO }}
- uses: actions/download-artifact@v3
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
##########################################################################
supported-versions-cas-mgmt:
needs: [ build ]
# if: ${{ false }}
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/[email protected]
with:
java-version: ${{ env.JDK_CURRENT }}
distribution: ${{ env.JDK_DISTRO }}
- uses: actions/download-artifact@v3
with:
name: binary-artifacts
- id: print-supported-versions
name: Print supported versions
run: ./gradlew --no-daemon -q versions-cas-mgmt
- id: get-supported-versions
name: Get supported versions for matrix
run: echo "supported-versions=$(./gradlew --no-daemon -q versions-cas-mgmt)" >> $GITHUB_OUTPUT
##########################################################################
sync-cas-mgmt-overlay:
needs: [ supported-versions-cas-mgmt,validate-cas-mgmt-overlay ]
runs-on: ubuntu-latest
# if: ${{ false }}
strategy:
matrix:
versions: ${{fromJSON(needs.supported-versions-cas-mgmt.outputs.supported-versions)}}
name: Sync CAS Mgmt 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/[email protected]
if: ${{ matrix.versions.validate == true }}
with:
java-version: ${{ env.JDK_CURRENT }}
distribution: ${{ env.JDK_DISTRO }}
- uses: actions/download-artifact@v3
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-mgmt-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/[email protected]
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-management-overlay
##########################################################################
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/[email protected]
if: ${{ matrix.versions.validate == true }}
with:
java-version: ${{ env.JDK_CURRENT }}
distribution: ${{ env.JDK_DISTRO }}
- uses: actions/download-artifact@v3
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 }} \
--spring-boot ${{ matrix.versions.boot-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/[email protected]
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
##########################################################################
validate-cas-overlay:
needs: [ supported-versions-cas ]
timeout-minutes: 25
runs-on: ubuntu-latest
strategy:
matrix:
versions: ${{fromJSON(needs.supported-versions-cas.outputs.supported-versions)}}
name: Validate CAS 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/[email protected]
if: ${{ matrix.versions.validate == true }}
with:
java-version: ${{ env.JDK_CURRENT }}
distribution: ${{ env.JDK_DISTRO }}
- uses: actions/download-artifact@v3
if: ${{ matrix.versions.validate == true }}
with:
name: binary-artifacts
- name: Fetch CAS Overlay
if: ${{ matrix.versions.validate == true }}
run: |
./ci/validate-cas-overlay.sh --fetch-only --cas ${{ matrix.versions.version }} \
--spring-boot ${{ matrix.versions.boot-version }} \
--apache-tomcat ${{ matrix.versions.tomcat-version }}
- name: Set up JDK
uses: actions/[email protected]
if: ${{ matrix.versions.validate == true }}
with:
java-version: ${{ matrix.versions.java-version }}
distribution: ${{ env.JDK_DISTRO }}
- name: Validate Overlay w/ CAS & SpringBoot
if: ${{ matrix.versions.validate == true }}
run: |
./ci/validate-cas-overlay.sh --cas ${{ matrix.versions.version }} \
--spring-boot ${{ matrix.versions.boot-version }} \
--apache-tomcat ${{ matrix.versions.tomcat-version }}
- name: Validate Overlay w/ CAS Only
if: ${{ matrix.versions.validate == true }}
# if: ${{ false }}
run: |
./ci/validate-cas-overlay.sh --cas ${{ matrix.versions.version }} \
--apache-tomcat ${{ matrix.versions.tomcat-version }}
##########################################################################
validate-cas-mgmt-overlay:
needs: [ supported-versions-cas-mgmt ]
runs-on: ubuntu-latest
# if: ${{ false }}
strategy:
matrix:
versions: ${{fromJSON(needs.supported-versions-cas-mgmt.outputs.supported-versions)}}
name: Validate CAS Mgmt ${{ 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/[email protected]
if: ${{ matrix.versions.validate == true }}
with:
java-version: ${{ env.JDK_CURRENT }}
distribution: ${{ env.JDK_DISTRO }}
- uses: actions/download-artifact@v3
if: ${{ matrix.versions.validate == true }}
with:
name: binary-artifacts
- name: Fetch Overlay
if: ${{ matrix.versions.validate == true }}
run: |
./ci/validate-cas-mgmt-overlay.sh --fetch-only --cas ${{ matrix.versions.version }} \
--apache-tomcat ${{ matrix.versions.tomcat-version }}
- name: Set up JDK
uses: actions/[email protected]
if: ${{ matrix.versions.validate == true }}
with:
java-version: ${{ env.JDK_CURRENT }}
distribution: ${{ env.JDK_DISTRO }}
- name: Validate Overlay
if: ${{ matrix.versions.validate == true }}
run: |
./ci/validate-cas-mgmt-overlay.sh --cas ${{ matrix.versions.version }} \
--apache-tomcat ${{ matrix.versions.tomcat-version }}
##########################################################################
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/[email protected]
if: ${{ matrix.versions.validate == true }}
with:
java-version: ${{ env.JDK_CURRENT }}
distribution: ${{ env.JDK_DISTRO }}
- uses: actions/download-artifact@v3
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/[email protected]
if: ${{ matrix.versions.validate == true }}
with:
java-version: ${{ matrix.versions.java-version }}
distribution: ${{ env.JDK_DISTRO }}
- name: Validate Overlay
if: ${{ matrix.versions.validate == true }}
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/[email protected]
if: ${{ matrix.versions.validate == true }}
with:
java-version: ${{ env.JDK_CURRENT }}
distribution: ${{ env.JDK_DISTRO }}
- uses: actions/download-artifact@v3
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/[email protected]
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/[email protected]
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@v3
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-mgmt-overlay,validate-cas-configserver-overlay ]
runs-on: ubuntu-latest
steps:
- name: Successful Build
run: echo "Build is a complete success"