在CentOS上配置Python持续集成,可参考以下步骤:
sudo yum install -y python3
安装Python 3。sudo yum install -y python3-pip
安装pip。virtualenv
或venv
创建虚拟环境,用pip install virtualenv
或python3 -m venv myenv
创建,source myenv/bin/activate
激活。sudo yum install jenkins
。pip install -r requirements.txt
、运行测试pytest
等)。.github/workflows
下创建工作流文件,如python-ci.yml
。name: Python CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.x
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run tests
run: pytest
```。