python - 如何在 GitHub 操作构建期间引用我的存储库中的目录?
问题描述
我有一些用于 pytest 单元测试的测试数据。我用环境变量设置它们的位置。查看我的 pytest 日志,构建会看到环境变量,但它们引用的位置不存在。在 GitHub Actions 文档中,repo 应该在 /home/runner/Repo/ 中。下面是我的文件夹结构。有人看到任何明显的问题吗?
Repo/
notebooks/
repo/
__init__.py
tests/
tests_db.hdf5
Sample_Raw/
...
__init__.py
test_obj1.py
test_obj2.py
obj1.py
obj2.py
utils.py
构建yaml
name: build-test
on:
push:
branches:
- '*' # all branches for now
jobs:
build-and-run:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Generate coverage report
env:
DB_URL: /home/runner/work/Repo/repo/tests/test_db.hdf5
RAW_FOLDER: /home/runner/work/Repo/repo/tests/Sample_Raw/
run: |
pip install pytest
pip install pytest-cov
pytest --cov=./ --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
name: codecov-umbrella
解决方案
推荐阅读
- java - 取消 ScheduledExecutorService 中计划的任务使执行器保持活动状态
- birt - BIRT 报告:第一次报告很慢
- c# - HTTP WSDL 没有出现在 HTTPS WSDL 出现的地方
- ios - 使用随机数访问字典中的值
- tensorflow - rasa nlu ner_crf 未提取任何实体
- android - 将消息正文保存到 SQLite 数据库
- python - python中“cross-env”的对应物是什么?
- python - 将网页中的抓取数据保存到 Excel 文件时出现问题
- python - model = Django Meta 类中的用户
- python - 使用 python requests-HTML 获取标签的父元素