Skip to content

Commit dd1506e

Browse files
Publish python-, js- and go-cli on GitHub Actions #2235 (#2236)
* Update publish-plugin-and-cli-from-branch.yml * workflows rewrited to split plugin and cli building * fix artifact path * temporary upload artifacts * reverted from test to prod behavior --------- Co-authored-by: Egor Vasilyev <e.s.vasilyev@mail.ru>
1 parent d000195 commit dd1506e

File tree

3 files changed

+152
-57
lines changed

3 files changed

+152
-57
lines changed

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,17 @@ jobs:
1818
uses: ./.github/workflows/build-and-run-tests-from-branch.yml
1919
secrets: inherit
2020

21-
publish_plugin_and_cli:
21+
publish_plugin:
2222
needs: build-and-run-tests
23-
uses: ./.github/workflows/publish-plugin-and-cli-from-branch.yml
23+
uses: ./.github/workflows/publish-plugin-from-branch.yml
24+
with:
25+
# upload artifacts on push action to main only
26+
upload-artifact: ${{ github.event_name == 'push' }}
27+
secrets: inherit
28+
29+
publish_cli:
30+
needs: build-and-run-tests
31+
uses: ./.github/workflows/publish-cli-from-branch.yml
2432
with:
2533
# upload artifacts on push action to main only
2634
upload-artifact: ${{ github.event_name == 'push' }}
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: "[M] CLI: publish as archive"
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
upload-artifact:
7+
type: string
8+
description: "Upload artifacts or not"
9+
required: false
10+
default: false
11+
commit_sha:
12+
required: false
13+
type: string
14+
description: "(optional) Commit SHA"
15+
custom_version:
16+
type: string
17+
description: "Custom version"
18+
required: false
19+
default: ""
20+
21+
workflow_dispatch:
22+
inputs:
23+
upload-artifact:
24+
type: choice
25+
description: "Upload artifacts or not"
26+
required: false
27+
default: true
28+
options:
29+
- true
30+
- false
31+
commit_sha:
32+
required: false
33+
type: string
34+
description: "(optional) Commit SHA"
35+
custom_version:
36+
type: string
37+
description: "Custom version"
38+
required: false
39+
default: ""
40+
41+
jobs:
42+
publish_cli:
43+
strategy:
44+
fail-fast: false # force to execute all jobs even though some of them have failed
45+
matrix:
46+
configuration:
47+
- plugin_type: IC
48+
extra_options: "-PideType=IC"
49+
lang: java
50+
dir: utbot-cli
51+
- plugin_type: IC
52+
extra_options: "-PideType=IC"
53+
lang: python
54+
dir: utbot-cli-python
55+
- plugin_type: IU
56+
extra_options: "-PideType=IU"
57+
lang: go
58+
dir: utbot-cli-go
59+
- plugin_type: IU
60+
extra_options: "-PideType=IU"
61+
lang: js
62+
dir: utbot-cli-js
63+
runs-on: ubuntu-20.04
64+
container: unittestbot/java-env:java17-zulu-jdk-gradle7.6.1-kotlinc1.8.0
65+
steps:
66+
- uses: actions/checkout@v3
67+
- name: Check out ${{ github.event.inputs.commit_sha }} commit
68+
if: github.event.inputs.commit_sha != ''
69+
run: |
70+
git config --global --add safe.directory ${GITHUB_WORKSPACE}
71+
git fetch
72+
git checkout ${{ github.event.inputs.commit_sha }}
73+
74+
# "You can make an environment variable available to any subsequent steps in a workflow job by
75+
# defining or updating the environment variable and writing this to the GITHUB_ENV environment file."
76+
- name: Setup custom version
77+
if: ${{ github.event.inputs.custom_version != '' }}
78+
run: |
79+
echo "VERSION=${{ github.event.inputs.custom_version }}" >> $GITHUB_ENV
80+
- name: Setup version
81+
if: ${{ github.event.inputs.custom_version == '' }}
82+
shell: bash
83+
run: |
84+
echo "VERSION=${GITHUB_REF_NAME:0:4}-$(date +%Y).$(date +%-m).${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
85+
86+
- name: Print environment variables
87+
run: printenv
88+
89+
- name: Build UTBot CLI
90+
run: |
91+
cd "${{ matrix.configuration.dir }}"
92+
gradle clean build --no-daemon --build-cache --no-parallel ${{ matrix.configuration.extra_options }} -Dorg.gradle.jvmargs=-Xmx2g -Dkotlin.daemon.jvm.options=-Xmx4g -PsemVer=${{ env.VERSION }}
93+
94+
- name: Archive UTBot CLI
95+
if: ${{ inputs.upload-artifact == 'true' }}
96+
uses: actions/upload-artifact@v3
97+
with:
98+
name: utbot-cli-${{ matrix.configuration.lang }}-${{ env.VERSION }}
99+
path: ${{ matrix.configuration.dir }}/build/libs/${{ matrix.configuration.dir }}-${{ env.VERSION }}.jar
Lines changed: 43 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,56 @@
1-
name: "[M] Plugin and CLI: publish as archives"
1+
name: "[M] Plugin: publish as archive"
22

