Skip to content

Commit 1ba5bcc

Browse files
Make possible running chosen tests closes #76 (#77)
1 parent d1bb082 commit 1ba5bcc

File tree

4 files changed

+80
-11
lines changed

4 files changed

+80
-11
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "UTBot Java: build and run tests"
1+
name: "[M] UTBot Java: build and run tests"
22

33
on:
44
workflow_dispatch
@@ -13,6 +13,7 @@ jobs:
1313
java-version: '8'
1414
distribution: 'zulu'
1515
java-package: jdk+fx
16+
cache: gradle
1617
- uses: gradle/gradle-build-action@v2
1718
with:
1819
gradle-version: 6.8

.github/workflows/publish-on-github-packages.yml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
name: "[M] Publish on GitHub Packages"
22

3-
on: workflow_dispatch
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
commit-sha:
7+
type: string
8+
required: true
9+
description: "commit SHA: e.g. cab4799c"
410

511
jobs:
612
build_and_run_tests:
@@ -38,7 +44,7 @@ jobs:
3844
name: utbot_framework_tests_report
3945
path: utbot-framework/build/reports/tests/test/*
4046

41-
publish_framework-api_and_dependencies:
47+
publish_utbot:
4248
needs: build_and_run_tests
4349
runs-on: ubuntu-20.04
4450
permissions:
@@ -60,21 +66,22 @@ jobs:
6066
GITHUB_ACTOR: ${{ github.actor }}
6167
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6268

63-
- name: Set project version
64-
run:
65-
echo "VERSION="$(date +%Y).$(date +%-m)"" >> $GITHUB_ENV
66-
69+
- name: Check out ${{ github.event.inputs.commit-sha }} commit
70+
run: |
71+
git fetch
72+
git checkout ${{ github.event.inputs.commit-sha }}
73+
6774
- name: "utbot-framework-api: build and run tests"
6875
run: |
6976
cd utbot-framework-api
70-
gradle clean build --no-daemon -PsemVer=${{ env.VERSION }}-SNAPSHOT
77+
gradle clean build --no-daemon
7178
7279
- name: "utbot-api: build"
7380
run: |
7481
cd utbot-api
75-
gradle clean build --no-daemon -PsemVer=${{ env.VERSION }}-SNAPSHOT
82+
gradle clean build --no-daemon
7683
7784
- name: "utbot-core: build"
7885
run: |
7986
cd utbot-core
80-
gradle clean build --no-daemon -PsemVer=${{ env.VERSION }}-SNAPSHOT
87+
gradle clean build --no-daemon

.github/workflows/publish-plugin-and-cli-from-branch.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "Plugin and CLI: publish as archives"
1+
name: "[M] Plugin and CLI: publish as archives"
22

33
on:
44
workflow_dispatch:
@@ -24,6 +24,7 @@ jobs:
2424
java-version: '8'
2525
distribution: 'zulu'
2626
java-package: jdk+fx
27+
cache: gradle
2728
- uses: gradle/gradle-build-action@v2
2829
with:
2930
gradle-version: 6.8
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
2+
name: "[M] Run chosen tests"
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
project-name:
8+
type: choice
9+
description: "Project you want to run tests for."
10+
required: true
11+
default: utbot-framework
12+
options:
13+
- utbot-analytics
14+
- utbot-cli
15+
- utbot-framework-api
16+
- utbot-framework
17+
- utbot-fuzzers
18+
- utbot-gradle
19+
- utbot-instrumentation-tests
20+
- utbot-instrumentation
21+
- utbot-intellij
22+
tests-bunch-name:
23+
type: string
24+
required: true
25+
description: "{package-name}.{class-name}.{test-name-optional}"
26+
27+
jobs:
28+
run-chosen-tests:
29+
runs-on: ubuntu-20.04
30+
31+
steps:
32+
- uses: actions/checkout@v2
33+
- uses: actions/setup-java@v2
34+
with:
35+
java-version: '8'
36+
distribution: 'zulu'
37+
java-package: jdk+fx
38+
cache: gradle
39+
- uses: gradle/gradle-build-action@v2
40+
with:
41+
gradle-version: 6.8
42+
43+
- name: Run chosen tests
44+
run: |
45+
export KOTLIN_HOME="/usr"
46+
gradle :${{ github.event.inputs.project-name }}:test --tests ${{ github.event.inputs.tests-bunch-name }}
47+
48+
- name: Upload ${{ github.event.inputs.project-name }} tests report if tests have failed
49+
if: ${{ failure() }}
50+
uses: actions/upload-artifact@v2
51+
with:
52+
name: ${{ github.event.inputs.project-name }}-tests-report
53+
path: ${{ github.event.inputs.project-name }}/build/reports/tests/test/*
54+
55+
- name: Upload utbot-framework logs if utbot-framework tests have failed
56+
if: ${{ failure() || (github.event.inputs.project-name == 'utbot-framework') }}
57+
uses: actions/upload-artifact@v2
58+
with:
59+
name: utbot_framework_logs
60+
path: utbot-framework/logs/*

0 commit comments

Comments
 (0)