Skip to content

build

build #2085

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: build
on:
push:
branches: [ master ]
paths:
- "src/viztracer/**"
- "tests/**"
- "setup.py"
- ".github/workflows/python-package.yml"
pull_request:
paths:
- "src/viztracer/**"
- "tests/**"
- "setup.py"
- ".github/workflows/python-package.yml"
schedule:
- cron: '0 10 * * *'
jobs:
build:
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
os: [ubuntu-latest, macos-latest, macos-13, windows-latest]
exclude:
- python-version: '3.8'
os: macos-latest
- python-version: '3.9'
os: macos-latest
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install gdb
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install gdb
echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
- name: Setup lldb
if: matrix.os == 'macos-latest' || matrix.os == 'macos-13'
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Build dist and test with unittest
if: matrix.os != 'windows-latest'
run: |
python -m build
pip install dist/*.whl
python -m unittest
- name: Build dist and test with unittest on Windows
if: matrix.os == 'windows-latest'
run: |
python -m build
pip install (Get-ChildItem dist/*.whl)
python -m unittest
- name: Generate coverage report
run: |
coverage run --source viztracer --parallel-mode -m unittest
coverage combine
coverage xml -i
env:
COVERAGE_RUN: True
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: gaogaotiantian/viztracer
file: ./coverage.xml