Skip to content

CI

CI #146

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
schedule:
# 06:17 UTC daily — offset from the top of hour to miss the scheduled-run queue surge.
- cron: '17 6 * * *'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- run: pip install ruff
- run: ruff check trnrand/ tests/ examples/
- run: ruff format --check trnrand/ tests/ examples/
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- run: pip install -e ".[dev]"
- run: pytest tests/ -v -x --tb=short -m "not neuron and not nki_simulator" --cov=trnrand --cov-report=xml --cov-report=term
- name: Upload coverage to Codecov
if: matrix.python-version == '3.12'
uses: codecov/codecov-action@v4
with:
files: ./coverage.xml
flags: unittests
fail_ci_if_error: false
nki-simulator:
runs-on: ubuntu-latest
# NKI 0.3.0 Stable is on the Neuron pip index as of Neuron SDK 2.29
# (confirmed 2026-04-14). continue-on-error has been removed — this job
# is now a hard gate. Threefry simulator tests carry no xfail marks.
env:
TRNRAND_USE_SIMULATOR: "1"
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install nki (Neuron SDK 2.29 / NKI 0.3.0 Stable)
run: pip install "nki>=0.3.0" --extra-index-url https://pip.repos.neuron.amazonaws.com
- run: pip install -e ".[dev]"
- run: pytest tests/ -v -m nki_simulator --cov=trnrand --cov-report=xml --cov-append
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}