Merge branch '7.2' into 7.5 #58
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: Full CI Build (and Release) | |
on: | |
push: | |
pull_request: | |
jobs: | |
build-project: | |
runs-on: ubuntu-20.04 | |
env: | |
# Static env vars | |
# Fixed ssh-agent socket so multiple steps can use the same agent | |
# if needs be | |
SSH_AUTH_SOCK: "/tmp/ssh-agent-release-it.sock" | |
steps: | |
- name: Install xmllint | |
run: | | |
sudo apt-get -qq update | |
sudo apt-get install -y libxml2-utils | |
- name: Checkout code | |
id: checkout_code | |
uses: actions/checkout@v2 | |
with: | |
# Set this so it gets the annotated commit, not the commit being tagged. | |
# Which means we can get the release msg | |
# See https://github.com/actions/runner/issues/712 | |
ref: ${{ github.ref }} | |
- name: Setup Java | |
id: setup_java | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'zulu' | |
java-version: '8.0.312+7' | |
cache: 'gradle' | |
# Make sure the wrapper jar has not been tampered with | |
- name: Validate gradle wrapper jar | |
id: validate_gradle_wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
# Set variables in github's special env file which are then automatically | |
# read into env vars in each subsequent step | |
- name: Set Environment Variables | |
id: set_env_var | |
run: | | |
{ | |
# Map the GITHUB env vars to our own | |
echo "BUILD_DIR=${GITHUB_WORKSPACE}" | |
echo "BUILD_COMMIT=${GITHUB_SHA}" | |
echo "ACTIONS_SCRIPTS_DIR=${GITHUB_WORKSPACE}/.github/workflows/scripts" | |
if [[ ${GITHUB_REF} =~ ^refs/tags/ ]]; then | |
# strip off the 'refs/tags/' bit | |
tag="${GITHUB_REF#refs/tags/}" | |
echo "BUILD_TAG=${tag}" | |
fi | |
if [[ ${GITHUB_REF} =~ ^refs/heads/ ]]; then | |
# strip off the 'ref/heads/' bit | |
echo "BUILD_BRANCH=${GITHUB_REF#refs/heads/}" | |
fi | |
if [[ ${GITHUB_REF} =~ ^refs/pulls/ ]]; then | |
echo "BUILD_IS_PULL_REQUEST=true" | |
else | |
echo "BUILD_IS_PULL_REQUEST=false" | |
fi | |
if [[ ${GITHUB_REF} =~ ^refs/tags/v ]]; then | |
echo "BUILD_IS_RELEASE=true" | |
else | |
echo "BUILD_IS_RELEASE=false" | |
fi | |
} >> $GITHUB_ENV | |
# Separate step to show what is visible across steps | |
- name: Build Environment Info | |
id: build_info | |
run: | | |
"${ACTIONS_SCRIPTS_DIR}/echo_variables.sh" \ | |
"docker version" "$(docker --version)" \ | |
"docker-compose version" "$(docker-compose --version)" \ | |
"git version" "$(git --version)" \ | |
"GITHUB_WORKSPACE" "$GITHUB_WORKSPACE" \ | |
"GITHUB_REF" "$GITHUB_REF" \ | |
"GITHUB_SHA" "$GITHUB_SHA" \ | |
"BUILD_DIR" "$BUILD_DIR" \ | |
"BUILD_TAG" "$BUILD_TAG" \ | |
"BUILD_BRANCH" "$BUILD_BRANCH" \ | |
"BUILD_COMMIT" "$BUILD_COMMIT" \ | |
"BUILD_IS_PULL_REQUEST" "$BUILD_IS_PULL_REQUEST" \ | |
"BUILD_IS_RELEASE" "$BUILD_IS_RELEASE" \ | |
"ACTIONS_SCRIPTS_DIR" "$ACTIONS_SCRIPTS_DIR" \ | |
"PWD" "$PWD" \ | |
"HOME" "$HOME" | |
- name: Run full build | |
id: run_build | |
run: | | |
pushd "${BUILD_DIR}" > /dev/null | |
echo -e "${GREEN}Running gradle build${NC}" | |
./gradlew clean build | |
echo -e "${GREEN}Finished running gradle build${NC}" | |
- name: Cleanup Gradle Cache | |
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions. | |
# Restoring these files from a GitHub Actions cache might cause problems for future builds. | |
# See https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle | |
run: | | |
rm -f ~/.gradle/caches/modules-2/modules-2.lock | |
rm -f ~/.gradle/caches/modules-2/gc.properties |