Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Draft] Set up Go CLI image autopublication #2253

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
6 changes: 5 additions & 1 deletion .github/workflows/build-and-run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
40 changes: 40 additions & 0 deletions utbot-cli-go/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions utbot-cli-go/create_go_mod.sh
Original file line number Diff line number Diff line change
@@ -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