diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 0000000..34e0009 --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,75 @@ +name: Java CI with Gradle + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +permissions: + contents: read + +env: + DOCKER_HOST: tcp://docker:2375 + DOCKER_DRIVER: overlay2 + DOCKER_TLS_CERTDIR: "" + IMAGE_NAME: emcmongoose/mongoose-base + IMAGE_FILE_NAME: build/mongoose-base.tar + ROBOTEST_CONTAINER_WORKING_DIR: /root/mongoose + + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'temurin' + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + - name: Execute Gradle build + run: ./gradlew clean jar + - name: Upload a Build Artifact + uses: actions/upload-artifact@v3.1.0 + with: + name: mongoose.jar + path: ./build/libs/ + if-no-files-found: error + retention-days: 1 # optional + - name: Execute Gradle unit test + run: ./gradlew test + - name: Upload a failed unit test artifact + uses: actions/upload-artifact@v3.1.0 + with: + name: testFailure.log + path: ./build/reports/tests/test/* + if-no-files-found: error + retention-days: 14 # optional + if: failure() + - name: Execute Gradle integration test + run: ./gradlew integrationTest + - name: Upload a failed integration test artifact + uses: actions/upload-artifact@v3.1.0 + with: + name: testFailure.log + path: ./build/reports/tests/integrationTest/* + if-no-files-found: error + retention-days: 14 # optional + if: failure() + - uses: actions/checkout@v3 + - name: Build the Docker image + run: docker build . --file ci/docker/Dockerfile --tag my-image-name:${GITHUB_SHA} + - name: Upload a failed test artifact + uses: actions/upload-artifact@v3.1.0 + with: + name: testFailure.log + path: ./build/reports/tests/integrationTest/* + if-no-files-found: error + retention-days: 14 # optional + +