From 301f65aa1a27776c417ad2d4825319c8c496c3f9 Mon Sep 17 00:00:00 2001 From: Egor Vasilyev Date: Tue, 21 Feb 2023 15:45:22 +0300 Subject: [PATCH 01/10] try to build ultimate plugin on pr event #1836 --- .github/workflows/build-and-run-tests.yml | 7 ++++ .../publish-plugin-and-cli-from-branch.yml | 34 ++++++++++++------- .github/workflows/publish-plugin-and-cli.yml | 1 + 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-and-run-tests.yml b/.github/workflows/build-and-run-tests.yml index 843276f715..92a8322fd5 100644 --- a/.github/workflows/build-and-run-tests.yml +++ b/.github/workflows/build-and-run-tests.yml @@ -20,6 +20,13 @@ jobs: uses: ./.github/workflows/build-and-run-tests-from-branch.yml secrets: inherit + publish_plugin_and_cli: + needs: build-and-run-tests + uses: ./.github/workflows/publish-plugin-and-cli-from-branch.yml + with: + minor-release: 'none' + upload-artifact: false + secrets: inherit publish-cli-image: needs: build-and-run-tests diff --git a/.github/workflows/publish-plugin-and-cli-from-branch.yml b/.github/workflows/publish-plugin-and-cli-from-branch.yml index 7255c32a37..95bddf6d4b 100644 --- a/.github/workflows/publish-plugin-and-cli-from-branch.yml +++ b/.github/workflows/publish-plugin-and-cli-from-branch.yml @@ -8,12 +8,16 @@ on: description: "It adds minor release indicator to version." required: false default: 'none' - version-postfix: type: string description: "It adds postfix (alpha or beta) to version (optional)." required: false default: no-postfix + upload-artifact: + type: boolean + description: "Upload artifacts or not" + required: false + default: false workflow_dispatch: inputs: @@ -28,7 +32,6 @@ on: - '2' - '3' - '4' - version-postfix: type: choice description: "It adds alpha or beta postfix to version." @@ -42,45 +45,49 @@ on: 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:java11-zulu-jdk-gradle7.4.2-kotlinc1.7.0 - steps: - - name: Print environment variables - run: printenv - - uses: actions/checkout@v3 + # "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: Set environment variables run: | - # "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." echo "VERSION="$(date +%Y).$(date +%-m).${GITHUB_RUN_NUMBER}"" >> $GITHUB_ENV echo "POSTFIX=${{ github.event.inputs.version-postfix }}" >> $GITHUB_ENV - - name: Set production version if: ${{ github.event.inputs.version-postfix == 'no-postfix-prod' || github.event.inputs.version-postfix == 'alpha' || github.event.inputs.version-postfix == 'beta' }} run: | echo "VERSION="$(date +%Y).$(date +%-m)"" >> $GITHUB_ENV - - name: Set version for minor release if: ${{ github.event.inputs.minor-release != 'none' }} run: | echo "VERSION=${{ env.VERSION }}.${{ github.event.inputs.minor-release }}" >> $GITHUB_ENV - - name: Create version with postfix if: ${{ (env.POSTFIX == 'alpha') || (env.POSTFIX == 'beta') }} run: echo "VERSION=${{ env.VERSION }}-${{ env.POSTFIX }}" >> $GITHUB_ENV + - name: Print environment variables + run: printenv - name: Build UTBot IntelliJ IDEA plugin run: | - gradle clean buildPlugin --no-daemon --build-cache --no-parallel -Dorg.gradle.jvmargs=-Xmx2g -Dkotlin.daemon.jvm.options=-Xmx4g -PsemVer=${{ env.VERSION }} + gradle clean buildPlugin --no-daemon --build-cache --no-parallel ${{ matrix.configuration.extra_options }} -Dorg.gradle.jvmargs=-Xmx2g -Dkotlin.daemon.jvm.options=-Xmx4g -PsemVer=${{ env.VERSION }} cd utbot-intellij/build/distributions unzip utbot-intellij-${{ env.VERSION }}.zip rm utbot-intellij-${{ env.VERSION }}.zip - name: Archive UTBot IntelliJ IDEA plugin + if: ${{ github.event.inputs.upload-artifact == 'true' && matrix.configuration.plugin_type == 'IC' }} uses: actions/upload-artifact@v3 with: name: utbot-intellij-${{ env.VERSION }} @@ -90,8 +97,9 @@ jobs: 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: ${{ github.event.inputs.upload-artifact == 'true' && matrix.configuration.plugin_type == 'IC' }} uses: actions/upload-artifact@v3 with: name: utbot-cli-${{ env.VERSION }} diff --git a/.github/workflows/publish-plugin-and-cli.yml b/.github/workflows/publish-plugin-and-cli.yml index 25100f00d7..36bf5e059d 100644 --- a/.github/workflows/publish-plugin-and-cli.yml +++ b/.github/workflows/publish-plugin-and-cli.yml @@ -10,4 +10,5 @@ jobs: uses: ./.github/workflows/publish-plugin-and-cli-from-branch.yml with: minor-release: 'none' + upload-artifact: true secrets: inherit From d50c48832ce02d06467ffa1bfa586f6e89a36f43 Mon Sep 17 00:00:00 2001 From: Egor Vasilyev Date: Wed, 22 Feb 2023 09:21:31 +0300 Subject: [PATCH 02/10] check upload artifacts --- .github/workflows/build-and-run-tests.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-and-run-tests.yml b/.github/workflows/build-and-run-tests.yml index 92a8322fd5..a3ad82e161 100644 --- a/.github/workflows/build-and-run-tests.yml +++ b/.github/workflows/build-and-run-tests.yml @@ -16,20 +16,21 @@ env: DOCKERFILE_PATH: docker/Dockerfile_java_cli jobs: - build-and-run-tests: - uses: ./.github/workflows/build-and-run-tests-from-branch.yml - secrets: inherit +# build-and-run-tests: +# uses: ./.github/workflows/build-and-run-tests-from-branch.yml +# secrets: inherit publish_plugin_and_cli: - needs: build-and-run-tests +# needs: build-and-run-tests uses: ./.github/workflows/publish-plugin-and-cli-from-branch.yml with: minor-release: 'none' - upload-artifact: false + upload-artifact: true +# upload-artifact: false secrets: inherit publish-cli-image: - needs: build-and-run-tests +# needs: build-and-run-tests if: ${{ github.event_name == 'push' }} runs-on: ubuntu-20.04 container: unittestbot/java-env:java11-zulu-jdk-gradle7.4.2-kotlinc1.7.0 From a40904e8a164169c3ba336ce2b8cec6b6a68ccca Mon Sep 17 00:00:00 2001 From: Egor Vasilyev Date: Wed, 22 Feb 2023 09:49:00 +0300 Subject: [PATCH 03/10] switch bool input to string --- .github/workflows/publish-plugin-and-cli-from-branch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-plugin-and-cli-from-branch.yml b/.github/workflows/publish-plugin-and-cli-from-branch.yml index 95bddf6d4b..865d53b633 100644 --- a/.github/workflows/publish-plugin-and-cli-from-branch.yml +++ b/.github/workflows/publish-plugin-and-cli-from-branch.yml @@ -14,7 +14,7 @@ on: required: false default: no-postfix upload-artifact: - type: boolean + type: string description: "Upload artifacts or not" required: false default: false From 08021dc1b1ff86c8de13b34640a94ae2b8fd93ba Mon Sep 17 00:00:00 2001 From: Egor Vasilyev Date: Wed, 22 Feb 2023 12:16:55 +0300 Subject: [PATCH 04/10] fix inputs --- .../workflows/publish-plugin-and-cli-from-branch.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-plugin-and-cli-from-branch.yml b/.github/workflows/publish-plugin-and-cli-from-branch.yml index 865d53b633..a04dfe4621 100644 --- a/.github/workflows/publish-plugin-and-cli-from-branch.yml +++ b/.github/workflows/publish-plugin-and-cli-from-branch.yml @@ -42,6 +42,14 @@ on: - no-postfix - alpha - beta + upload-artifact: + type: choice + description: "Upload artifacts or not" + required: false + default: false + options: + - true + - false jobs: publish_plugin_and_cli: @@ -87,7 +95,7 @@ jobs: rm utbot-intellij-${{ env.VERSION }}.zip - name: Archive UTBot IntelliJ IDEA plugin - if: ${{ github.event.inputs.upload-artifact == 'true' && matrix.configuration.plugin_type == 'IC' }} + if: ${{ inputs.upload-artifact == 'true' && matrix.configuration.plugin_type == 'IC' }} uses: actions/upload-artifact@v3 with: name: utbot-intellij-${{ env.VERSION }} @@ -99,7 +107,7 @@ jobs: 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: ${{ github.event.inputs.upload-artifact == 'true' && matrix.configuration.plugin_type == 'IC' }} + if: ${{ inputs.upload-artifact == 'true' && matrix.configuration.plugin_type == 'IC' }} uses: actions/upload-artifact@v3 with: name: utbot-cli-${{ env.VERSION }} From 3547a34560d496e5ba2ba8ce9d48556407f297b4 Mon Sep 17 00:00:00 2001 From: Egor Vasilyev Date: Wed, 22 Feb 2023 13:35:49 +0300 Subject: [PATCH 05/10] switched to prod version --- .github/workflows/build-and-run-tests.yml | 21 +++++++++++++------ .../publish-plugin-and-cli-from-branch.yml | 4 ++-- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-and-run-tests.yml b/.github/workflows/build-and-run-tests.yml index a3ad82e161..37b2539fb6 100644 --- a/.github/workflows/build-and-run-tests.yml +++ b/.github/workflows/build-and-run-tests.yml @@ -16,21 +16,30 @@ env: DOCKERFILE_PATH: docker/Dockerfile_java_cli jobs: -# build-and-run-tests: -# uses: ./.github/workflows/build-and-run-tests-from-branch.yml -# secrets: inherit + build-and-run-tests: + uses: ./.github/workflows/build-and-run-tests-from-branch.yml + secrets: inherit publish_plugin_and_cli: -# needs: build-and-run-tests + needs: build-and-run-tests + if: ${{ github.event_name != 'push' }} + uses: ./.github/workflows/publish-plugin-and-cli-from-branch.yml + with: + minor-release: 'none' + upload-artifact: false + secrets: inherit + + publish_plugin_and_cli_main: + needs: build-and-run-tests + if: ${{ github.event_name == 'push' }} uses: ./.github/workflows/publish-plugin-and-cli-from-branch.yml with: minor-release: 'none' upload-artifact: true -# upload-artifact: false secrets: inherit publish-cli-image: -# needs: build-and-run-tests + needs: build-and-run-tests if: ${{ github.event_name == 'push' }} runs-on: ubuntu-20.04 container: unittestbot/java-env:java11-zulu-jdk-gradle7.4.2-kotlinc1.7.0 diff --git a/.github/workflows/publish-plugin-and-cli-from-branch.yml b/.github/workflows/publish-plugin-and-cli-from-branch.yml index a04dfe4621..bea5b55042 100644 --- a/.github/workflows/publish-plugin-and-cli-from-branch.yml +++ b/.github/workflows/publish-plugin-and-cli-from-branch.yml @@ -48,8 +48,8 @@ on: required: false default: false options: - - true - - false + - true + - false jobs: publish_plugin_and_cli: From 8d45f3c979fe7a2eaeb85aa33244865b66f60fc5 Mon Sep 17 00:00:00 2001 From: Egor Vasilyev Date: Wed, 22 Feb 2023 13:39:39 +0300 Subject: [PATCH 06/10] publish-plugin-and-cli workflow removed --- .github/workflows/publish-plugin-and-cli.yml | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 .github/workflows/publish-plugin-and-cli.yml diff --git a/.github/workflows/publish-plugin-and-cli.yml b/.github/workflows/publish-plugin-and-cli.yml deleted file mode 100644 index 36bf5e059d..0000000000 --- a/.github/workflows/publish-plugin-and-cli.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: "Plugin and CLI: publish as archives" -on: - push: - branches: - - 'main' - - 'unit-test-bot/r**' - -jobs: - publish_plugin_and_cli: - uses: ./.github/workflows/publish-plugin-and-cli-from-branch.yml - with: - minor-release: 'none' - upload-artifact: true - secrets: inherit From dc5affd6b19d59157c379dc845f3164b02973d9f Mon Sep 17 00:00:00 2001 From: Egor Vasilyev Date: Mon, 27 Feb 2023 09:45:07 +0300 Subject: [PATCH 07/10] add default true for dispath --- .github/workflows/publish-plugin-and-cli-from-branch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-plugin-and-cli-from-branch.yml b/.github/workflows/publish-plugin-and-cli-from-branch.yml index bea5b55042..4e6bc51914 100644 --- a/.github/workflows/publish-plugin-and-cli-from-branch.yml +++ b/.github/workflows/publish-plugin-and-cli-from-branch.yml @@ -46,7 +46,7 @@ on: type: choice description: "Upload artifacts or not" required: false - default: false + default: true options: - true - false From 4843c0b967e7b72fb0747fd5841296b9c5d2f06f Mon Sep 17 00:00:00 2001 From: Egor Vasilyev Date: Mon, 27 Feb 2023 12:00:15 +0300 Subject: [PATCH 08/10] check conditional, reduce repeatable block --- .github/workflows/build-and-run-tests.yml | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build-and-run-tests.yml b/.github/workflows/build-and-run-tests.yml index 37b2539fb6..7fab352bd8 100644 --- a/.github/workflows/build-and-run-tests.yml +++ b/.github/workflows/build-and-run-tests.yml @@ -16,30 +16,21 @@ env: DOCKERFILE_PATH: docker/Dockerfile_java_cli jobs: - build-and-run-tests: - uses: ./.github/workflows/build-and-run-tests-from-branch.yml - secrets: inherit +# build-and-run-tests: +# uses: ./.github/workflows/build-and-run-tests-from-branch.yml +# secrets: inherit publish_plugin_and_cli: - needs: build-and-run-tests - if: ${{ github.event_name != 'push' }} - uses: ./.github/workflows/publish-plugin-and-cli-from-branch.yml - with: - minor-release: 'none' - upload-artifact: false - secrets: inherit - - publish_plugin_and_cli_main: - needs: build-and-run-tests +# needs: build-and-run-tests if: ${{ github.event_name == 'push' }} uses: ./.github/workflows/publish-plugin-and-cli-from-branch.yml with: minor-release: 'none' - upload-artifact: true + upload-artifact: ${{ github.event_name != 'push' }} secrets: inherit publish-cli-image: - needs: build-and-run-tests +# needs: build-and-run-tests if: ${{ github.event_name == 'push' }} runs-on: ubuntu-20.04 container: unittestbot/java-env:java11-zulu-jdk-gradle7.4.2-kotlinc1.7.0 From 67cb0521af8d3684d703d240968f7fb3fae1fb0f Mon Sep 17 00:00:00 2001 From: Egor Vasilyev Date: Mon, 27 Feb 2023 12:02:19 +0300 Subject: [PATCH 09/10] comment if condition --- .github/workflows/build-and-run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-run-tests.yml b/.github/workflows/build-and-run-tests.yml index 7fab352bd8..f2baaa197b 100644 --- a/.github/workflows/build-and-run-tests.yml +++ b/.github/workflows/build-and-run-tests.yml @@ -22,7 +22,7 @@ jobs: publish_plugin_and_cli: # needs: build-and-run-tests - if: ${{ github.event_name == 'push' }} +# if: ${{ github.event_name == 'push' }} uses: ./.github/workflows/publish-plugin-and-cli-from-branch.yml with: minor-release: 'none' From 337fa0ffaf7da7a29a964d32a5353360c5cf0927 Mon Sep 17 00:00:00 2001 From: Egor Vasilyev Date: Mon, 27 Feb 2023 12:23:23 +0300 Subject: [PATCH 10/10] new scheme works --- .github/workflows/build-and-run-tests.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-and-run-tests.yml b/.github/workflows/build-and-run-tests.yml index f2baaa197b..328b225625 100644 --- a/.github/workflows/build-and-run-tests.yml +++ b/.github/workflows/build-and-run-tests.yml @@ -16,21 +16,21 @@ env: DOCKERFILE_PATH: docker/Dockerfile_java_cli jobs: -# build-and-run-tests: -# uses: ./.github/workflows/build-and-run-tests-from-branch.yml -# secrets: inherit + build-and-run-tests: + uses: ./.github/workflows/build-and-run-tests-from-branch.yml + secrets: inherit publish_plugin_and_cli: -# needs: build-and-run-tests -# if: ${{ github.event_name == 'push' }} + needs: build-and-run-tests uses: ./.github/workflows/publish-plugin-and-cli-from-branch.yml with: minor-release: 'none' - upload-artifact: ${{ github.event_name != 'push' }} + # upload artifacts on push action to main only + upload-artifact: ${{ github.event_name == 'push' }} secrets: inherit publish-cli-image: -# needs: build-and-run-tests + needs: build-and-run-tests if: ${{ github.event_name == 'push' }} runs-on: ubuntu-20.04 container: unittestbot/java-env:java11-zulu-jdk-gradle7.4.2-kotlinc1.7.0