1919 IMAGE_NAME : utbot_java_cli
2020 DOCKERFILE_PATH : docker/Dockerfile_java_cli
2121 # Environment variable setting gradle options.
22- GRADLE_OPTS : " -XX:MaxHeapSize=2048m -Dorg.gradle.jvmargs='-XX:MaxHeapSize=2048m -XX:MaxPermSize=512m -javaagent:/tmp/jmx-exporter.jar=12345:/tmp/jmx-exporter.yml - Dorg.gradle.daemon=false' -Dorg.gradle.daemon=false"
22+ GRADLE_OPTS : " -XX:MaxHeapSize=2048m -Dorg.gradle.jvmargs='-XX:MaxHeapSize=2048m -XX:MaxPermSize=512m -Dorg.gradle.daemon=false' -Dorg.gradle.daemon=false"
2323
2424jobs :
25- prepare-tests-matrix :
25+ prepare-matrices :
2626 runs-on : ubuntu-latest
2727 # Outputs are used for passing data to dependent jobs.
2828 outputs :
29- matrix : ${{ steps.set-matrix.outputs.matrix }}
29+ framework-tests-matrix : ${{ steps.set-matrices.outputs.framework-tests-matrix }}
30+ combined-projects-matrix : ${{ steps.set-matrices.outputs.combined-projects-matrix }}
3031 steps :
3132 - name : Print environment variables
3233 run : printenv
@@ -37,26 +38,26 @@ jobs:
3738 - name : Check out ${{ github.event.inputs.commit_sha }} commit
3839 if : github.event.inputs.commit_sha != ''
3940 run : |
41+ git config --global --add safe.directory ${GITHUB_WORKSPACE}
4042 git fetch
4143 git checkout ${{ github.event.inputs.commit_sha }}
42- - id : set-matrix
43- name : Read and print config from framework-tests-matrix.json
44+ - id : set-matrices
45+ name : Read and print config from framework-tests-matrix.json and combined-projects-matrix.json
4446 run : |
45- TASKS=$(echo $(cat .github/workflows/framework-tests-matrix.json))
46- echo "::set-output name=matrix::$TASKS"
47- echo $TASKS
48-
49- framework-test :
50- # This job does not need to wait for 'prepare-tests-matrix' result.
51- # GitHub allocates runners portionally. Framework tests are time consuming. That's why we want to force them
52- # to start execution early.
53- needs : prepare-tests-matrix
54- # Using matrices let create multiple jobs runs based on the combinations of the variables from matrices.
47+ FRAMEWORK_TESTS=$(echo $(cat .github/workflows/framework-tests-matrix.json))
48+ COMBINED_PROJECTS=$(echo $(cat .github/workflows/combined-projects-matrix.json))
49+ echo "::set-output name=framework-tests-matrix::$FRAMEWORK_TESTS"
50+ echo "::set-output name=combined-projects-matrix::$COMBINED_PROJECTS"
51+ echo $FRAMEWORK_TESTS
52+ echo $COMBINED_PROJECTS
53+ framework-tests :
54+ needs : prepare-matrices
55+ # Using matrices let create multiple jobs runs based on the combinations of the variables from matrices.
5556 # https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs
5657 strategy :
5758 # The option forces to execute all jobs even though some of them have failed.
5859 fail-fast : false
59- matrix : ${{ fromJson(needs.prepare-tests-matrix .outputs.matrix) }}
60+ matrix : ${{ fromJson(needs.prepare-matrices .outputs.framework-tests- matrix) }}
6061 runs-on : ubuntu-20.04
6162 container : unittestbot/java-env:java11-zulu-jdk-gradle7.4.2-kotlinc1.7.0
6263 steps :
6970 - name : Check out ${{ github.event.inputs.commit_sha }} commit
7071 if : github.event.inputs.commit_sha != ''
7172 run : |
73+ git config --global --add safe.directory ${GITHUB_WORKSPACE}
7274 git fetch
7375 git checkout ${{ github.event.inputs.commit_sha }}
7476 - name : Run monitoring
@@ -101,16 +103,75 @@ jobs:
101103 name : test_report ${{ matrix.project.PART_NAME }}
102104 path : utbot-framework-test/build/reports/tests/test/*
103105
106+ combined-projects :
107+ # This job does not need to wait for 'prepare-tests-matrix' result.
108+ # GitHub allocates runners portionally. Framework tests are time consuming. That's why we want to force them
109+ # to start execution early.
110+ needs : prepare-matrices
111+ # Using matrices let create multiple jobs runs based on the combinations of the variables from matrices.
112+ # https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs
113+ strategy :
114+ # The option forces to execute all jobs even though some of them have failed.
115+ fail-fast : false
116+ matrix : ${{ fromJson(needs.prepare-matrices.outputs.combined-projects-matrix) }}
117+ runs-on : ubuntu-20.04
118+ container : unittestbot/java-env:java11-zulu-jdk-gradle7.4.2-kotlinc1.7.0
119+ steps :
120+ - name : Print environment variables
121+ run : printenv
122+
123+ - name : Checkout repository
124+ uses : actions/checkout@v3
125+
126+ - name : Check out ${{ github.event.inputs.commit_sha }} commit
127+ if : github.event.inputs.commit_sha != ''
128+ run : |
129+ git config --global --add safe.directory ${GITHUB_WORKSPACE}
130+ git fetch
131+ git checkout ${{ github.event.inputs.commit_sha }}
132+
133+ - name : Run monitoring
134+ run : |
135+ echo Find your Prometheus metrics using label {instance=\"${GITHUB_RUN_ID}-${HOSTNAME}\"}
136+ chmod +x ./scripts/project/monitoring.sh
137+ ./scripts/project/monitoring.sh ${{ secrets.PUSHGATEWAY_HOSTNAME }} ${{ secrets.PUSHGATEWAY_USER }} ${{ secrets.PUSHGATEWAY_PASSWORD }}
138+ - name : Build project ${{ matrix.projects.first }}
139+ id : first-project
140+ run : |
141+ cd ${{ matrix.projects.first }}
142+ gradle build --no-daemon
143+ - name : Build project ${{ matrix.projects.second }}
144+ if : ${{ steps.first-project.outcome != 'cancelled' && steps.first-project.outcome != 'skipped' }}
145+ run : |
146+ cd ${{ matrix.projects.second }}
147+ gradle build --no-daemon
148+ - name : Upload test report if tests have failed
149+ if : ${{ failure() }}
150+ uses : actions/upload-artifact@v3
151+ with :
152+ name : test_report ${{ matrix.projects.first }}
153+ path : ${{ matrix.projects.first }}/build/reports/tests/test/*
104154
105- project :
106- needs : prepare-tests-matrix
107- # Using matrices let create multiple jobs runs based on the combinations of the variables from matrices.
155+ - name : Upload test report if tests have failed
156+ if : ${{ failure() }}
157+ uses : actions/upload-artifact@v3
158+ with :
159+ name : test_report ${{ matrix.projects.second }}
160+ path : ${{ matrix.projects.second }}/build/reports/tests/test/*
161+
162+
163+ single-project :
164+ # This job does not need to wait for 'prepare-tests-matrix' result.
165+ # GitHub allocates runners portionally. Framework tests are time consuming. That's why we want to force them
166+ # to start execution early.
167+ needs : prepare-matrices
168+ # Using matrices let create multiple jobs runs based on the combinations of the variables from matrices.
108169 # https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs
109170 strategy :
110171 # The option forces to execute all jobs even though some of them have failed.
111172 fail-fast : false
112173 matrix :
113- project : [utbot-api, utbot-cli, utbot- core, utbot-framework, utbot-framework-api, utbot- fuzzers, utbot-gradle, utbot-instrumentation, utbot-instrumentation-tests, utbot-intellij, utbot- junit-contest, utbot-rd, utbot- sample, utbot-summary, utbot-summary-tests ]
174+ project : [utbot-core, utbot-fuzzers, utbot-gradle, utbot-junit-contest, utbot-sample]
114175 runs-on : ubuntu-20.04
115176 container : unittestbot/java-env:java11-zulu-jdk-gradle7.4.2-kotlinc1.7.0
116177 steps :
@@ -123,11 +184,9 @@ jobs:
123184 - name : Check out ${{ github.event.inputs.commit_sha }} commit
124185 if : github.event.inputs.commit_sha != ''
125186 run : |
187+ git config --global --add safe.directory ${GITHUB_WORKSPACE}
126188 git fetch
127189 git checkout ${{ github.event.inputs.commit_sha }}
128- - uses : actions/checkout@v3
129- with :
130- ref : ${{ env.COMMIT_SHA }}
131190
132191 - name : Run monitoring
133192 run : |
0 commit comments