首页 > 解决方案 > Github Actions 停留在一个任务上,最后超时失败

问题描述

对于破裂python 包,我们使用 Github Actions 在每个应该合并的 PR 上运行我们的测试master。到目前为止,它工作得很好。但是几天以来,这个 Gh Actions 一直卡住并最终在超时(360 分钟)时失败。

请在此处找到特定运行中的症状示例。

请在此处找到执行测试的 Gh Actions 代码。它有strategy matrix几个 python 版本和操作系统。

name: Run tests

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:
    strategy:
      matrix:
        python-version: [3.6, 3.7, 3.8, 3.9]
        os: [ubuntu-latest, windows-latest, macos-latest]
        exclude:
          - os: windows-latest
            python-version: 3.9
    runs-on: ${{ matrix.os }}
    steps:
    - uses: actions/checkout@v2
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python-version }}
    - name: Install ruptures
      run: |
        python -m pip install --upgrade pip
        python -m pip install .[test]
    - name: Test with pytest
      run: |
        python -m pytest

据我所见,没有错误,只是卡住了。据我所知,它始终停留在strategy matrix组合的第一个元素上,即对我们来说它是 python v3.6(这是矩阵可能性中最低的)。但同样,不确定它是否与此相关,因为没有错误,只是超时,没有关于出现问题的具体消息(除非我没有找到正确的地方)。

matrix由于我认为这可能与 Ghmax-parallel: 2strategy. 但这并没有解决任何问题。

出于同样的原因,我尝试从strategy matrixpython v3.6 中删除,以查看 python v3.6 是否是特定问题。但它不能解决任何问题,Gh Actions 只是停留在 Python v3.7 而不是 v3.6 上。请参阅此处以查看运行情况。

测试在本地顺利运行。

我不明白是什么导致了这种行为,更何况这个 Gh Actions 过去几个月都没有任何问题。

标签: pythongithubpipgithub-actions

解决方案


感谢jidicula,我能够调查并找到解决方案。

底线:

  • 它与 Github Actions 无关
  • 它完全与pip

解决方案:

而不是升级pip使用python -m pip install --upgrade pip,手动将版本设置为最后的工作版本python -m pip install pip==21.0.1。详细说明:

  • 在我们的特殊情况下,升级 pip 会给v21.1出版本
  • pip允许 Gh Actions 顺利运行的最后一个版本是v21.0.1. 所以我现在手动设置pip为这个特定的值

说明:

v21.1新的 ( )pip版本似乎有问题

失败的 Gh Actions中,有以下消息:

Processing /home/runner/work/ruptures/ruptures
  DEPRECATION: A future pip version will change local packages to be built in-place without first copying to a temporary directory. We recommend you use --use-feature=in-tree-build to test your packages with this new behaviour before it becomes the default.
   pip 21.3 will remove support for this functionality. You can find discussion regarding this at https://github.com/pypa/pip/issues/7555.

然而,一旦pip升级到v21.1,添加或不添加--use-feature=in-tree-build并没有解决任何问题,pip只是卡住了。

也与--use-feature=in-tree-build我在repo上找到了这个问题有关。pip这最后一期有一个评论建议做

python setup.py bdist_wheel
pip install dist/*.whl

而不是pip install .在我们的特定情况下不是一个好的解决方案,因为我们正在利用指定[options.extras_require]类似的可能性python -m pip install .[test]。但这可能对您有所帮助!

最后,有关 中潜在错误的更多详细信息pip,请在此处找到对几个相关行为进行分组的问题。


推荐阅读