@@ -10,131 +10,40 @@ env:
10
10
REGISTRY : ghcr.io
11
11
IMAGE_NAME : utbot_java_cli
12
12
DOCKERFILE_PATH : docker/Dockerfile_java_cli
13
+ # Environment variable setting gradle options.
13
14
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"
14
15
15
16
jobs :
16
- prepare-tests-matrix :
17
- runs-on : ubuntu-latest
18
- outputs :
19
- matrix : ${{ steps.set-matrix.outputs.matrix }}
20
- steps :
21
- - name : Checkout repository
22
- uses : actions/checkout@v3
23
- - id : set-matrix
24
- name : Read and print config from framework-tests-matrix.json
25
- run : |
26
- TASKS=$(echo $(cat .github/workflows/framework-tests-matrix.json))
27
- echo "::set-output name=matrix::$TASKS"
28
- echo $TASKS
29
-
30
-
31
- framework :
32
- needs : prepare-tests-matrix
33
- strategy :
34
- fail-fast : false
35
- matrix : ${{ fromJson(needs.prepare-tests-matrix.outputs.matrix) }}
36
- runs-on : ubuntu-20.04
37
- container : unittestbot/java-env:java11-zulu-jdk-fx-gradle7.4.2-kotlinc1.7.0
38
- steps :
39
- - uses : actions/checkout@v3
40
-
41
- - name : Check out ${{ github.event.inputs.commit-sha }} commit
42
- run : |
43
- git fetch
44
- git checkout ${{ github.event.inputs.commit-sha }}
45
-
46
- - name : Run monitoring
47
- run : |
48
- echo Find your Prometheus metrics using label {instance=\"${GITHUB_RUN_ID}-${HOSTNAME}\"}
49
- chmod +x ./scripts/monitoring.sh
50
- ./scripts/monitoring.sh ${{ secrets.PUSHGATEWAY_HOSTNAME }} ${{ secrets.PUSHGATEWAY_USER }} ${{ secrets.PUSHGATEWAY_PASSWORD }}
51
-
52
- - name : Run tests
53
- run : |
54
- gradle --no-daemon :utbot-framework:test ${{ matrix.project.TESTS_TO_RUN }}
55
-
56
- - name : Upload logs
57
- if : ${{ always() }}
58
- uses : actions/upload-artifact@v3
59
- with :
60
- name : logs ${{ matrix.project.PART_NAME }}
61
- path : utbot-framework/logs/*
62
-
63
- - name : Upload UTBot temp directory content
64
- if : ${{ always() }}
65
- uses : actions/upload-artifact@v3
66
- with :
67
- name : utbot_temp ${{ matrix.project.PART_NAME }}
68
- path : |
69
- /tmp/UTBot/generated*/*
70
- /tmp/UTBot/utbot-childprocess-errors/*
71
-
72
- - name : Upload test report if tests have failed
73
- if : ${{ failure() }}
74
- uses : actions/upload-artifact@v3
75
- with :
76
- name : test_report ${{ matrix.project.PART_NAME }}
77
- path : utbot-framework/build/reports/tests/test/*
78
-
79
-
80
- project :
81
- # This job does not need to wait for 'prepare-tests-matrix' result.
82
- # This is a hack to force GitHub to allocate runners for framework project first (as the project build requires much time).
83
- needs : prepare-tests-matrix
84
- strategy :
85
- fail-fast : false
86
- matrix :
87
- project : [utbot-api, utbot-cli, utbot-core, utbot-framework-api, utbot-fuzzers, utbot-gradle, utbot-instrumentation, utbot-instrumentation-tests, utbot-intellij, utbot-junit-contest, utbot-sample, utbot-summary, utbot-summary-tests]
88
- runs-on : ubuntu-20.04
89
- container : unittestbot/java-env:java11-zulu-jdk-fx-gradle7.4.2-kotlinc1.7.0
90
- steps :
91
- - uses : actions/checkout@v3
92
-
93
- - name : Check out ${{ github.event.inputs.commit-sha }} commit
94
- run : |
95
- git fetch
96
- git checkout ${{ github.event.inputs.commit-sha }}
97
-
98
- - name : Run monitoring
99
- run : |
100
- echo Find your Prometheus metrics using label {instance=\"${GITHUB_RUN_ID}-${HOSTNAME}\"}
101
- chmod +x ./scripts/monitoring.sh
102
- ./scripts/monitoring.sh ${{ secrets.PUSHGATEWAY_HOSTNAME }} ${{ secrets.PUSHGATEWAY_USER }} ${{ secrets.PUSHGATEWAY_PASSWORD }}
103
-
104
- - name : Run tests
105
- run : |
106
- cd ${{ matrix.project }}
107
- gradle build --no-daemon
108
-
109
- - name : Upload test report if tests have failed
110
- if : ${{ failure() }}
111
- uses : actions/upload-artifact@v3
112
- with :
113
- name : test_report ${{ matrix.project }}
114
- path : ${{ matrix.project }}/build/reports/tests/test/*
17
+ build-and-run-tests :
18
+ uses : ./.github/workflows/build-and-run-tests-from-branch.yml
115
19
116
20
117
21
publish-cli-image :
118
- needs : framework
22
+ needs : build-and-run-tests
119
23
if : ${{ github.event_name == 'push' }}
120
24
runs-on : ubuntu-20.04
121
25
container : unittestbot/java-env:java11-zulu-jdk-fx-gradle7.4.2-kotlinc1.7.0
122
26
steps :
27
+ - name : Print environment variables
28
+ run : printenv
29
+
123
30
- uses : actions/checkout@v3
124
31
125
32
- name : Set environment variables
126
33
run : |
127
- echo COMMIT_SHORT_SHA="$(git rev-parse --short HEAD)" >> $GITHUB_ENV
34
+ # "You can make an environment variable available to any subsequent steps in a workflow job by
35
+ # defining or updating the environment variable and writing this to the GITHUB_ENV environment file."
128
36
echo VERSION="$(date +%Y).$(date +%-m)" >> $GITHUB_ENV
129
37
130
38
- name : Build UTBot Java CLI
131
39
run : |
132
40
cd utbot-cli
133
41
gradle build --no-daemon -x test -PsemVer=${{ env.VERSION }}
134
-
135
42
- name : Set docker tag
136
43
run :
137
- echo DOCKER_TAG="$(date +%Y).$(date +%-m).$(date +%-d)-${{ env.COMMIT_SHORT_SHA }}" >> $GITHUB_ENV
44
+ # "You can make an environment variable available to any subsequent steps in a workflow job by
45
+ # defining or updating the environment variable and writing this to the GITHUB_ENV environment file."
46
+ echo DOCKER_TAG="$(date +%Y).$(date +%-m).$(date +%-d)-${{ github.sha }}" >> $GITHUB_ENV
138
47
139
48
- name : Log in to the Container registry
140
49
uses : docker/login-action@v2
153
62
key : ${{ runner.os }}-buildx-${{ github.sha }}
154
63
restore-keys : |
155
64
${{ runner.os }}-buildx-
156
-
157
65
- name : Docker meta
158
66
id : meta
159
67
uses : docker/metadata-action@v3
@@ -169,11 +77,10 @@ jobs:
169
77
--cache-to "type=local,dest=/tmp/.buildx-cache-new" \
170
78
--tag ${{ steps.meta.outputs.tags }} \
171
79
--build-arg UTBOT_JAVA_CLI=utbot-cli/build/libs/utbot-cli-${{ env.VERSION }}.jar \
172
- --push .
80
+ --push .
173
81
# Temp fix
174
82
# https://github.com/docker/build-push-action/issues/252
175
83
# https://github.com/moby/buildkit/issues/1896
176
-
177
84
- name : Move cache
178
85
run : |
179
86
rm -rf /tmp/.buildx-cache
0 commit comments