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: diff --git a/utbot-cli-go/Dockerfile b/utbot-cli-go/Dockerfile new file mode 100644 index 0000000000..220a1378ca --- /dev/null +++ b/utbot-cli-go/Dockerfile @@ -0,0 +1,40 @@ +FROM azul/zulu-openjdk:17.0.7-17.42.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 && \ + 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 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