From 63db71b650a4467e007a2752a76f807e084f17be Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Tue, 7 Jan 2025 15:19:59 +0200 Subject: [PATCH] ci: make easier the debugging of the `docker-alpine-musl-gcc` job (#23399) --- .github/workflows/Dockerfile.ci_alpine_local | 52 ++++++++++++++++++++ .github/workflows/docker_ci.yml | 6 +-- .github/workflows/tools_ci.yml | 2 +- cmd/tools/modules/testing/common.v | 2 +- vlib/v/gen/golang/tests/golang_test.v | 2 +- 5 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/Dockerfile.ci_alpine_local diff --git a/.github/workflows/Dockerfile.ci_alpine_local b/.github/workflows/Dockerfile.ci_alpine_local new file mode 100644 index 00000000000000..a3f361ba0770ba --- /dev/null +++ b/.github/workflows/Dockerfile.ci_alpine_local @@ -0,0 +1,52 @@ +####################################################################################### +## The goal of this file, is to provide an easy and reproducible way to check *locally* +## the CI job `docker-alpine-musl-gcc` +## Building the docker image: +## docker build -t ci_alpine_local - < .github/workflows/Dockerfile.ci_alpine_local +## Running the docker image, after building it: +## docker run --rm -it -v .:/opt/vlang -w /opt/vlang ci_alpine_local +## Once it is running, inside the container you can: +## make && v -e 'println(2+2)' +## ... then do whatever you need to reproduce the CI test failure. +## Note: after you are finished, and exit the container, run `make` again, otherwise +## you will be using V (and potentially V tools) that were compiled with musl. +####################################################################################### +FROM thevlang/vlang:alpine-build + +LABEL maintainer="spytheman " + +WORKDIR /opt/vlang + +ENV PATH /opt/vlang:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + +## install development packages +RUN apk --no-cache add \ + musl-dev libc-dev libc6-compat gcompat \ + libunwind-dev libunwind-static \ + gc gc-dev \ + binutils diffutils elfutils \ + strace gdb \ + pcre bash fzf fzf-vim tmux less file colordiff \ + vim vim-editorconfig \ + nano nano-syntax \ + micro + +RUN git config --global --add safe.directory /opt/vlang &&\ + git config --global --add safe.directory /opt/vlang/vc &&\ + git config --global --add safe.directory /opt/vlang/thirdparty/tcc &&\ + find /usr/share/nano/ -iname "*.nanorc" -exec echo include {} \; >> ~/.nanorc &&\ + micro -plugin install detectindent &&\ + micro -plugin install editorconfig &&\ + micro -plugin install monokai-dark &&\ + micro -plugin install quickfix &&\ + micro -plugin install runit &&\ + micro -plugin install cheat &&\ + micro -plugin install jump &&\ + true + +## setup runtime environment for v and bash: +ENV VTMP /tmp/v +ENV VMODULES /tmp/vmodules +ENV VFLAGS "-d dynamic_boehm" + +CMD ["bash"] diff --git a/.github/workflows/docker_ci.yml b/.github/workflows/docker_ci.yml index 1e3514eeeac6d0..f69853d1d0cb33 100644 --- a/.github/workflows/docker_ci.yml +++ b/.github/workflows/docker_ci.yml @@ -24,7 +24,7 @@ env: V_CI_MUSL: 1 jobs: - alpine-docker-musl-gcc: + docker-alpine-musl-gcc: runs-on: ubuntu-20.04 timeout-minutes: 241 container: @@ -45,7 +45,7 @@ jobs: echo "C Compiler:" gcc --version - name: Add dependencies - run: apk add libc6-compat + run: apk add libc6-compat gcompat gc gc-dev binutils diffutils elfutils - name: Build V run: CC=gcc make - name: All code is formatted @@ -53,7 +53,7 @@ jobs: - name: Run only essential tests run: VTEST_JUST_ESSENTIAL=1 ./v test-self - ubuntu-docker-musl: + docker-ubuntu-musl: runs-on: ubuntu-20.04 timeout-minutes: 121 container: diff --git a/.github/workflows/tools_ci.yml b/.github/workflows/tools_ci.yml index 1bc04a8fde1ee7..869425b97410bf 100644 --- a/.github/workflows/tools_ci.yml +++ b/.github/workflows/tools_ci.yml @@ -101,7 +101,7 @@ jobs: if: ${{ matrix.cc == 'msvc' }} run: ./v -W -cstrict test-self cmd - ubuntu-docker-musl: + tools-docker-ubuntu-musl: runs-on: ubuntu-20.04 timeout-minutes: 121 container: diff --git a/cmd/tools/modules/testing/common.v b/cmd/tools/modules/testing/common.v index b86aa65b55b334..c4420fc4cd9060 100644 --- a/cmd/tools/modules/testing/common.v +++ b/cmd/tools/modules/testing/common.v @@ -278,7 +278,7 @@ pub fn new_test_session(_vargs string, will_compile bool) TestSession { $if !macos { skip_files << 'examples/macos_tray/tray.v' } - if github_job == 'ubuntu-docker-musl' { + if github_job == 'docker-ubuntu-musl' { skip_files << 'vlib/net/openssl/openssl_compiles_test.c.v' skip_files << 'vlib/crypto/ecdsa/ecdsa_test.v' skip_files << 'vlib/x/ttf/ttf_test.v' diff --git a/vlib/v/gen/golang/tests/golang_test.v b/vlib/v/gen/golang/tests/golang_test.v index 34b0c31df4f7b0..9a8a1dcac9ff03 100644 --- a/vlib/v/gen/golang/tests/golang_test.v +++ b/vlib/v/gen/golang/tests/golang_test.v @@ -9,7 +9,7 @@ const is_verbose = os.getenv('VTEST_SHOW_CMD') != '' // TODO: some logic copy pasted from valgrind_test.v and compiler_test.v, move to a module fn test_golang() { // this was failing on ubuntu-docker-musl, skip it for now - if github_job == 'ubuntu-docker-musl' { + if github_job in ['docker-ubuntu-musl', 'tools-docker-ubuntu-musl'] { eprintln('Skipping Go tests') exit(0) }