diff --git a/.github/workflows/ci_gradle.yml b/.github/workflows/ci_gradle.yml new file mode 100644 index 00000000..b5034f4b --- /dev/null +++ b/.github/workflows/ci_gradle.yml @@ -0,0 +1,78 @@ +# 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: Java CI with Gradle in mogakGo + +on: + workflow_dispatch: + push: + branches: [ "develop" ] + pull_request: + branches: [ "main", "develop" ] + +permissions: + checks: write + pull-requests: write + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + + ## Gradle Wrapper grant permission + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + ## create application.yml + - name: make application.yml + run: | + mkdir -p ./src/main/resources + touch ./src/main/resources/application.yml + shell: bash + + - name: save application.yml for secrets + run: echo "${{ secrets.APPLICATION }}" > ./src/main/resources/application.yml + shell: bash + + ## create test_application.yml + - name: make test_application.yml + run: | + mkdir -p ./src/test/resources + touch ./src/test/resources/application.yml + shell: bash + + - name: save test_application.yml for secrets + run: echo "${{ secrets.APPLICATION_TEST }}" > ./src/test/resources/application.yml + shell: bash + + ## create test_ddl.sql for test + + ## execute Gradle test + - name: Test with Gradle + run: ./gradlew --info test + + ## create Report after Test + - name: Public Test results + uses: EnricoMi/publish-unit-test-result-action@v2 + if: always() + with: + files: '**/build/test-results/test/TEST-*.xml' + + ## make comment about error + - name: add comments to pull-request + uses: mikepenz/action-junit-report@v3 + if: always() + with: + report_paths: '**/build/test-results/test/TEST-*.xml'