Skip to content

Commit fd7a8eb

Browse files
Add caching utbot-cli.jar
1 parent 7031656 commit fd7a8eb

File tree

1 file changed

+34
-7
lines changed

1 file changed

+34
-7
lines changed

.github/workflows/build-and-run-tests.yml

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,31 @@ jobs:
2121
java-version: '8'
2222
distribution: 'zulu'
2323
java-package: jdk+fx
24+
2425
- uses: gradle/gradle-build-action@v2
2526
with:
2627
gradle-version: 6.8
28+
29+
- name: Set project version
30+
run: echo "VERSION="$(date +%Y).$(date +%-m)"" >> $GITHUB_ENV
2731

2832
- name: Build and run tests in UTBot Java
2933
run: |
3034
export KOTLIN_HOME="/usr"
31-
gradle clean build --no-daemon
35+
gradle clean build --no-daemon -PsemVer=${{ env.VERSION }}
36+
37+
- name: Publish Test Results
38+
uses: EnricoMi/publish-unit-test-result-action@v1
39+
if: always()
40+
with:
41+
files: "**/build/test-results/**/*.xml"
42+
43+
- name: Cache utbot-cli-${{ env.VERSION }}.jar
44+
if: ${{ github.event_name != 'pull_request' }}
45+
uses: actions/cache@v3
46+
with:
47+
path: utbot-cli/build/libs/utbot-cli-${{ env.VERSION }}.jar
48+
key: utbot-cli
3249

3350
- name: Upload utbot-framework logs
3451
if: ${{ always() }}
@@ -44,12 +61,13 @@ jobs:
4461
name: utbot_framework_tests_report
4562
path: utbot-framework/build/reports/tests/test/*
4663

47-
- name: Upload utbot-intellij tests report artifacts if tests have failed
48-
if: ${{ failure() }}
49-
uses: actions/upload-artifact@v2
50-
with:
51-
name: utbot_intellij_tests_report
52-
path: utbot-intellij/build/reports/tests/test/*
64+
65+
publish_cli_image:
66+
needs: build_and_run_tests
67+
if: ${{ github.event_name != 'pull_request' }}
68+
runs-on: ubuntu-20.04
69+
steps:
70+
- uses: actions/checkout@v2
5371

5472
- name: Set timezone
5573
uses: szenius/set-timezone@v1.0
@@ -60,6 +78,12 @@ jobs:
6078
run: |
6179
echo "COMMIT_SHORT_SHA="$(git rev-parse --short HEAD)"" >> $GITHUB_ENV
6280
echo "VERSION="$(date +%Y).$(date +%-m)"" >> $GITHUB_ENV
81+
82+
- uses: actions/cache@v3
83+
with:
84+
path: utbot-cli/build/libs/utbot-cli-${{ env.VERSION }}.jar
85+
key: utbot-cli
86+
6387
- name: Set docker tag
6488
run:
6589
echo "DOCKER_TAG="$(date +%Y).$(date +%-m).$(date +%-d)-${{ env.COMMIT_SHORT_SHA }}"" >> $GITHUB_ENV
@@ -81,13 +105,15 @@ jobs:
81105
key: ${{ runner.os }}-buildx-${{ github.sha }}
82106
restore-keys: |
83107
${{ runner.os }}-buildx-
108+
84109
- name: Docker meta
85110
id: meta
86111
uses: docker/metadata-action@v3
87112
with:
88113
images: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.IMAGE_NAME }}
89114
tags: |
90115
type=raw,value=${{ env.DOCKER_TAG }}
116+
91117
- name: Docker Buildx (build and push)
92118
run: |
93119
docker buildx build \
@@ -100,6 +126,7 @@ jobs:
100126
# Temp fix
101127
# https://github.com/docker/build-push-action/issues/252
102128
# https://github.com/moby/buildkit/issues/1896
129+
103130
- name: Move cache
104131
run: |
105132
rm -rf /tmp/.buildx-cache

0 commit comments

Comments
 (0)