3-
on:
3+
on:
44
workflow_call:
55
inputs:
6-
upload-artifact:
7-
type: string
8-
description: "Upload artifacts or not"
9-
required: false
10-
default: false
11-
commit_sha:
12-
required: false
13-
type: string
14-
description: "(optional) Commit SHA"
15-
custom_version:
16-
type: string
17-
description: "Custom version"
18-
required: false
19-
default: ""
6+
upload-artifact:
7+
type: string
8+
description: "Upload artifacts or not"
9+
required: false
10+
default: false
11+
commit_sha:
12+
required: false
13+
type: string
14+
description: "(optional) Commit SHA"
15+
custom_version:
16+
type: string
17+
description: "Custom version"
18+
required: false
19+
default: ""
2020

2121
workflow_dispatch:
2222
inputs:
23-
upload-artifact:
24-
type: choice
25-
description: "Upload artifacts or not"
26-
required: false
27-
default: true
28-
options:
23+
upload-artifact:
24+
type: choice
25+
description: "Upload artifacts or not"
26+
required: false
27+
default: true
28+
options:
2929
- true
3030
- false
31-
commit_sha:
32-
required: false
33-
type: string
34-
description: "(optional) Commit SHA"
35-
custom_version:
36-
type: string
37-
description: "Custom version"
38-
required: false
39-
default: ""
31+
commit_sha:
32+
required: false
33+
type: string
34+
description: "(optional) Commit SHA"
35+
custom_version:
36+
type: string
37+
description: "Custom version"
38+
required: false
39+
default: ""
4040

4141
jobs:
42-
publish_plugin_and_cli:
43-
strategy:
44-
fail-fast: false # force to execute all jobs even though some of them have failed
45-
matrix:
46-
configuration:
47-
- plugin_type: IC
48-
extra_options: "-PideType=IC"
49-
- plugin_type: IU
50-
extra_options: "-PideType=IU"
51-
runs-on: ubuntu-20.04
52-
container: unittestbot/java-env:java17-zulu-jdk-gradle7.6.1-kotlinc1.8.0
53-
steps:
42+
publish_plugin_and_cli:
43+
strategy:
44+
fail-fast: false # force to execute all jobs even though some of them have failed
45+
matrix:
46+
configuration:
47+
- plugin_type: IC
48+
extra_options: "-PideType=IC"
49+
- plugin_type: IU
50+
extra_options: "-PideType=IU"
51+
runs-on: ubuntu-20.04
52+
container: unittestbot/java-env:java17-zulu-jdk-gradle7.6.1-kotlinc1.8.0
53+
steps:
5454
- uses: actions/checkout@v3
5555
- name: Check out ${{ github.event.inputs.commit_sha }} commit
5656
if: github.event.inputs.commit_sha != ''
@@ -87,15 +87,3 @@ jobs:
8787
with:
8888
name: utbot-intellij-${{ matrix.configuration.plugin_type }}-${{ env.VERSION }}
8989
path: utbot-intellij/build/distributions/*
90-
91-
- name: Build UTBot CLI
92-
run: |
93-
cd utbot-cli
94-
gradle clean build --no-daemon --build-cache --no-parallel -Dorg.gradle.jvmargs=-Xmx2g -Dkotlin.daemon.jvm.options=-Xmx4g -PsemVer=${{ env.VERSION }}
95-
96-
- name: Archive UTBot CLI
97-
if: ${{ inputs.upload-artifact == 'true' && matrix.configuration.plugin_type == 'IC' }}
98-
uses: actions/upload-artifact@v3
99-
with:
100-
name: utbot-cli-${{ env.VERSION }}
101-
path: utbot-cli/build/libs/utbot-cli-${{ env.VERSION }}.jar

0 commit comments

Comments
 (0)