GitHub动作:Windows上哪个外壳 用于codecov-bash?

问题描述 投票:0回答:1

在Windows上运行时,我们需要使用GitHub Actions上传哪些设置?

我已经尝试过这些。

没有shell:

    - name: Upload coverage
      if: success()
      run: |
        bash <(curl -s https://codecov.io/bash)
      env:
        CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
        CODECOV_NAME: ${{ runner.os }} Python ${{ matrix.python-version }}

给予:

Run bash <(curl -s https://codecov.io/bash)
  bash <(curl -s https://codecov.io/bash)
  shell: C:\Program Files\PowerShell\6\pwsh.EXE -command ". '{0}'"
  env:
    pythonLocation: C:\hostedtoolcache\windows\Python\3.5.4\x86
    CODECOV_TOKEN: ***
    CODECOV_NAME: Windows Python 3.5
At D:\a\_temp\f9f81a44-97d3-4908-8e7c-7d8d676e9d93.ps1:2 char:6
+ bash <(curl -s https://codecov.io/bash)
+      ~
The '<' operator is reserved for future use.
+ CategoryInfo          : ParserError: (:) [], ParseException
+ FullyQualifiedErrorId : RedirectionNotSupported

##[error]Process completed with exit code 1.

这些设置适用于Ubuntu和macOS。

添加shell: bash

    - name: Upload coverage
      if: success()
      run: |
        bash <(curl -s https://codecov.io/bash)
      env:
        CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
        CODECOV_NAME: ${{ runner.os }} Python ${{ matrix.python-version }}
      shell: bash

给予:

Run bash <(curl -s https://codecov.io/bash)
  bash <(curl -s https://codecov.io/bash)
  shell: C:\Program Files\Git\bin\bash.EXE --noprofile --norc -e -o pipefail {0}
  env:
    pythonLocation: C:\hostedtoolcache\windows\Python\3.5.4\x86
    CODECOV_TOKEN: ***
    CODECOV_NAME: Windows Python 3.5
bash: /dev/fd/63: No such file or directory
##[error]Process completed with exit code 127.

更改为shell: cmd

    - name: Upload coverage
      if: success()
      run: |
        bash <(curl -s https://codecov.io/bash)
      env:
        CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
        CODECOV_NAME: ${{ runner.os }} Python ${{ matrix.python-version }}
      shell: cmd

给予:

Run bash <(curl -s https://codecov.io/bash)
  bash <(curl -s https://codecov.io/bash)
  shell: C:\windows\system32\cmd.EXE /D /E:ON /V:OFF /S /C "CALL "{0}""
  env:
    pythonLocation: C:\hostedtoolcache\windows\Python\3.5.4\x86
    CODECOV_TOKEN: ***
    CODECOV_NAME: Windows Python 3.5
The system cannot find the file specified.
##[error]Process completed with exit code 1.
python github code-coverage github-actions codecov
1个回答
0
投票

使用已经存在的codecov action,可能会带来更好的运气。

无论如何,您是在Windows环境中运行操作,因此,我建议不要过分依赖于Unix特定的行为(即process substitution <())。试试这个:

<()

也可能是因为Shell在posix模式下运行的结果。看到这个问题:- name: Upload coverage if: success() run: | curl -s https://codecov.io/bash -o codecov.bash ./codecov.bash # OR # curl -s https://codecov.io/bash | bash env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} CODECOV_NAME: ${{ runner.os }} Python ${{ matrix.python-version }} shell: bash


推荐问答