Skip to content

Module call events (#59) #198

Module call events (#59)

Module call events (#59) #198

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: ['**']
types: [opened, synchronize, reopened, ready_for_review]
jobs:
nix-tests:
name: Testing on Python ${{matrix.python-version}}
runs-on: ubuntu-latest
strategy:
matrix:
#python-version: ["3.10","3.11","3.12","3.13"]
python-version: ["3.12","3.13"]
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
with:
nix_path: nixpkgs=channel:nixos-25.05
extra_nix_config: |
experimental-features = nix-command flakes
- name: Prepare dev environment
run: nix develop ./nix --command bash -lc 'just venv ${{matrix.python-version}} dev'
- name: Verify recorder version metadata
run: nix develop ./nix --command bash -lc 'python3 scripts/check_recorder_version.py'
- name: Rust tests
run: nix develop ./nix --command bash -lc 'just cargo-test'
- name: Python tests
run: nix develop ./nix --command bash -lc 'just py-test'
coverage:
name: Coverage (Python 3.12)
needs: nix-tests
runs-on: ubuntu-latest
continue-on-error: true
permissions:
contents: read
issues: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
with:
nix_path: nixpkgs=channel:nixos-25.05
extra_nix_config: |
experimental-features = nix-command flakes
- name: Prepare dev environment (Python 3.12)
run: nix develop ./nix --command bash -lc 'just venv 3.12 dev'
- name: Collect coverage
id: coverage-run
run: nix develop ./nix --command bash -lc 'just coverage'
- name: Generate coverage comment
if: steps.coverage-run.outcome == 'success'
run: |
ROOT="$(pwd)"
nix develop ./nix --command bash -lc "python3 codetracer-python-recorder/scripts/generate_coverage_comment.py \
--rust-summary codetracer-python-recorder/target/coverage/rust/summary.json \
--python-json codetracer-python-recorder/target/coverage/python/coverage.json \
--output codetracer-python-recorder/target/coverage/coverage-comment.md \
--repo-root \"${ROOT}\""
- name: Upload Rust coverage artefacts
if: steps.coverage-run.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: rust-coverage
path: |
codetracer-python-recorder/target/coverage/rust/lcov.info
codetracer-python-recorder/target/coverage/rust/summary.json
if-no-files-found: warn
- name: Upload Python coverage artefacts
if: steps.coverage-run.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: python-coverage
path: |
codetracer-python-recorder/target/coverage/python/coverage.xml
codetracer-python-recorder/target/coverage/python/coverage.json
if-no-files-found: warn
- name: Upload coverage comment
if: steps.coverage-run.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: coverage-comment
path: codetracer-python-recorder/target/coverage/coverage-comment.md
if-no-files-found: warn
- name: Comment coverage summary
if: github.event_name == 'pull_request' && steps.coverage-run.outcome == 'success'
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.pull_request.number }}
identifier: coverage-summary
body-path: codetracer-python-recorder/target/coverage/coverage-comment.md
# rust-tests:
# name: Rust module test on ${{ matrix.os }} (Python ${{ matrix.python-version }})
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# os: [ubuntu-latest, macos-latest, windows-latest]
# python-version: ["10", "11", "12", "13"]
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-python@v5
# with:
# python-version: 3.${{ matrix.python-version }}
# - uses: astral-sh/setup-uv@v4
# - uses: messense/maturin-action@v1
# with:
# command: build
# args: --interpreter python3.${{ matrix.python-version }} -m crates/codetracer-python-recorder/Cargo.toml --release
# - name: Install and test built wheel with uv (pytest)
# shell: bash
# run: |
# v=${{matrix.python-version}}
# file=(crates/codetracer-python-recorder/target/wheels/*.whl)
# file="${file[0]}"
# uv run -p python3.$v --with "${file}" --with pytest -- \
# python -m pytest crates/codetracer-python-recorder/test tests/test_codetracer_api.py -q