[FEATURE][#52] - Create endpoints user preferences and recommendations #121
Workflow file for this run
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: CI(continuous integration) | |
on: | |
pull_request: | |
branches: | |
- develop | |
- main | |
jobs: | |
run-action: | |
name: Run action | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Java 17 with Spring Boot | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Grant execute permission for Gradle Wrapper | |
run: chmod +x gradlew | |
- name: Build with Gradle | |
run: HOSTNAME=${{ secrets.HOSTNAME }} | |
PORT=${{ secrets.PORT }} | |
DBNAME=${{ secrets.DBNAME }} | |
DBUSER=${{ secrets.DBUSER }} | |
DBPASSWORD=${{ secrets.DBPASSWORD }} | |
APIKEY=${{ secrets.APIKEY }} | |
SECURITY=${{ secrets.SECURITY }} | |
./gradlew build --no-daemon | |
- name: Run tests | |
run: APIKEY=${{ secrets.APIKEY }} | |
./gradlew test --no-daemon | |
- name: Verify coverage | |
run: ./gradlew jacocoTestReport --no-daemon | |
- name: Check coverage | |
run: | | |
COVERAGE_THRESHOLD=80 | |
ACTUAL_COVERAGE="$(sed -n 's/.*<td class="ctr2">\([0-9]*\)%<\/td>.*/\1/p' build/jacoco/test/html/index.html)" | |
if [ "$(expr "$ACTUAL_COVERAGE" '<' "$COVERAGE_THRESHOLD")" -ne 0 ]; then | |
echo "Coverage below threshold (${ACTUAL_COVERAGE}% < ${COVERAGE_THRESHOLD}%)" | |
exit 1 | |
fi | |
- name: Upload coverage | |
uses: actions/upload-artifact@v2 | |
with: | |
name: coverage-report | |
path: build/jacoco/test/html |