From ccdc9ccde9ee64521a3be6f4e95d2b4562748c12 Mon Sep 17 00:00:00 2001 From: Victoria <32179813+victoriafomina@users.noreply.github.com> Date: Thu, 1 Jun 2023 17:42:43 +0300 Subject: [PATCH 1/5] Add Dockerfile for Go CLI --- utbot-cli-go/Dockerfile | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 utbot-cli-go/Dockerfile diff --git a/utbot-cli-go/Dockerfile b/utbot-cli-go/Dockerfile new file mode 100644 index 0000000000..2f174c5e09 --- /dev/null +++ b/utbot-cli-go/Dockerfile @@ -0,0 +1,41 @@ +FROM azul/zulu-openjdk:11.0.15-11.56.19 + +ARG UTBOT_GO_CLI + +WORKDIR /usr/src/ + +# Install UTBot Go CLI + +ARG UTBOT_GO_CLI +ARG CREATE_GO_MODULE_SCRIPT + +WORKDIR /usr/src/ + +COPY ${UTBOT_GO_CLI} . +COPY ${CREATE_GO_MODULE_SCRIPT} . + +# Install Go +RUN apt-get update && \ + apt-get install -y wget && \ + # Install Go + wget https://go.dev/dl/go1.19.linux-amd64.tar.gz && \ + tar -xvf go1.19.linux-amd64.tar.gz && \ + mv go /usr/local && \ + rm go1.19.linux-amd64.tar.gz && \ + apt-get clean + +# Install gcc +RUN apt-get update \ + && apt-get install -y build-essential \ + software-properties-common \ + && add-apt-repository -y ppa:ubuntu-toolchain-r/test \ + && apt-get install -y gcc-9 \ + && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 60 \ + && update-alternatives --config gcc \ + && apt-get clean + +ENV GOROOT /usr/local/go +ENV PATH $GOPATH/bin:$GOROOT/bin:$PATH + +RUN UTBOT_GO_CLI_PATH="$(find /usr/src -type f -name 'utbot-cli*')" \ + && ln -s "${UTBOT_GO_CLI_PATH}" /usr/src/utbot-cli.jar \ No newline at end of file From d28b41fb51bdde958dc8afb4c9e6296f167bd406 Mon Sep 17 00:00:00 2001 From: Victoria <32179813+victoriafomina@users.noreply.github.com> Date: Thu, 1 Jun 2023 17:44:14 +0300 Subject: [PATCH 2/5] Add create_go_mod.sh The file is used in Dockerfile for Go CLI --- utbot-cli-go/create_go_mod.sh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 utbot-cli-go/create_go_mod.sh diff --git a/utbot-cli-go/create_go_mod.sh b/utbot-cli-go/create_go_mod.sh new file mode 100644 index 0000000000..4d04d5c255 --- /dev/null +++ b/utbot-cli-go/create_go_mod.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +WORKING_DIRECTORY=$1 +cd $WORKING_DIRECTORY +go mod init simple +go get github.com/stretchr/testify/assert +cd /usr/src From a974996348ab2fcc4c36d0f345ddeb5bfa4260b2 Mon Sep 17 00:00:00 2001 From: Victoria <32179813+victoriafomina@users.noreply.github.com> Date: Thu, 1 Jun 2023 17:45:38 +0300 Subject: [PATCH 3/5] Update comment in Dockerfile for Go CLI --- utbot-cli-go/Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/utbot-cli-go/Dockerfile b/utbot-cli-go/Dockerfile index 2f174c5e09..a5b965e124 100644 --- a/utbot-cli-go/Dockerfile +++ b/utbot-cli-go/Dockerfile @@ -17,7 +17,6 @@ COPY ${CREATE_GO_MODULE_SCRIPT} . # Install Go RUN apt-get update && \ apt-get install -y wget && \ - # Install Go wget https://go.dev/dl/go1.19.linux-amd64.tar.gz && \ tar -xvf go1.19.linux-amd64.tar.gz && \ mv go /usr/local && \ @@ -38,4 +37,4 @@ ENV GOROOT /usr/local/go ENV PATH $GOPATH/bin:$GOROOT/bin:$PATH RUN UTBOT_GO_CLI_PATH="$(find /usr/src -type f -name 'utbot-cli*')" \ - && ln -s "${UTBOT_GO_CLI_PATH}" /usr/src/utbot-cli.jar \ No newline at end of file + && ln -s "${UTBOT_GO_CLI_PATH}" /usr/src/utbot-cli.jar From d6449d704b65e06ce2ff27ab2b81fa0f0bc8375b Mon Sep 17 00:00:00 2001 From: Victoria <32179813+victoriafomina@users.noreply.github.com> Date: Thu, 1 Jun 2023 17:47:27 +0300 Subject: [PATCH 4/5] Update environment in Dockerfile for Go CLI --- utbot-cli-go/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utbot-cli-go/Dockerfile b/utbot-cli-go/Dockerfile index a5b965e124..220a1378ca 100644 --- a/utbot-cli-go/Dockerfile +++ b/utbot-cli-go/Dockerfile @@ -1,4 +1,4 @@ -FROM azul/zulu-openjdk:11.0.15-11.56.19 +FROM azul/zulu-openjdk:17.0.7-17.42.19 ARG UTBOT_GO_CLI From 4c680459e3dc5fe349570e34bbc3ffb7441d2529 Mon Sep 17 00:00:00 2001 From: Victoria <32179813+victoriafomina@users.noreply.github.com> Date: Thu, 1 Jun 2023 17:52:13 +0300 Subject: [PATCH 5/5] Add possibility to publish Go CLI image --- .github/workflows/build-and-run-tests.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-run-tests.yml b/.github/workflows/build-and-run-tests.yml index 28636e1600..ad47e2f403 100644 --- a/.github/workflows/build-and-run-tests.yml +++ b/.github/workflows/build-and-run-tests.yml @@ -36,7 +36,8 @@ jobs: publish-cli-image: needs: build-and-run-tests - if: ${{ github.event_name == 'push' }} + # The line is commented for testing. + # if: ${{ github.event_name == 'push' }} strategy: fail-fast: false # force to execute all jobs even though some of them have failed matrix: @@ -52,6 +53,9 @@ jobs: - image_name: utbot_py_cli directory: utbot-cli-python extra_options: "" + - image_name: utbot_go_cli + directory: utbot-cli-go + extra_options: "" runs-on: ubuntu-20.04 container: unittestbot/java-env:java17-zulu-jdk-gradle7.6.1-kotlinc1.8.0 steps: