我正在尝试将我的 codacy 令牌用作 Travis 变量,但 Travis 似乎并未读取该变量的值。下面是我的特拉维斯脚本:
branches:
only:
- master
language: python
python:
- "3.5"
- "3.6"
- "3.7"
env:
- CODACY_PROJECT_TOKEN=${CodacyToken}
cache:
- pip
# command to install dependencies
before_script:
- sudo apt-get update
- sudo apt-get install python3
- sudo apt-get install python3-pip
- sudo apt-get install python3-setuptools
- pip3 install --upgrade setuptools
- pip3 install -e .
- pip3 install pytest-cov pytest
- pip3 install codecov
- pip3 install coveralls
- pip3 install codacy-coverage
- sudo apt-get update
# command to run tests
script:
- pytest -vs -x --cov=./urlchecker tests/test_*.py
after_success:
- codecov
- coveralls
- coverage xml
- export CODACY_PROJECT_TOKEN=${CodacyToken}
- python-codacy-coverage -r coverage.xml
我的CodacyToken
变量在 travis/../settings 下定义:https ://travis-ci.com/github/urlstechie/urlchecker-python/settings
这导致:
2021-04-17 21:59:23,373 - 错误 - 环境变量 CODACY_PROJECT_TOKEN 未定义。知道我的语法是否有问题吗?