Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .github/workflows/build-and-run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,17 @@ jobs:
uses: ./.github/workflows/build-and-run-tests-from-branch.yml
secrets: inherit

publish_plugin_and_cli:
publish_plugin:
needs: build-and-run-tests
uses: ./.github/workflows/publish-plugin-and-cli-from-branch.yml
uses: ./.github/workflows/publish-plugin-from-branch.yml
with:
# upload artifacts on push action to main only
upload-artifact: ${{ github.event_name == 'push' }}
secrets: inherit

publish_cli:
needs: build-and-run-tests
uses: ./.github/workflows/publish-cli-from-branch.yml
with:
# upload artifacts on push action to main only
upload-artifact: ${{ github.event_name == 'push' }}
Expand Down
99 changes: 99 additions & 0 deletions .github/workflows/publish-cli-from-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: "[M] CLI: publish as archive"

on:
workflow_call:
inputs:
upload-artifact:
type: string
description: "Upload artifacts or not"
required: false
default: false
commit_sha:
required: false
type: string
description: "(optional) Commit SHA"
custom_version:
type: string
description: "Custom version"
required: false
default: ""

workflow_dispatch:
inputs:
upload-artifact:
type: choice
description: "Upload artifacts or not"
required: false
default: true
options:
- true
- false
commit_sha:
required: false
type: string
description: "(optional) Commit SHA"
custom_version:
type: string
description: "Custom version"
required: false
default: ""

jobs:
publish_cli:
strategy:
fail-fast: false # force to execute all jobs even though some of them have failed
matrix:
configuration:
- plugin_type: IC
extra_options: "-PideType=IC"
lang: java
dir: utbot-cli
- plugin_type: IC
extra_options: "-PideType=IC"
lang: python
dir: utbot-cli-python
- plugin_type: IU
extra_options: "-PideType=IU"
lang: go
dir: utbot-cli-go
- plugin_type: IU
extra_options: "-PideType=IU"
lang: js
dir: utbot-cli-js
runs-on: ubuntu-20.04
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's possible to update Ubuntu version

container: unittestbot/java-env:java17-zulu-jdk-gradle7.6.1-kotlinc1.8.0
steps:
- uses: actions/checkout@v3
- name: Check out ${{ github.event.inputs.commit_sha }} commit
if: github.event.inputs.commit_sha != ''
run: |
git config --global --add safe.directory ${GITHUB_WORKSPACE}
git fetch
git checkout ${{ github.event.inputs.commit_sha }}

# "You can make an environment variable available to any subsequent steps in a workflow job by
# defining or updating the environment variable and writing this to the GITHUB_ENV environment file."
- name: Setup custom version
if: ${{ github.event.inputs.custom_version != '' }}
run: |
echo "VERSION=${{ github.event.inputs.custom_version }}" >> $GITHUB_ENV
- name: Setup version
if: ${{ github.event.inputs.custom_version == '' }}
shell: bash
run: |
echo "VERSION=${GITHUB_REF_NAME:0:4}-$(date +%Y).$(date +%-m).${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV

- name: Print environment variables
run: printenv

- name: Build UTBot CLI
run: |
cd "${{ matrix.configuration.dir }}"
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 }}

- name: Archive UTBot CLI
if: ${{ inputs.upload-artifact == 'true' }}
uses: actions/upload-artifact@v3
with:
name: utbot-cli-${{ matrix.configuration.lang }}-${{ env.VERSION }}
path: ${{ matrix.configuration.dir }}/build/libs/${{ matrix.configuration.dir }}-${{ env.VERSION }}.jar
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
name: "[M] Plugin and CLI: publish as archives"
name: "[M] Plugin: publish as archive"

on:
on:
workflow_call:
inputs:
upload-artifact:
type: string
description: "Upload artifacts or not"
required: false
default: false
commit_sha:
required: false
type: string
description: "(optional) Commit SHA"
custom_version:
type: string
description: "Custom version"
required: false
default: ""
upload-artifact:
type: string
description: "Upload artifacts or not"
required: false
default: false
commit_sha:
required: false
type: string
description: "(optional) Commit SHA"
custom_version:
type: string
description: "Custom version"
required: false
default: ""

workflow_dispatch:
inputs:
upload-artifact:
type: choice
description: "Upload artifacts or not"
required: false
default: true
options:
upload-artifact:
type: choice
description: "Upload artifacts or not"
required: false
default: true
options:
- true
- false
commit_sha:
required: false
type: string
description: "(optional) Commit SHA"
custom_version:
type: string
description: "Custom version"
required: false
default: ""
commit_sha:
required: false
type: string
description: "(optional) Commit SHA"
custom_version:
type: string
description: "Custom version"
required: false
default: ""

jobs:
publish_plugin_and_cli:
strategy:
fail-fast: false # force to execute all jobs even though some of them have failed
matrix:
configuration:
- plugin_type: IC
extra_options: "-PideType=IC"
- plugin_type: IU
extra_options: "-PideType=IU"
runs-on: ubuntu-20.04
container: unittestbot/java-env:java17-zulu-jdk-gradle7.6.1-kotlinc1.8.0
steps:
publish_plugin_and_cli:
strategy:
fail-fast: false # force to execute all jobs even though some of them have failed
matrix:
configuration:
- plugin_type: IC
extra_options: "-PideType=IC"
- plugin_type: IU
extra_options: "-PideType=IU"
runs-on: ubuntu-20.04
container: unittestbot/java-env:java17-zulu-jdk-gradle7.6.1-kotlinc1.8.0
steps:
- uses: actions/checkout@v3
- name: Check out ${{ github.event.inputs.commit_sha }} commit
if: github.event.inputs.commit_sha != ''
Expand Down Expand Up @@ -87,15 +87,3 @@ jobs:
with:
name: utbot-intellij-${{ matrix.configuration.plugin_type }}-${{ env.VERSION }}
path: utbot-intellij/build/distributions/*

- name: Build UTBot CLI
run: |
cd utbot-cli
gradle clean build --no-daemon --build-cache --no-parallel -Dorg.gradle.jvmargs=-Xmx2g -Dkotlin.daemon.jvm.options=-Xmx4g -PsemVer=${{ env.VERSION }}

- name: Archive UTBot CLI
if: ${{ inputs.upload-artifact == 'true' && matrix.configuration.plugin_type == 'IC' }}
uses: actions/upload-artifact@v3
with:
name: utbot-cli-${{ env.VERSION }}
path: utbot-cli/build/libs/utbot-cli-${{ env.VERSION }}.jar