Skip to content

Gradle cache usage added #998

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
129204a
cache usage added
bissquit Sep 22, 2022
22c8a61
switched to more concrete path
bissquit Sep 22, 2022
9a5cba3
Merge branch 'main' of https://github.com/UnitTestBot/UTBotJava into …
bissquit Sep 22, 2022
6e88f85
debug added
bissquit Sep 22, 2022
ced16fa
handle error in debug
bissquit Sep 23, 2022
f468a04
extra tasks removed for testing
bissquit Sep 23, 2022
233220f
post check cache
bissquit Sep 23, 2022
d144a0c
tmate debug
bissquit Sep 23, 2022
8d66c86
tmate sudo false
bissquit Sep 23, 2022
5411531
cache path switched from related to direct
bissquit Sep 23, 2022
6f53f8a
debug removed
bissquit Sep 23, 2022
02578d8
switched to custom cache paths
bissquit Sep 23, 2022
67e28b7
some tests moved back
bissquit Sep 23, 2022
57a175d
typo with {}{} fixed
bissquit Sep 23, 2022
e70f520
order of tasks changed
bissquit Sep 23, 2022
39c46e6
hash key fixed; also comments added
bissquit Sep 23, 2022
031b084
matrices reverted at the old state
bissquit Sep 23, 2022
4cf8e72
previous state of single-project returned
bissquit Sep 23, 2022
c7500ee
Merge branch 'main' of https://github.com/UnitTestBot/UTBotJava into …
bissquit Sep 23, 2022
f9a5462
Merge branch 'main' of https://github.com/UnitTestBot/UTBotJava into …
bissquit Sep 26, 2022
792ce70
Merge branch 'main' of https://github.com/UnitTestBot/UTBotJava into …
bissquit Sep 27, 2022
42cc8c8
Merge branch 'main' of https://github.com/UnitTestBot/UTBotJava into …
bissquit Oct 3, 2022
5730b40
Merge branch 'main' of https://github.com/UnitTestBot/UTBotJava into …
bissquit Oct 3, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 78 additions & 45 deletions .github/workflows/build-and-run-tests-from-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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: |
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/combined-projects-matrix.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
}
22 changes: 11 additions & 11 deletions .github/workflows/framework-tests-matrix.json
Original file line number Diff line number Diff line change
Expand Up @@ -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\""
}
]
}