我试图用Github Action传递由Cypress测试生成的代码覆盖率报告,但它到达SonarCloud时覆盖率为0%. 在我的计划中,我收到了以下警告:
警告:无法解析[/gihub/workspace/overage/lcov.info]中的7个文件路径
警告:第一个未解析路径:C:\Users\ferso\OneDrive\Documentos\Faculdade\cypress-test\src\App.jsx(在调试模式下运行以获取未解析路径的完整列表)
我已经try 使用sed ci实用程序来更正文件路径并使用sonar.javascript.lcov.reportPaths=coverage/lcov.info,,但不起作用
这是我的声纳项目.属性:
sonar.projectKey=fsoupimenta_cypress-test
sonar.organization=fsoupimenta
sonar.javascript.lcov.reportPaths=coverage/lcov.info
sonar.javascript.file.suffixes=.js,.jsx
这是我的SonarCloud工作流程:
- name: fix code coverage paths
working-directory: ./coverage
run: |
sed -i 's/\/home\/runner\/work\/cypress-test\/cypress-test\//\/github\/workspace\//g' lcov.info
sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' lcov.info
sed -i 's/\/home\/runner\/work\/cypress-test\/cypress-test\//\/github\/workspace\//g' sonar-cloud-reporter.xml
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}