codecov / codecov-ruby

Ruby uploader for Codecov
https://codecov.io
MIT License
72 stars 82 forks source link

Codecov docker error Syntax error: "(" unexpected #144

Closed rath3t closed 3 years ago

rath3t commented 3 years ago

Hello everyone, i use codecov through github actions.

I wanted to run my github actions from inside a preconfigured docker image to speedup my workflow. Without a docker container the coverage report worked. Here, i just downloaded my dependencies directly in github actions.

I also read https://docs.codecov.com/docs/testing-with-docker and included in my dockerfile ENV CI true and i also tried adding additionally ENV GITHUB_ACTIONS true.

Unfortunately, inside the docker container my action fails with

Run bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"
/__w/_temp/f4148eab-0fa5-4819-80c5-5e2736d64dc9.sh: 1: Syntax error: "(" unexpected
Error: Process completed with exit code 2.

My codecov.yml file:

ignore:
  - "/usr"
  - "test"

comment:
  require_changes: true

My workflow file codecov.yml file:

name: Ubuntu-GCC-Debug-CodeCov
on: [push]

env:
  CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

jobs:
  Ubuntu-GCC-Debug-CodeCov:
    runs-on: ubuntu-latest
    container:
      image: rath3t/ci-ubuntu-21-04
    steps:
      - uses: actions/checkout@v2
      - name: Build
        run: |
          mkdir cmake-build-debug
          cd cmake-build-debug
          cmake ../  -DCMAKE_BUILD_TYPE=Debug -G "Unix Makefiles" -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11 -DENABLE_TEST_COVERAGE=1
          cmake --build . --parallel 9 --target IkarusTests
      - name: Tests
        working-directory: ./cmake-build-debug
        run: ctest --output-on-failure --parallel 4 -C Debug

      - name: collect code coverage
        run: bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"

My DockerFile of the container

FROM ubuntu:hirsute

ENV HOME /root
ENV DEBIAN_FRONTEND "noninteractive"
ENV GITHUB_ACTIONS true
ENV CI true

RUN apt-get update -y && apt-get upgrade -y && \
    apt-get -y install \
        build-essential \
        libssl-dev \
        git \
        wget \
        apt-utils \
        software-properties-common \
        gfortran \
        gcc-11 \
        g++-11 \
        clang \
        liblapack-dev \
        libblas-dev \
        libsuitesparse-dev \
        libdune-common-dev \
        libdune-geometry-dev \
        libdune-grid-dev \
        libspdlog-dev \
        libbenchmark-dev \
        libgtest-dev && \
        cd /usr/src/googletest && \
        cmake . && \
        cmake --build . --target install && \
        cd ~/ && \
        git clone https://gitlab.com/libeigen/eigen.git && \
        cd eigen && \
        git checkout 3.4 && \
        ls && \
        mkdir build && \
        cd build && \
        cmake ../ && \
        make install && \
        ls && \
        cd .. && \
        ls && \
        cd .. && \
        ls && \
        rm -r eigen && \
        git clone https://github.com/alandefreitas/matplotplusplus.git && \
        cd matplotplusplus && \
        mkdir -p build && \
        cd build && \
        cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=OFF -DBUILD_TESTS=OFF && \
        cmake --build . --parallel 4 --config Release && \
        cmake --install . && \
        cd ../.. && \
        rm -r matplotplusplus && \
        apt-get auto-remove -y
CMD [ "/bin/bash" ]

WORKDIR $HOME

Do i need to install packages into the docker image to get this working?

rath3t commented 3 years ago

Should this be at: https://github.com/codecov/codecov-bash ?

I posted it here since https://docs.codecov.com/docs/testing-with-docker refers to https://github.com/codecov/codecov-ruby/blob/484767f1c3d7992a9d7fedd6dc72d35a80d04f70/lib/codecov.rb#L68-L69

rath3t commented 3 years ago

I managed to get it working: Instead of using

bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"

i wrote

curl -s https://codecov.io/bash > .codecov
chmod +x .codecov
./.codecov