增加数据增强的函数,和yaml文件选项,并将'LOGO_FILES.npy'中保存的路径改为相对路径(方便共享) #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Pytest CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# 第一步:检出代码 | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# 第二步:设置 Miniconda | |
- name: Set up Miniconda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true # 自动更新 Conda | |
python-version: '3.9' # 指定 Python 版 | |
activate-environment: phishpedia | |
# 保存cache | |
- name: Cache Conda packages and pip cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.conda/pkgs # 缓存 Conda 包 | |
~/.cache/pip # 缓存 pip 包 | |
phishpedia/lib/python3.9/site-packages # 可选:缓存虚拟环境的 site-packages | |
key: ${{ runner.os }}-conda-${{ hashFiles('**/environment.yml', '**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-conda- | |
# 第三步:升级 pip | |
- name: Upgrade pip | |
run: | | |
python -m pip install --upgrade pip | |
# 第四步:克隆 Phishpedia 仓库并运行 setup.sh | |
- name: Clone Phishpedia repo and run setup.sh | |
run: | | |
git clone https://github.com/lindsey98/Phishpedia.git | |
cd Phishpedia | |
chmod +x ./setup.sh | |
./setup.sh | |
# 第五步:安装项目依赖和 pytest | |
- name: Install dependencies and pytest | |
run: | | |
conda run -n phishpedia pip install pytest | |
conda run -n phishpedia pip install validators | |
# 步骤 6:运行 Pytest 测试 | |
- name: Run Pytest | |
run: | | |
conda run -n phishpedia pytest tests/test_logo_matching.py | |
conda run -n phishpedia pytest tests/test_logo_recog.py | |
conda run -n phishpedia pytest tests/test_phishpedia.py |