-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
80704ff
commit 2373fe8
Showing
2 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle | ||
|
||
name: Test main branch | ||
|
||
on: | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
|
||
# set up java | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
|
||
# set up application file | ||
- name: Create application.yml | ||
run: | | ||
mkdir -p ./src/main/resources | ||
cd ./src/main/resources | ||
echo "${{ secrets.APPLICATION }}" > application.yml | ||
echo "${{ secrets.APPLICATION_MAIN }}" > application-main.yml | ||
# apply caching | ||
- name: Gradle Caching | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
# gradle grant execution permission and build project | ||
- name: Setup Gradle | ||
run: | | ||
chmod +x ./gradlew | ||
./gradlew clean build -Pprofile=main | ||
- name: Error Report | ||
if : ${{ failure() }} | ||
run: | | ||
echo "Error Report..." | ||
TIMESTAMP=$(date '+%Y%m%d%H%M%S') | ||
mkdir error-report | ||
REPORT_DIRS=$(find . -type d -path '*/build/reports/tests/test') | ||
for dir in $REPORT_DIRS; do | ||
module_path=$(echo $dir | awk -F'/build/' '{print $1}' | cut -c 3-) | ||
cp -r $dir error-report/$module_path/$(basename $(dirname $dir)) | ||
done | ||
tar czvf error-report_${TIMESTAMP}.tar.gz error-report | ||
- name: Upload Report to Artifact | ||
if: ${{ failure() }} | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: error-report | ||
path: error-report_*.tar.gz | ||
|