【发布时间】:2021-02-16 14:13:08
【问题描述】:
我想用 dart 和 python 设置一个 github 操作容器。我使用了 dart 动作模板并安装了 python。但是,我一直收到错误提示
WARNING: The directory '/github/home/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: pip in /__t/Python/3.8.7/x64/lib/python3.8/site-packages (21.0.1)
/__w/_temp/95e6ebc6-5365-42a8-8197-9f5d14c042d3.sh: 2: /__w/_temp/95e6ebc6-5365-42a8-8197-9f5d14c042d3.sh: pip: not found
这是我的yaml 文件:
name: Dart
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
# Note that this workflow uses the latest stable version of the Dart SDK.
# Docker images for other release channels - like dev and beta - are also
# available. See https://hub.docker.com/r/google/dart/ for the available
# images.
container:
image: google/dart:latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Print Dart SDK version
run: dart --version
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
cd integ_tests
dart pub get
# Run uvicorn
- name: Run uvicorn
run: |
cd fastapi/
uvicorn app.main:app --reload --port 8000
# run my test
- name: Run dart test
run: |
cd integ_tests
dart lib/main.dart --dry true
此外,我担心在容器内运行uvicorn 会使容器挂起(因为它永远不会退出)。如果是这种情况,如何在不让容器永远运行的情况下使用 uvicorn 启动 localhost?
如果我使用 sudo 运行它,我会收到一条错误提示
/__w/_temp/2ffb7222-f1dd-4273-870c-c85ac57b9da3.sh: 1: /__w/_temp/2ffb7222-f1dd-4273-870c-c85ac57b9da3.sh: sudo: not found
【问题讨论】:
-
查看完整日志会很有帮助。您能否提供带有失败的特定 GitHub 操作的 repo 的 URL?
-
@MoneyBall,您在依赖项安装步骤的第一步升级 pip 是否有特殊原因?
-
@astrochun 这实际上是我自己的仓库,目前是私有的。
-
@jidicula 很多时候不是 pip 没有升级到最新版本。此外,这是 Github 操作提供的模板。
-
我认为问题源于没有在 docker 容器中安装
pip。我有一个类似的问题,即使跑步者安装了git,我也没有找到git。这就是为什么我要求提供完整的日志以查看失败的步骤。
标签: github-actions fastapi uvicorn