From 548bf71ef8a401730f62649e3eebce715b830b4c Mon Sep 17 00:00:00 2001 From: tsoganov Date: Mon, 14 Apr 2025 14:07:08 +0300 Subject: [PATCH] Updated workflows --- .github/workflows/build_base_image.yml | 4 +- .github/workflows/run-automatest-tests.yml | 12 ++-- ...base.legacy => Dockerfile.Erlang-ruby.base | 2 +- Dockerfile.test | 71 +++++++++++++++++++ Dockerfile.test.legacy | 4 -- 5 files changed, 80 insertions(+), 13 deletions(-) rename Dockerfile.Erlang-ruby.base.legacy => Dockerfile.Erlang-ruby.base (97%) create mode 100644 Dockerfile.test delete mode 100644 Dockerfile.test.legacy diff --git a/.github/workflows/build_base_image.yml b/.github/workflows/build_base_image.yml index 2ff800b..d3e3662 100644 --- a/.github/workflows/build_base_image.yml +++ b/.github/workflows/build_base_image.yml @@ -9,11 +9,11 @@ jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Get versions shell: python diff --git a/.github/workflows/run-automatest-tests.yml b/.github/workflows/run-automatest-tests.yml index c983dd9..e5b13e2 100644 --- a/.github/workflows/run-automatest-tests.yml +++ b/.github/workflows/run-automatest-tests.yml @@ -4,9 +4,9 @@ on: [push] jobs: test: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v2.0.0 + - uses: actions/checkout@v3 - name: Build image for tests run: docker build -t proxy-tester -f Dockerfile.test . @@ -15,7 +15,7 @@ jobs: run: docker run -d --name tester proxy-tester - name: Install rebar dependencies - run: docker exec -i tester rebar3 as test get-deps + run: docker exec -i tester bash -l -c "source /root/.asdf/asdf.sh && rebar3 as test get-deps" - name: Integrated Ruby app setup run: docker exec -d tester bash -l -c "cd apps/epp_proxy/priv/test_backend_app && bundle install && bundle exec rackup" @@ -23,11 +23,11 @@ jobs: - name: Compile for tests run: | sleep 15 - docker exec -i tester rebar3 as test compile + docker exec -i tester bash -l -c "source /root/.asdf/asdf.sh && rebar3 as test compile" - name: Run tests run: | - docker exec -i -e DEBUG=1 tester rebar3 ct --sys_config config/test.config --readable=false --cover --verbose=true + docker exec -i -e DEBUG=1 tester bash -l -c "source /root/.asdf/asdf.sh && rebar3 ct --sys_config config/test.config --readable=false --cover --verbose=true" - name: Show test coverage - run: docker exec -i tester rebar3 cover --verbose \ No newline at end of file + run: docker exec -i tester bash -l -c "source /root/.asdf/asdf.sh && rebar3 cover --verbose" \ No newline at end of file diff --git a/Dockerfile.Erlang-ruby.base.legacy b/Dockerfile.Erlang-ruby.base similarity index 97% rename from Dockerfile.Erlang-ruby.base.legacy rename to Dockerfile.Erlang-ruby.base index 1f1b721..a2ae864 100644 --- a/Dockerfile.Erlang-ruby.base.legacy +++ b/Dockerfile.Erlang-ruby.base @@ -1,4 +1,4 @@ -FROM debian:buster-slim +FROM debian:bullseye-slim RUN apt-get update && apt-get install -y \ wget \ diff --git a/Dockerfile.test b/Dockerfile.test new file mode 100644 index 0000000..67d346d --- /dev/null +++ b/Dockerfile.test @@ -0,0 +1,71 @@ +FROM debian:bullseye-slim + +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +# Install all dependencies in a single layer to reduce image size +RUN apt-get update && apt-get install -y -qq \ + wget \ + git \ + build-essential \ + libncurses5-dev \ + automake \ + autoconf \ + curl \ + ca-certificates \ + libssl-dev \ + libreadline-dev \ + libdpkg-perl \ + liberror-perl \ + libc6 \ + libc-dev \ + perl \ + procps \ + inotify-tools \ + libssl1.1 \ + perl-base \ + zlib1g-dev \ + # Additional dependencies for Erlang build + libncurses-dev \ + libsctp-dev \ + # Documentation tools to prevent build failures + xsltproc \ + libxml2-utils \ + # Dependencies for Ruby + libffi-dev \ + libyaml-dev \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +# Set environment variables for Erlang build +ENV KERL_CONFIGURE_OPTIONS="--disable-debug --without-javac --without-wx --without-odbc --disable-hipe --without-jinterface --without-docs" +ENV KERL_BUILD_DOCS="no" +ENV KERL_DOC_TARGETS="" +ENV KERL_INSTALL_HTMLDOCS="no" +ENV KERL_INSTALL_MANPAGES="no" + +# Install asdf version manager +RUN git clone https://github.com/asdf-vm/asdf.git --branch v0.6.3 "$HOME"/.asdf && \ + echo '. $HOME/.asdf/asdf.sh' >> "$HOME"/.bashrc && \ + echo '. $HOME/.asdf/asdf.sh' >> "$HOME"/.profile + +ENV PATH="${PATH}:/root/.asdf/shims:/root/.asdf/bin" + +WORKDIR /app + +# Copy tool versions and install required plugins +COPY .tool-versions ./ +RUN . $HOME/.asdf/asdf.sh && \ + asdf plugin-add erlang && \ + asdf plugin-add ruby && \ + asdf plugin-add rebar && \ + asdf install + +# Copy the application code +COPY . . + +# Make sure asdf is loaded in non-interactive shells +RUN echo '. $HOME/.asdf/asdf.sh' > /etc/profile.d/asdf.sh && \ + chmod +x /etc/profile.d/asdf.sh + +# Keep container running for tests +CMD ["tail", "-f", "/dev/null"] \ No newline at end of file diff --git a/Dockerfile.test.legacy b/Dockerfile.test.legacy deleted file mode 100644 index ec9b48b..0000000 --- a/Dockerfile.test.legacy +++ /dev/null @@ -1,4 +0,0 @@ -FROM internetee/erlang-ruby:21.3.8-2.6.3 -COPY . . - -CMD ["tail", "-f" , "/dev/null"]