diff --git a/.github/workflows/build-and-run-tests-from-branch.yml b/.github/workflows/build-and-run-tests-from-branch.yml index c16a3bef2b..8d320ae17d 100644 --- a/.github/workflows/build-and-run-tests-from-branch.yml +++ b/.github/workflows/build-and-run-tests-from-branch.yml @@ -66,21 +66,41 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 - - name: Check out ${{ github.event.inputs.commit_sha }} commit if: github.event.inputs.commit_sha != '' run: | git config --global --add safe.directory ${GITHUB_WORKSPACE} git fetch git checkout ${{ github.event.inputs.commit_sha }} + - name: Run monitoring run: | echo Find your Prometheus metrics using label {instance=\"${GITHUB_RUN_ID}-${HOSTNAME}\"} chmod +x ./scripts/project/monitoring.sh ./scripts/project/monitoring.sh ${{ secrets.PUSHGATEWAY_HOSTNAME }} ${{ secrets.PUSHGATEWAY_USER }} ${{ secrets.PUSHGATEWAY_PASSWORD }} + + # cache will use the key you provided and contains the files you specify in path. + # + # When key matches an existing cache, it's called a cache hit, and the action + # restores the cached files to the path directory. + # When key doesn't match an existing cache, it's called a cache miss, and a new + # cache is automatically created if the job completes successfully. + # + # The cache action first searches for cache hits for key and restore-keys in the + # branch containing the workflow run. If there are no hits in the current branch, + # the cache action searches for key and restore-keys in the parent branch and + # upstream branches. + - uses: actions/cache@v3 + with: + path: /root/.gradle/caches + # key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle', '*.gradle.kts', './*.gradle', './*.gradle.kts') }} + # hashFiles returns a single hash for the set of files that matches the path pattern + key: ${{ runner.os }}-gradle-framework-${{ hashFiles('./*.gradle*', './utbot-framework*/*.gradle*') }} + restore-keys: ${{ runner.os }}-gradle-framework - name: Run tests run: | - gradle --no-daemon :utbot-framework-test:test ${{ matrix.project.TESTS_TO_RUN }} + gradle --build-cache --no-daemon :utbot-framework-test:test ${{ matrix.project.TESTS_TO_RUN }} + - name: Upload logs if: ${{ always() }} uses: actions/upload-artifact@v3 @@ -117,47 +137,54 @@ jobs: runs-on: ubuntu-20.04 container: unittestbot/java-env:java11-zulu-jdk-gradle7.4.2-kotlinc1.7.0 steps: - - name: Print environment variables - run: printenv - - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Check out ${{ github.event.inputs.commit_sha }} commit - if: github.event.inputs.commit_sha != '' - run: | - git config --global --add safe.directory ${GITHUB_WORKSPACE} - git fetch - git checkout ${{ github.event.inputs.commit_sha }} - - - name: Run monitoring - run: | - echo Find your Prometheus metrics using label {instance=\"${GITHUB_RUN_ID}-${HOSTNAME}\"} - chmod +x ./scripts/project/monitoring.sh - ./scripts/project/monitoring.sh ${{ secrets.PUSHGATEWAY_HOSTNAME }} ${{ secrets.PUSHGATEWAY_USER }} ${{ secrets.PUSHGATEWAY_PASSWORD }} - - name: Build project ${{ matrix.projects.first }} - id: first-project - run: | - cd ${{ matrix.projects.first }} - gradle build --no-daemon - - name: Build project ${{ matrix.projects.second }} - if: ${{ steps.first-project.outcome != 'cancelled' && steps.first-project.outcome != 'skipped' }} - run: | - cd ${{ matrix.projects.second }} - gradle build --no-daemon - - name: Upload test report if tests have failed - if: ${{ failure() }} - uses: actions/upload-artifact@v3 - with: - name: test_report ${{ matrix.projects.first }} - path: ${{ matrix.projects.first }}/build/reports/tests/test/* - - - name: Upload test report if tests have failed - if: ${{ failure() }} - uses: actions/upload-artifact@v3 - with: - name: test_report ${{ matrix.projects.second }} - path: ${{ matrix.projects.second }}/build/reports/tests/test/* + - name: Print environment variables + run: printenv + + - name: Checkout repository + uses: actions/checkout@v3 + - name: Check out ${{ github.event.inputs.commit_sha }} commit + if: github.event.inputs.commit_sha != '' + run: | + git config --global --add safe.directory ${GITHUB_WORKSPACE} + git fetch + git checkout ${{ github.event.inputs.commit_sha }} + + - name: Run monitoring + run: | + echo Find your Prometheus metrics using label {instance=\"${GITHUB_RUN_ID}-${HOSTNAME}\"} + chmod +x ./scripts/project/monitoring.sh + ./scripts/project/monitoring.sh ${{ secrets.PUSHGATEWAY_HOSTNAME }} ${{ secrets.PUSHGATEWAY_USER }} ${{ secrets.PUSHGATEWAY_PASSWORD }} + + - uses: actions/cache@v3 + with: + path: /root/.gradle/caches + key: ${{ runner.os }}-gradle-combined-${{ hashFiles('./*.gradle*', './*/.gradle*') }} + restore-keys: ${{ runner.os }}-gradle-combined- + - name: Build project ${{ matrix.projects.first }} + id: first-project + run: | + cd ${{ matrix.projects.first }} + gradle build --build-cache --no-daemon + + - name: Build project ${{ matrix.projects.second }} + if: ${{ steps.first-project.outcome != 'cancelled' && steps.first-project.outcome != 'skipped' }} + run: | + cd ${{ matrix.projects.second }} + gradle build --build-cache --no-daemon + + - name: Upload test report if tests have failed + if: ${{ failure() }} + uses: actions/upload-artifact@v3 + with: + name: test_report ${{ matrix.projects.first }} + path: ${{ matrix.projects.first }}/build/reports/tests/test/* + + - name: Upload test report if tests have failed + if: ${{ failure() }} + uses: actions/upload-artifact@v3 + with: + name: test_report ${{ matrix.projects.second }} + path: ${{ matrix.projects.second }}/build/reports/tests/test/* single-project: @@ -180,7 +207,6 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 - - name: Check out ${{ github.event.inputs.commit_sha }} commit if: github.event.inputs.commit_sha != '' run: | @@ -193,10 +219,17 @@ jobs: echo Find your Prometheus metrics using label {instance=\"${GITHUB_RUN_ID}-${HOSTNAME}\"} chmod +x ./scripts/project/monitoring.sh ./scripts/project/monitoring.sh ${{ secrets.PUSHGATEWAY_HOSTNAME }} ${{ secrets.PUSHGATEWAY_USER }} ${{ secrets.PUSHGATEWAY_PASSWORD }} + + - uses: actions/cache@v3 + with: + path: /root/.gradle/caches + key: ${{ runner.os }}-gradle-${{ matrix.project }}-${{ hashFiles('./*.gradle*', format('{0}{1}{2}', './', matrix.project, '/*.gradle*')) }} + restore-keys: ${{ runner.os }}-gradle-${{ matrix.project }}- - name: Run tests run: | cd ${{ matrix.project }} - gradle build --no-daemon + gradle build --build-cache --no-daemon + - name: Upload test report if tests have failed if: ${{ failure() }} uses: actions/upload-artifact@v3 diff --git a/.github/workflows/combined-projects-matrix.json b/.github/workflows/combined-projects-matrix.json index 823e0a2624..83130dd191 100644 --- a/.github/workflows/combined-projects-matrix.json +++ b/.github/workflows/combined-projects-matrix.json @@ -2,19 +2,19 @@ "projects": [ { "FIRST": "utbot-intellij", - "SECOND": "utbot-cli", + "SECOND": "utbot-cli" }, { "FIRST": "utbot-instrumentation", - "SECOND": "utbot-instrumentation-tests", + "SECOND": "utbot-instrumentation-tests" }, { "FIRST": "utbot-summary", - "SECOND": "utbot-summary-tests", + "SECOND": "utbot-summary-tests" }, { "FIRST": "utbot-api", - "SECOND": "utbot-framework-api", + "SECOND": "utbot-framework-api" } ] } diff --git a/.github/workflows/framework-tests-matrix.json b/.github/workflows/framework-tests-matrix.json index f843cfddca..67448bca1c 100644 --- a/.github/workflows/framework-tests-matrix.json +++ b/.github/workflows/framework-tests-matrix.json @@ -2,43 +2,43 @@ "project": [ { "PART_NAME": "composite", - "TESTS_TO_RUN": "--tests \"org.utbot.examples.manual.*\" --tests \"org.utbot.examples.stream.*\" --tests \"org.utbot.engine.*\" --tests \"org.utbot.framework.*\" --tests \"org.utbot.sarif.*\"", + "TESTS_TO_RUN": "--tests \"org.utbot.examples.manual.*\" --tests \"org.utbot.examples.stream.*\" --tests \"org.utbot.engine.*\" --tests \"org.utbot.framework.*\" --tests \"org.utbot.sarif.*\"" }, { "PART_NAME": "collections-part1", - "TESTS_TO_RUN": "--tests \"org.utbot.examples.collections.CustomerExamplesTest\" --tests \"org.utbot.examples.collections.GenericListsExampleTest\" --tests \"org.utbot.examples.collections.LinkedListsTest\" --tests \"org.utbot.examples.collections.ListAlgorithmsTest\" --tests \"org.utbot.examples.collections.ListIteratorsTest\" --tests \"org.utbot.examples.collections.ListWrapperReturnsVoidTest\" --tests \"org.utbot.examples.collections.MapEntrySetTest\" --tests \"org.utbot.examples.collections.MapKeySetTest\"", + "TESTS_TO_RUN": "--tests \"org.utbot.examples.collections.CustomerExamplesTest\" --tests \"org.utbot.examples.collections.GenericListsExampleTest\" --tests \"org.utbot.examples.collections.LinkedListsTest\" --tests \"org.utbot.examples.collections.ListAlgorithmsTest\" --tests \"org.utbot.examples.collections.ListIteratorsTest\" --tests \"org.utbot.examples.collections.ListWrapperReturnsVoidTest\" --tests \"org.utbot.examples.collections.MapEntrySetTest\" --tests \"org.utbot.examples.collections.MapKeySetTest\"" }, { "PART_NAME": "collections-part2", - "TESTS_TO_RUN": "--tests \"org.utbot.examples.collections.MapValuesTest\" --tests \"org.utbot.examples.collections.OptionalsTest\" --tests \"org.utbot.examples.collections.SetIteratorsTest\"", + "TESTS_TO_RUN": "--tests \"org.utbot.examples.collections.MapValuesTest\" --tests \"org.utbot.examples.collections.OptionalsTest\" --tests \"org.utbot.examples.collections.SetIteratorsTest\"" }, { "PART_NAME": "collections-part3", - "TESTS_TO_RUN": "--tests \"org.utbot.examples.collections.SetsTest\"", + "TESTS_TO_RUN": "--tests \"org.utbot.examples.collections.SetsTest\"" }, { "PART_NAME": "examples-part1", - "TESTS_TO_RUN": "--tests \"org.utbot.examples.algorithms.*\" --tests \"org.utbot.examples.annotations.*\" --tests \"org.utbot.examples.arrays.*\" --tests \"org.utbot.examples.casts.*\" --tests \"org.utbot.examples.codegen.*\" --tests \"org.utbot.examples.controlflow.*\" --tests \"org.utbot.examples.enums.*\"", + "TESTS_TO_RUN": "--tests \"org.utbot.examples.algorithms.*\" --tests \"org.utbot.examples.annotations.*\" --tests \"org.utbot.examples.arrays.*\" --tests \"org.utbot.examples.casts.*\" --tests \"org.utbot.examples.codegen.*\" --tests \"org.utbot.examples.controlflow.*\" --tests \"org.utbot.examples.enums.*\"" }, { "PART_NAME": "examples-part2", - "TESTS_TO_RUN": "--tests \"org.utbot.examples.exceptions.*\" --tests \"org.utbot.examples.invokes.*\" --tests \"org.utbot.examples.lambda.*\" --tests \"org.utbot.examples.make.symbolic.*\" --tests \"org.utbot.examples.math.*\" --tests \"org.utbot.examples.mixed.*\" --tests \"org.utbot.examples.mock.*\" --tests \"org.utbot.examples.models.*\" --tests \"org.utbot.examples.natives.*\" --tests \"org.utbot.examples.objects.*\"", + "TESTS_TO_RUN": "--tests \"org.utbot.examples.exceptions.*\" --tests \"org.utbot.examples.invokes.*\" --tests \"org.utbot.examples.lambda.*\" --tests \"org.utbot.examples.make.symbolic.*\" --tests \"org.utbot.examples.math.*\" --tests \"org.utbot.examples.mixed.*\" --tests \"org.utbot.examples.mock.*\" --tests \"org.utbot.examples.models.*\" --tests \"org.utbot.examples.natives.*\" --tests \"org.utbot.examples.objects.*\"" }, { "PART_NAME": "examples-part3", - "TESTS_TO_RUN": "--tests \"org.utbot.examples.primitives.*\" --tests \"org.utbot.examples.recursion.*\" --tests \"org.utbot.examples.statics.substitution.*\" --tests \"org.utbot.examples.stdlib.*\" --tests \"org.utbot.examples.strings.*\" --tests \"org.utbot.examples.structures.*\" --tests \"org.utbot.examples.thirdparty.numbers.*\" --tests \"org.utbot.examples.types.*\" --tests \"org.utbot.examples.unsafe.*\" --tests \"org.utbot.examples.wrappers.*\"", + "TESTS_TO_RUN": "--tests \"org.utbot.examples.primitives.*\" --tests \"org.utbot.examples.recursion.*\" --tests \"org.utbot.examples.statics.substitution.*\" --tests \"org.utbot.examples.stdlib.*\" --tests \"org.utbot.examples.strings.*\" --tests \"org.utbot.examples.structures.*\" --tests \"org.utbot.examples.thirdparty.numbers.*\" --tests \"org.utbot.examples.types.*\" --tests \"org.utbot.examples.unsafe.*\" --tests \"org.utbot.examples.wrappers.*\"" }, { - "PART_NAME": "examples-lists", - "TESTS_TO_RUN": "--tests \"org.utbot.examples.collections.ListsPart1Test\" --tests \"org.utbot.examples.collections.ListsPart2Test\" --tests \"org.utbot.examples.collections.ListsPart3Test\"", + "PART_NAME": "examples-lists", + "TESTS_TO_RUN": "--tests \"org.utbot.examples.collections.ListsPart1Test\" --tests \"org.utbot.examples.collections.ListsPart2Test\" --tests \"org.utbot.examples.collections.ListsPart3Test\"" }, { "PART_NAME": "examples-maps-part1", - "TESTS_TO_RUN": "--tests \"org.utbot.examples.collections.MapsPart1Test\"", + "TESTS_TO_RUN": "--tests \"org.utbot.examples.collections.MapsPart1Test\"" }, { "PART_NAME": "examples-maps-part2", - "TESTS_TO_RUN": "--tests \"org.utbot.examples.collections.MapsPart2Test\"", + "TESTS_TO_RUN": "--tests \"org.utbot.examples.collections.MapsPart2Test\"" } ] }