Fix coverage #110
This file contains hidden or 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 | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| permissions: | |
| contents: write | |
| jobs: | |
| test: | |
| name: Python ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: | |
| - "3.12" | |
| os: | |
| - ubuntu-latest | |
| arch: | |
| - x86 | |
| - x64 | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up Python ${{ matrix.version }} | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: ${{ matrix.version }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install coverage pytest pytest-cov | |
| pip install -r requirements.txt | |
| - name: Run tests with multiprocessing coverage | |
| run: | | |
| export RANK=0 | |
| export LOCAL_RANK=0 | |
| export WORLD_SIZE=1 | |
| export MASTER_ADDR=localhost | |
| export MASTER_PORT=12345 | |
| export PYTHONPATH=MCintegration | |
| # 使用 coverage 并开启 parallel 模式 | |
| coverage run --parallel-mode -m pytest --cov=MCintegration --ignore=examples | |
| # 合并多进程结果 | |
| coverage combine | |
| coverage xml | |
| coverage report -m | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| docs: | |
| name: Documentation | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install sphinx | |
| pip install -r requirements.txt | |
| - name: Build documentation | |
| run: | | |
| cd docs | |
| sphinx-apidoc -o source ../MCintegration ../MCintegration/*_test.py | |
| python ../clean_MCintegration_rst.py | |
| make html | |
| python ../clean_html_sidebar.py | |
| - name: Deploy documentation to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: docs/build/html |