Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STARCH-610 Adopt ESS Build #13

Merged
merged 9 commits into from
Nov 30, 2023
36 changes: 36 additions & 0 deletions .github/workflows/clean-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Clean Pages

on: delete
env:
TZ: America/Indianapolis

jobs:
clean-site:
runs-on: [ Linux ]
container:
image: registry.docker.iu.edu/eshr-architecture/ess-build:latest
credentials:
username: ${{ secrets.ESHR_REGISTRY_USERNAME }}
password: ${{ secrets.ESHR_REGISTRY_PASSWORD }}

steps:
- uses: actions/checkout@v3
with:
ref: github_pages

- name: Unpublish Docs
run: |
ref=${{ github.event.ref }}
pwd
ls -ld . docs docs/$ref
git config --global --add safe.directory $PWD
if [ -d docs/$ref ]
then
git config user.name eshrastg
git config user.email [email protected]
git rm -r docs/$ref
git commit -m "clean $ref"
git push
else
echo "Nothing to do for $ref"
fi
81 changes: 81 additions & 0 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Description
# -----------
# This workflow is intended to run anytime there is a push on a `develop` branch.

name: Develop Branch

on:
push:
branches:
- develop*
workflow_dispatch:

env:
TZ: America/Indianapolis

jobs:
deploy:
if: ( github.event_name == 'workflow_dispatch' || github.event_name == 'push' ) && startsWith(github.ref, 'refs/heads/develop')
name: Verify and Deploy Maven Project
runs-on: [ Linux ]
container:
image: registry.docker.iu.edu/eshr-architecture/ess-build:latest
credentials:
username: ${{ secrets.ESHR_REGISTRY_USERNAME }}
password: ${{ secrets.ESHR_REGISTRY_PASSWORD }}
volumes:
- /opt/actions/cache/m2/repository:/root/.m2/repository

steps:
- name: Clone GitHub repository
uses: actions/checkout@v3

- name: Generate build time configuration
env:
ESSBUILD_VAULT_APPROLE_ROLE_ID_UNT: ${{ secrets.ESSBUILD_VAULT_APPROLE_ROLE_ID_UNT }}
ESSBUILD_VAULT_APPROLE_SECRET_ID_UNT: ${{ secrets.ESSBUILD_VAULT_APPROLE_SECRET_ID_UNT }}
ESSBUILD_VAULT_APPROLE_ROLE_ID_STG: ${{ secrets.ESSBUILD_VAULT_APPROLE_ROLE_ID_STG }}
ESSBUILD_VAULT_APPROLE_SECRET_ID_STG: ${{ secrets.ESSBUILD_VAULT_APPROLE_SECRET_ID_STG }}
ESSBUILD_VAULT_APPROLE_ROLE_ID_REG: ${{ secrets.ESSBUILD_VAULT_APPROLE_ROLE_ID_REG }}
ESSBUILD_VAULT_APPROLE_SECRET_ID_REG: ${{ secrets.ESSBUILD_VAULT_APPROLE_SECRET_ID_REG }}
run: |
generate_build_properties
generate_deploy_properties

- name: Compile, Verify, and Build Javadoc
id: verify
run: |
mvn clean verify -U --batch-mode

- name: Deploy Artifacts
run: |
mvn deploy -DskipTests --batch-mode

- name: Publish Documentation
if: steps.verify.outcome == 'success'
run: |
git config --global --add safe.directory $PWD
if (git fetch origin github_pages)
then
git checkout github_pages
else
git checkout -b github_pages
git push --set-upstream origin github_pages
fi
git pull
rm -rf docs/$GITHUB_REF_NAME
mkdir -p docs/$GITHUB_REF_NAME
for a in $(find -type d -regex '.*/\(apidocs\|jacoco\(-aggregate\)?\)' | cut -b3- | egrep -v '^docs/')
do
t=docs/$GITHUB_REF_NAME/${a%%target*}
mkdir -p $t
mv $a $t
done
if (git add docs && git commit --dry-run)
then
git config user.name eshrastg
git config user.email [email protected]
git commit -m "publish $GITHUB_ACTOR $GITHUB_REF_NAME"
git push
fi

84 changes: 84 additions & 0 deletions .github/workflows/ephemeral-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Description
# -----------
# This workflow is intended to run anytime there is a push on a `feature`
# branch, or when a pull request is opened on a `feature`. Ephemeral branches
# follow the format `feature/<some name>`. This workflow is intended to verify build and push API documentation. During workflow execution the branch will
# be marked pending to prevent it from being merged. It must also complete successfully for the
# job to be marked a success, therefore allowing the branch to be merged.

name: Ephemeral Branch

