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: Java CI with Gradle | |
on: | |
pull_request: | |
branches: [ "main", "dev" ] | |
permissions: write-all | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- 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- | |
- name: Grant Execute Permission For Gradlew | |
run: chmod +x gradlew | |
- name: Build With Gradle | |
run: ./gradlew build -x test | |
- name: Start MySQL | |
uses: samin/[email protected] | |
with: | |
host port: 3305 | |
container port: 3305 | |
mysql database: 'caps' | |
mysql user: 'admin' | |
mysql password: 'admin1234' | |
- name: Make application-test.properties | |
run: | | |
cd ./src/test/resources | |
touch ./application.properties | |
echo "${{ secrets.PROPERTIES_TEST }}" > ./application.properties | |
shell: bash | |
- name: Build With Test | |
run: ./gradlew test | |
- name: Publish Unit Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v1 | |
if: ${{ always() }} | |
with: | |
files: build/test-results/**/*.xml |