英文:
Could not open requirements file in github actions
问题
但不断出现以下错误
/opt/hostedtoolcache/Python/3.10.12/x64/bin/python -m pip install -r requirements.txt
错误:无法打开要求文件:[Errno 2] 没有那个文件或目录:'requirements.txt'
错误:ERROR: Action failed during dependency installation attempt with error: The process '/opt/hostedtoolcache/Python/3.10.12/x64/bin/python' failed with exit code 1
你可以查看我的目录结构这里
和 GitHub 工作流文件
name: testing
on: [push,pull_request]
run-name: running tests for searchenginepy
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: setup python
uses: actions/setup-python@v4
with:
python-version: '3.10' # 安装所需的 Python 版本
- name: Install dependencies
uses: py-actions/py-dependency-install@v4
with:
path: "requirements.txt"
- name: run tests # 运行 main.py
working-directory: tests
run: python -m unittest discover
我尝试过
> pip install .
> pip install -r .github/workflows/requirements.txt
我也不确定关于 unittest 目录,因为它需要在 tests 文件夹中运行。
英文:
I am trying to setup a github workflow (first time)
but keep getting this error
/opt/hostedtoolcache/Python/3.10.12/x64/bin/python -m pip install -r requirements.txt
ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'
Error: ERROR: Action failed during dependency installation attempt with error: The process '/opt/hostedtoolcache/Python/3.10.12/x64/bin/python' failed with exit code 1
you can view my director structure here
and github workflow file
name: testing
on: [push,pull_request]
run-name: running tests for searchenginepy
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: setup python
uses: actions/setup-python@v4
with:
python-version: '3.10' # install the python version needed
- name: Install dependencies
uses: py-actions/py-dependency-install@v4
with:
path: "requirements.txt"
- name: run tests # run main.py
working-directory: tests
run: python -m unittest discover
I have tried
> pip install .
> pip install -r .github/workflows/requirements.txt
I am also not sure about the unittest directory because that needs to be run in the tests folder
答案1
得分: 1
请只添加检出步骤 - uses: actions/checkout@v3
。
name: testing
on: [push, pull_request]
run-name: 运行搜索引擎测试
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: 设置 Python
uses: actions/setup-python@v4
with:
python-version: '3.10' # 安装所需的 Python 版本
- name: 安装依赖项
uses: py-actions/py-dependency-install@v4
with:
path: "requirements.txt"
- name: 运行测试 # 运行 main.py
working-directory: tests
run: python -m unittest discover
英文:
Please just add checkout step - uses: actions/checkout@v3
name: testing
on: [push,pull_request]
run-name: running tests for searchenginepy
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: setup python
uses: actions/setup-python@v4
with:
python-version: '3.10' # install the python version needed
- name: Install dependencies
uses: py-actions/py-dependency-install@v4
with:
path: "requirements.txt"
- name: run tests # run main.py
working-directory: tests
run: python -m unittest discover
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论