【问题标题】:android unit test coverage report through Github Actions通过 Github Actions 的 android 单元测试覆盖率报告
【发布时间】:2020-09-03 21:43:46
【问题描述】:

我使用 github 操作执行单元测试。

- name: Archive code coverage results
    if: always()
    uses: actions/upload-artifact@v1
    with:
        name: code-coverage-report
        path: ./app/build/reports/tests/testDebugUnitTest/index.html
        working-directory: ./hoge

错误信息显示如下

[error]Path does not exist /home/runner/work/hoge/hoge/app/build/reports/tests/testDebugUnitTest/index.html
[error]Exit code 1 returned from process: file name '/home/runner/runners/2.169.1/bin/Runner.PluginHost', arguments 'action "GitHub.Runner.Plugins.Artifact.PublishArtifact, Runner.Plugins"'.

我不确定为什么 github 操作找不到路径。我设置了错误的路径吗? ./app/build... 在 hoge 之下。

【问题讨论】:

  • 路径一定有问题。尝试做一堆- run: ls && pwd来调试它

标签: android unit-testing github-actions


【解决方案1】:

我确定对您来说为时已晚,但可能适合其他志同道合的人上传测试结果

选项 1:仅上传 html 报告而不上传所有其他 JS 内容

选项2:上传整个目录

name: PR_unit_tests

on:
  pull_request:
    branches:
      - 'main'

jobs:
  Unit-test:
    name: Run unit tests on PR in main
    runs-on: ubuntu-20.04

    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-java@v1
        with: {java-version: 1.8}
      - name: Run unit tests
        run: ./gradlew test

      - name: Upload html test report
        uses: actions/upload-artifact@v2
        with:
          name: index.html
          path: app/build/reports/tests/testDebugUnitTest/index.html

      - name: Upload test report directory
        uses: actions/upload-artifact@v2
        with:
          name: testDebugStuff
          path: app/build/reports/tests/testDebugUnitTest/
         

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-08-04
    • 2018-05-10
    • 2019-11-01
    • 2017-03-23
    • 1970-01-01
    • 1970-01-01
    • 2017-04-24
    相关资源
    最近更新 更多