Coder Social home page Coder Social logo

Comments (10)

MartinNuc avatar MartinNuc commented on August 23, 2024 2

@paambaati Actually I did here https://github.com/paambaati/codeclimate-action/pull/163/files#diff-04c6e90faac2675aa89e2176d2eec7d8L44

I will add few more

from codeclimate-action.

paambaati avatar paambaati commented on August 23, 2024 2

Thanks a ton @MartinNuc! This fix has now landed in v2.6.0.

from codeclimate-action.

MartinNuc avatar MartinNuc commented on August 23, 2024 1

Finally got it working. My problem was actually with the instanbul coverage file. There were relative paths which didn't work well with monorepo like:

SF:src/server.ts

I had to set the projectRoot in jest config. After that I had this path in lcov.info:

SF:server/src/server.ts

Which worked with formatter correctly. Here is the related issue: istanbuljs/istanbuljs#529

Solved by setting projectRoot for lcov reporter to the actually root of the monorepo:

// server/jest.config.js
coverageReporters: [['lcov', { projectRoot: '..' }]]

After that it turned out that there is no need to use different prefix for each covarageLocation therefore I removed that feature.

If you want you can try my version using:

      - name: Coverage to Codeclimate
        uses: MartinNuc/[email protected]
        env:
          CC_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE_REPORTER_ID }}
        with:
          coverageLocations: |
            ${{github.workspace}}/client/coverage/lcov.info:lcov
            ${{github.workspace}}/server/coverage/lcov.info:lcov

I will post the PR to this repo.

from codeclimate-action.

paambaati avatar paambaati commented on August 23, 2024

@awentzel Can you link me to a failing run? And also please try the latest v2.5.7.

from codeclimate-action.

awentzel avatar awentzel commented on August 23, 2024

Hi @paambaati - here is a draft pr with update v2.5.7https://github.com/microsoft/fast-dna/actions/runs/83426464 the errors include "You have an error in your yaml syntax on line 51" the problems I'm having, however, is that I can't seem to get any format to work for multiple packages so it's not clear what's expected or why it's breaking.

It's possible my syntax isn't correct. If you can share an example array that would be great. Thanks

Thanks,
Aaron

from codeclimate-action.

MartinNuc avatar MartinNuc commented on August 23, 2024

I have the same problem. coverageLocations doesn't accept an array like mentioned in docs but just a string.

I believe the reason is described here: https://github.community/t5/GitHub-Actions/Can-action-inputs-be-arrays/td-p/33776

Action inputs only supports string keys and string values at this time. This is because they translate to environment variables within the action's execution run.

There are two workarounds:

  1. use JSON
  2. use string with spaces/newlines and split it into the array in the code

I will try it and make a PR 🙂

from codeclimate-action.

awentzel avatar awentzel commented on August 23, 2024

Thanks @MartinNuc, appreciate your help. I was going to submit some doc updates as well as soon as I got it figured out. Were you able to get it to actually format_coverage, sum_coverage, and upload_coverage? If that works it's a step in the right direction for sure. The script methods I used on Circle CI seem to be broken on GH Actions now with the cc-test-reporter. In fact, cc-test-reporter itself doesn't seem to handle mono-repos well. Thanks again.

from codeclimate-action.

MartinNuc avatar MartinNuc commented on August 23, 2024

Not yet. Still working on it. I had to convert also prefix into array. So files are being passed now as a multiline string (last segment after :):

        with:
          coverageLocations: |
            ${{github.workspace}}/client/coverage/lcov.info:lcov:${{github.workspace}}/client
            ${{github.workspace}}/server/coverage/lcov.info:lcov:${{github.workspace}}/server

Right now have a problem that format_coverage is trying to read files without prefix. I will have to try it locally first and then I will submit PR.

from codeclimate-action.

awentzel avatar awentzel commented on August 23, 2024

@MartinNuc , I did a test and got through that part thanks to your suggestion. But, haven't had any luck yet getting format_coverage to work. In fact, I have a few threads on this issue, including a different approach scripting in the CI rather than using an Action. But, all roads for that have resulted in no such file or directory. Very challenging problem on mono-repositories. What coverageCommand are you using? Technically, unit testing has already created my /coverage data. But, it's unclear how things process inside this black box. I haven't dug into the source code yet.

from codeclimate-action.

paambaati avatar paambaati commented on August 23, 2024

@MartinNuc Would be super-helpful if you can add these to the README's examples section as well.

from codeclimate-action.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.