on:
push:
branches:
- feature/**
workflow_dispatch:

env:
TZ: America/Indianapolis

jobs:
verify:
if: ( github.event_name == 'workflow_dispatch' || github.event_name == 'push' ) && startsWith(github.ref, 'refs/heads/feature/')
name: Build and Verify Feature Branch
runs-on: [ Linux ]
container:
image: registry.docker.iu.edu/eshr-architecture/ess-build:latest
credentials:
username: ${{ secrets.ESHR_REGISTRY_USERNAME }}
password: ${{ secrets.ESHR_REGISTRY_PASSWORD }}
volumes:
- /opt/actions/cache/m2/repository:/root/.m2/repository

steps:
- name: Clone GitHub repository
uses: actions/checkout@v3

- name: Generate build time configuration
env:
ESSBUILD_VAULT_APPROLE_ROLE_ID_UNT: ${{ secrets.ESSBUILD_VAULT_APPROLE_ROLE_ID_UNT }}
ESSBUILD_VAULT_APPROLE_SECRET_ID_UNT: ${{ secrets.ESSBUILD_VAULT_APPROLE_SECRET_ID_UNT }}
ESSBUILD_VAULT_APPROLE_ROLE_ID_STG: ${{ secrets.ESSBUILD_VAULT_APPROLE_ROLE_ID_STG }}
ESSBUILD_VAULT_APPROLE_SECRET_ID_STG: ${{ secrets.ESSBUILD_VAULT_APPROLE_SECRET_ID_STG }}
ESSBUILD_VAULT_APPROLE_ROLE_ID_REG: ${{ secrets.ESSBUILD_VAULT_APPROLE_ROLE_ID_REG }}
ESSBUILD_VAULT_APPROLE_SECRET_ID_REG: ${{ secrets.ESSBUILD_VAULT_APPROLE_SECRET_ID_REG }}
run: |
generate_build_properties

- name: Compile and Build Javadoc
id: compile
run: |
mvn clean verify -DskipTests -U --batch-mode

- name: Verify Test Coverage
run: |
mvn verify -Dmaven.javadoc.skip --batch-mode

- name: Publish Documentation
if: steps.compile.outcome == 'success'
run: |
git config --global --add safe.directory $PWD
if (git fetch origin github_pages)
then
git checkout github_pages
else
git checkout -b github_pages
git push --set-upstream origin github_pages
fi
git pull
rm -rf docs/$GITHUB_REF_NAME
mkdir -p docs/$GITHUB_REF_NAME
for a in $(find -type d -regex '.*/\(apidocs\|jacoco\(-aggregate\)?\)' | cut -b3- | egrep -v '^docs/')
do
t=docs/$GITHUB_REF_NAME/${a%%target*}
mkdir -p $t
mv $a $t
done
if (git add docs && git commit --dry-run)
then
git config user.name eshrastg
git config user.email [email protected]
git commit -m "publish $GITHUB_ACTOR $GITHUB_REF_NAME"
git push
fi

79 changes: 79 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Description
# -----------
# This workflow is intended to run to deploy release from main branch.
# It must be executed manually.

name: Main Branch

on:
workflow_dispatch:

env:
TZ: America/Indianapolis

jobs:
deploy:
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main'
name: Verify and Deploy Maven Project
runs-on: [ Linux ]
container:
image: registry.docker.iu.edu/eshr-architecture/ess-build:latest
credentials:
username: ${{ secrets.ESHR_REGISTRY_USERNAME }}
password: ${{ secrets.ESHR_REGISTRY_PASSWORD }}
volumes:
- /opt/actions/cache/m2/repository:/root/.m2/repository

steps:
- name: Clone GitHub repository
uses: actions/checkout@v3

- name: Generate build time configuration
env:
ESSBUILD_VAULT_APPROLE_ROLE_ID_UNT: ${{ secrets.ESSBUILD_VAULT_APPROLE_ROLE_ID_UNT }}
ESSBUILD_VAULT_APPROLE_SECRET_ID_UNT: ${{ secrets.ESSBUILD_VAULT_APPROLE_SECRET_ID_UNT }}
ESSBUILD_VAULT_APPROLE_ROLE_ID_STG: ${{ secrets.ESSBUILD_VAULT_APPROLE_ROLE_ID_STG }}
ESSBUILD_VAULT_APPROLE_SECRET_ID_STG: ${{ secrets.ESSBUILD_VAULT_APPROLE_SECRET_ID_STG }}
ESSBUILD_VAULT_APPROLE_ROLE_ID_REG: ${{ secrets.ESSBUILD_VAULT_APPROLE_ROLE_ID_REG }}
ESSBUILD_VAULT_APPROLE_SECRET_ID_REG: ${{ secrets.ESSBUILD_VAULT_APPROLE_SECRET_ID_REG }}
run: |
generate_build_properties
generate_deploy_properties

- name: Compile, Verify, and Build Javadoc
id: verify
run: |
mvn clean verify -U --batch-mode

- name: Deploy Artifacts
run: |
mvn deploy -DskipTests --batch-mode

- name: Publish Documentation
if: steps.verify.outcome == 'success'
run: |
git config --global --add safe.directory $PWD
if (git fetch origin github_pages)
then
git checkout github_pages
else
git checkout -b github_pages
git push --set-upstream origin github_pages
fi
git pull
rm -rf docs/$GITHUB_REF_NAME
mkdir -p docs/$GITHUB_REF_NAME
for a in $(find -type d -regex '.*/\(apidocs\|jacoco\(-aggregate\)?\)' | cut -b3- | egrep -v '^docs/')
do
t=docs/$GITHUB_REF_NAME/${a%%target*}
mkdir -p $t
mv $a $t
done
if (git add docs && git commit --dry-run)
then
git config user.name eshrastg
git config user.email [email protected]
git commit -m "publish $GITHUB_ACTOR $GITHUB_REF_NAME"
git push
fi

4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

<parent>
<groupId>edu.iu.util</groupId>
<artifactId>iu-parent</artifactId>
<version>7.0.0</version>
<artifactId>iu-java-parent</artifactId>
<version>7.0.0-SNAPSHOT</version>
<relativePath />
</parent>

Expand Down