Skip to content

Commit c0e9314

Browse files
Merge two build-and-run-tests
1 parent e663a5f commit c0e9314

File tree

1 file changed

+6
-67
lines changed

1 file changed

+6
-67
lines changed

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

Lines changed: 6 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
name: "UTBot Java: build and run tests"
1+
name: "[M] UTBot Java: build and run tests"
22

33
on:
4+
workflow_dispatch:
5+
46
push:
57
branches: [main]
68
pull_request:
@@ -42,7 +44,7 @@ jobs:
4244
chmod +x ./scripts/monitoring.sh
4345
./scripts/monitoring.sh ${{ secrets.PUSHGATEWAY_HOSTNAME }} ${{ secrets.PUSHGATEWAY_USER }} ${{ secrets.PUSHGATEWAY_PASSWORD }}
4446
- name: Run tests
45-
run: |
47+
run: |
4648
gradle --no-daemon :utbot-framework:test ${{ matrix.project.TESTS_TO_RUN }}
4749
4850
- name: Upload logs
@@ -87,78 +89,15 @@ jobs:
8789
echo Find your Prometheus metrics using label {instance=\"${GITHUB_RUN_ID}-${HOSTNAME}\"}
8890
chmod +x ./scripts/monitoring.sh
8991
./scripts/monitoring.sh ${{ secrets.PUSHGATEWAY_HOSTNAME }} ${{ secrets.PUSHGATEWAY_USER }} ${{ secrets.PUSHGATEWAY_PASSWORD }}
92+
9093
- name: Run tests
9194
run: |
9295
cd ${{ matrix.project }}
9396
gradle build --no-daemon
97+
9498
- name: Upload test report if tests have failed
9599
if: ${{ failure() }}
96100
uses: actions/upload-artifact@v3
97101
with:
98102
name: test_report ${{ matrix.project }}
99103
path: ${{ matrix.project }}/build/reports/tests/test/*
100-
101-
publish-cli-image:
102-
needs: framework
103-
if: ${{ github.event_name == 'push' }}
104-
runs-on: ubuntu-20.04
105-
container: unittestbot/java-env:java11-zulu-jdk-fx-gradle7.4.2-kotlinc1.7.0
106-
steps:
107-
- uses: actions/checkout@v3
108-
109-
- name: Set environment variables
110-
run: |
111-
echo COMMIT_SHORT_SHA="$(git rev-parse --short HEAD)" >> $GITHUB_ENV
112-
echo VERSION="$(date +%Y).$(date +%-m)" >> $GITHUB_ENV
113-
114-
- name: Build UTBot Java CLI
115-
run: |
116-
cd utbot-cli
117-
gradle build --no-daemon -x test -PsemVer=${{ env.VERSION }}
118-
- name: Set docker tag
119-
run:
120-
echo DOCKER_TAG="$(date +%Y).$(date +%-m).$(date +%-d)-${{ env.COMMIT_SHORT_SHA }}" >> $GITHUB_ENV
121-
122-
- name: Log in to the Container registry
123-
uses: docker/login-action@v2
124-
with:
125-
registry: ${{ env.REGISTRY }}
126-
username: ${{ github.actor }}
127-
password: ${{ secrets.GITHUB_TOKEN }}
128-
129-
- name: Set up Docker Buildx
130-
uses: docker/setup-buildx-action@v2
131-
132-
- name: Cache Docker layers
133-
uses: actions/cache@v3
134-
with:
135-
path: /tmp/.buildx-cache
136-
key: ${{ runner.os }}-buildx-${{ github.sha }}
137-
restore-keys: |
138-
${{ runner.os }}-buildx-
139-
140-
- name: Docker meta
141-
id: meta
142-
uses: docker/metadata-action@v3
143-
with:
144-
images: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.IMAGE_NAME }}
145-
tags: |
146-
type=raw,value=${{ env.DOCKER_TAG }}
147-
148-
- name: Docker Buildx (build and push)
149-
run: |
150-
docker buildx build \
151-
-f ${{ env.DOCKERFILE_PATH }} \
152-
--cache-from "type=local,src=/tmp/.buildx-cache" \
153-
--cache-to "type=local,dest=/tmp/.buildx-cache-new" \
154-
--tag ${{ steps.meta.outputs.tags }} \
155-
--build-arg UTBOT_JAVA_CLI=utbot-cli/build/libs/utbot-cli-${{ env.VERSION }}.jar \
156-
--push .
157-
# Temp fix
158-
# https://github.com/docker/build-push-action/issues/252
159-
# https://github.com/moby/buildkit/issues/1896
160-
161-
- name: Move cache
162-
run: |
163-
rm -rf /tmp/.buildx-cache
164-
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

0 commit comments

Comments
 (0)