coverage #4
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: CI Pipeline | |
on: | |
push: | |
branches: | |
- '**' | |
pull_request: | |
branches: | |
- '**' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the repository | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# 安裝系統依賴,確保 OpenCV 可以正確運行 | |
- name: Install OpenCV dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libgl1-mesa-glx libglib2.0-0 | |
# 安裝 Python 依賴 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install coverage | |
- name: Run tests with coverage | |
run: | | |
coverage run -m unittest discover | |
coverage xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
file: ./coverage.xml # 指定生成的覆蓋率報告文件 |