Skip to content

Implement all 14 topic modules with interfaces, docs, tests, benchmarks #16

Implement all 14 topic modules with interfaces, docs, tests, benchmarks

Implement all 14 topic modules with interfaces, docs, tests, benchmarks #16

Workflow file for this run

name: CI
on:
push:
branches: [main, wjy_dev, jzj_dev]
pull_request:
branches: [main]
jobs:
test:
runs-on: self-hosted
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Install
run: |
python${{ matrix.python-version }} -m pip install --upgrade pip
python${{ matrix.python-version }} -m pip install -e ".[all]"
- name: Run tests
run: python${{ matrix.python-version }} -m pytest tests/ -v --tb=short
lint:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- name: Install
run: |
python3.12 -m pip install --upgrade pip
python3.12 -m pip install -e ".[all]"
python3.12 -m pip install flake8 mypy
- name: flake8
run: python3.12 -m flake8 scratchv/ scratchv_dag/ tests/
- name: mypy
run: python3.12 -m mypy scratchv/ scratchv_dag/ --ignore-missing-imports
coverage:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- name: Install
run: |
python3.12 -m pip install --upgrade pip
python3.12 -m pip install -e ".[all]"
python3.12 -m pip install pytest-cov
- name: Run tests with coverage
run: python3.12 -m pytest tests/ --cov=scratchv --cov=scratchv_dag --cov-report=term --cov-report=xml
smoke:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- name: Install
run: |
python3.12 -m pip install --upgrade pip
python3.12 -m pip install -e ".[all]"
- name: Smoke test - DSL compilation
run: |
python3.12 -m scratchv examples/simple_add.dsl -o /tmp/simple_add.s --dump-ir
python3.12 -m scratchv examples/relu_test.dsl -o /tmp/relu.s --optimize all
python3.12 -m scratchv examples/matmul_test.dsl -o /tmp/matmul.s --optimize all
benchmark:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- name: Install
run: |
python3.12 -m pip install --upgrade pip
python3.12 -m pip install -e ".[all]"
- name: Run benchmark tests
run: python3.12 -m pytest benchmarks/test_benchmark.py -v --tb=short
cnn-benchmark:
runs-on: self-hosted
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Install
run: |
python3.12 -m pip install --upgrade pip
python3.12 -m pip install -e ".[all]"
- name: Generate RISC-V binary + analytical estimation
run: |
python3.12 scratchv/standalone/onnx_to_riscv_standalone.py \
models/graph/cnn.onnx \
-o /tmp/cnn_riscv.bin \
--estimate \
--report
- name: Upload HTML benchmark report
uses: actions/upload-artifact@v4
with:
name: cnn-benchmark-report
path: benchmark_reports/
retention-days: 30
- name: Write GitHub job summary
run: |
cat benchmark_reports/github_summary.md >> $GITHUB_STEP_SUMMARY