Skip to content

Adding poisson_timer and brownian_motion to new csp.random module #204

Adding poisson_timer and brownian_motion to new csp.random module

Adding poisson_timer and brownian_motion to new csp.random module #204

Workflow file for this run

name: Build Status
on:
push:
branches:
- main
tags:
- v*
paths-ignore:
- LICENSE
- NOTICE
- README.md
pull_request:
branches:
- main
paths-ignore:
- LICENSE
- NOTICE
- README.md
workflow_dispatch:
inputs:
ci-full:
description: "Run Full CI"
required: false
type: boolean
default: false
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
checks: write
pull-requests: write
jobs:
####################################
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#~~~~~~~~~~/##########\~~~~~~~~~~~~#
#~~~~~~~~~|#|~~~~~~~|#|~~~~~~~~~~~~#
#~~~~~~~~~|#|~~~~~~~|#|~~~~~~~~~~~~#
#~~~~~~~~~|#|~~~~~~~|#|~~~~~~~~~~~~#
#~~~~~~~~~|#|~~~~~~~|#|~~~~~~~~~~~~#
#~~~~~~~~~|#|~~~~~~~|#|~~~~~~~~~~~~#
#~~~~~~~~~\##########/~~~~~~~~~~~~~#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Stage One - Initialize the build #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# This is so we can inspect the latest commit message from
# both push and pull_request events (there is no
# github.event.head_commit.message otherwise on pull
# requests)
initialize:
runs-on: ubuntu-22.04
outputs:
COMMIT_MESSAGE: ${{ steps.setup.outputs.COMMIT_MSG }}
FULL_RUN: ${{ steps.setuppush.outputs.FULL_RUN || steps.setuppr.outputs.FULL_RUN || steps.setupmanual.outputs.FULL_RUN }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# for pull_request so we can do HEAD^2
fetch-depth: 2
- name: Get Commit Message
run: echo "COMMIT_MSG=$(git log -1 --pretty=%B HEAD | tr '\n' ' ')" >> $GITHUB_ENV
if: ${{ github.event_name == 'push' }}
- name: Get Commit Message
run: echo "COMMIT_MSG=$(git log -1 --pretty=%B HEAD^2 | tr '\n' ' ')" >> $GITHUB_ENV
if: ${{ github.event_name == 'pull_request' }}
- name: Display and Setup Build Args (Push)
id: setuppush
run: |
echo "Commit Message: $COMMIT_MSG"
echo "Full Run: $FULL_RUN"
echo "COMMIT_MSG=$COMMIT_MSG" >> $GITHUB_OUTPUT
echo "FULL_RUN=$FULL_RUN" >> $GITHUB_OUTPUT
env:
FULL_RUN: ${{ startsWith(github.ref_name, 'v') || contains(github.event.head_commit.message, '[ci-full]') }}
if: ${{ github.event_name == 'push' }}
- name: Display and Setup Build Args (PR)
id: setuppr
run: |
echo "Commit Message: $COMMIT_MSG"
echo "Full Run: $FULL_RUN"
echo "COMMIT_MSG=$COMMIT_MSG" >> $GITHUB_OUTPUT
echo "FULL_RUN=$FULL_RUN" >> $GITHUB_OUTPUT
env:
FULL_RUN: ${{ contains(github.event.pull_request.title, '[ci-full]') || contains(env.COMMIT_MSG, '[ci-full]') }}
if: ${{ github.event_name == 'pull_request' }}
- name: Display and Setup Build Args (Manual)
id: setupmanual
run: |
echo "Commit Message: $COMMIT_MSG"
echo "Full Run: $FULL_RUN"
echo "COMMIT_MSG=$COMMIT_MSG" >> $GITHUB_OUTPUT
echo "FULL_RUN=$FULL_RUN" >> $GITHUB_OUTPUT
env:
FULL_RUN: ${{ github.event.inputs.ci-full }}
if: ${{ github.event_name == 'workflow_dispatch' }}
###################################
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#~~~~~~~~~~~/#######|~~~~~~~~~~~~~#
#~~~~~~~~~~/########|~~~~~~~~~~~~~#
#~~~~~~~~~/###/~|###|~~~~~~~~~~~~~#
#~~~~~~~~~~~~~~~|###|~~~~~~~~~~~~~#
#~~~~~~~~~~~~~~~|###|~~~~~~~~~~~~~#
#~~~~~~~~~~~~~~~|###|~~~~~~~~~~~~~#
#~~~~~~~~~~~~~~~|###|~~~~~~~~~~~~~#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Stage One - Lint Python / C++ #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
lint:
needs:
- initialize
strategy:
matrix:
os:
- ubuntu-22.04
python-version:
- 3.9
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: ./.github/actions/setup-python
with:
version: '${{ matrix.python-version }}'
- name: Install python dependencies
run: make requirements
- name: Python Lint Steps (Linux)
run: make lint
############################
#~~~~~~~~~~~~~~~~~~~~~~~~~~#
#~~~~~~~~~/########\~~~~~~~#
#~~~~~~~|###|~~~\###\~~~~~~#
#~~~~~~~~~~~~~~/###/~~~~~~~#
#~~~~~~~~~~~~/###/~~~~~~~~~#
#~~~~~~~~~~/###/~~~~~~~~~~~#
#~~~~~~~~/###/~~~~~~~~~~~~~#
#~~~~~~|#############|~~~~~#
#~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Stage Two - Build Python #
#~~~~~~~~~~~~~~~~~~~~~~~~~~#
build:
needs:
- initialize
strategy:
matrix:
os:
- ubuntu-22.04 # https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md
- macos-12 # https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md
- macos-14 # https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md
# - windows-2022 # https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
cibuildwheel:
- "cp38"
- "cp39"
- "cp310"
- "cp311"
is-full-run:
- ${{ needs.initialize.outputs.FULL_RUN == 'true' }}
exclude:
############################
# Things to always exclude #
############################
# Skip when cibuildwheel != python version
# to avoid duplication
- python-version: "3.8"
cibuildwheel: "cp39"
- python-version: "3.8"
cibuildwheel: "cp310"
- python-version: "3.8"
cibuildwheel: "cp311"
- python-version: "3.9"
cibuildwheel: "cp38"
- python-version: "3.9"
cibuildwheel: "cp310"
- python-version: "3.9"
cibuildwheel: "cp311"
- python-version: "3.10"
cibuildwheel: "cp38"
- python-version: "3.10"
cibuildwheel: "cp39"
- python-version: "3.10"
cibuildwheel: "cp311"
- python-version: "3.11"
cibuildwheel: "cp38"
- python-version: "3.11"
cibuildwheel: "cp39"
- python-version: "3.11"
cibuildwheel: "cp310"
##############################################
# Things to exclude if not a full matrix run #
##############################################
# mac arm builds support py3.10+
- os: macos-14
python-version: "3.8"
- os: macos-14
python-version: "3.9"
# minimize CI resource usage
- is-full-run: false
os: ubuntu-22.04
python-version: "3.8"
# windows is slow, so dont build unless its a full run
# - is-full-run: false
# os: windows-2022
# avoid unnecessary use of mac resources
- is-full-run: false
os: macos-12
- is-full-run: false
os: macos-14
python-version: "3.8"
- is-full-run: false
os: macos-14
python-version: "3.9"
- is-full-run: false
os: macos-14
python-version: "3.10"
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: ./.github/actions/setup-python
with:
version: '${{ matrix.python-version }}'
- name: Set up Caches
uses: ./.github/actions/setup-caches
with:
cibuildwheel: '${{ matrix.cibuildwheel }}'
- name: Set up dependencies
uses: ./.github/actions/setup-dependencies
with:
cibuildwheel: '${{ matrix.cibuildwheel }}'
if: ${{ runner.os == 'macOS' }}
########
# Linux
- name: Python Wheel Steps (Linux - cibuildwheel)
run: make dist-py-cibw
env:
CIBW_BUILD: "${{ matrix.cibuildwheel }}-manylinux*"
CIBW_ENVIRONMENT_LINUX: CSP_MANYLINUX="ON" CCACHE_DIR="/host/home/runner/work/csp/csp/.ccache" VCPKG_DEFAULT_BINARY_CACHE="/host${{ env.VCPKG_DEFAULT_BINARY_CACHE }}" VCPKG_DOWNLOADS="/host${{ env.VCPKG_DOWNLOADS }}"
CIBW_BUILD_VERBOSITY: 3
if: ${{ runner.os == 'Linux' }}
########
# Macos
- name: Python Build Steps (Macos x86)
run: make dist-py-cibw
env:
CIBW_BUILD: "${{ matrix.cibuildwheel }}-macos*"
CIBW_ENVIRONMENT_MACOS: CC="/usr/local/bin/gcc-13" CXX="/usr/local/bin/g++-13" CCACHE_DIR="/Users/runner/work/csp/csp/.ccache" VCPKG_DEFAULT_BINARY_CACHE="${{ env.VCPKG_DEFAULT_BINARY_CACHE }}" VCPKG_DOWNLOADS="${{ env.VCPKG_DOWNLOADS }}"
CIBW_ARCHS_MACOS: x86_64
CIBW_BUILD_VERBOSITY: 3
if: ${{ matrix.os == 'macos-12' }}
- name: Python Build Steps (Macos arm)
run: make dist-py-cibw
env:
CIBW_BUILD: "${{ matrix.cibuildwheel }}-macos*"
CIBW_ENVIRONMENT_MACOS: PATH="/opt/homebrew/opt/bison/bin/:$PATH" CC="/opt/homebrew/bin/gcc-13" CXX="/opt/homebrew/bin/g++-13" LDFLAGS="-Wl,-ld_classic" CCACHE_DIR="/Users/runner/work/csp/csp/.ccache" VCPKG_DEFAULT_BINARY_CACHE="${{ env.VCPKG_DEFAULT_BINARY_CACHE }}" VCPKG_DOWNLOADS="${{ env.VCPKG_DOWNLOADS }}"
CIBW_ARCHS_MACOS: arm64
CIBW_BUILD_VERBOSITY: 3
if: ${{ matrix.os == 'macos-14' }}
##########
# Windows
- name: Python Build Steps (Windows vc14.3)
run: make dist-py-cibw
env:
CIBW_BUILD: "${{ matrix.cibuildwheel }}-win_amd64"
CMAKE_GENERATOR: Visual Studio 17 2022
CIBW_ENVIRONMENT_WINDOWS: TODO="todo"
if: ${{ matrix.os == 'windows-2022' }}
# Upload artifacts
- name: Upload Wheel
uses: actions/upload-artifact@v4
with:
name: csp-dist-${{ runner.os }}-${{ runner.arch }}-${{ matrix.python-version }}
path: wheelhouse/*.whl
#############################
#~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#~~~~~~~~~~/########\~~~~~~~#
#~~~~~~~~~|##|~~~~|##|~~~~~~#
#~~~~~~~~~~~~~~~~~|##|~~~~~~#
#~~~~~~~~~~~~~|######|~~~~~~#
#~~~~~~~~~~~~~~~~~|##|~~~~~~#
#~~~~~~~~~|##|~~~~|##|~~~~~~#
#~~~~~~~~~\#########/~~~~~~~#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Stage Three - Build SDist #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~#
build_sdist:
needs:
- initialize
strategy:
matrix:
os:
- ubuntu-22.04
python-version:
- 3.9
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: ./.github/actions/setup-python
with:
version: '${{ matrix.python-version }}'
- name: Install python dependencies
run: make requirements
# Build SDist
- name: Python SDist Steps
run: make dist-py-sdist
# Upload artifacts
- name: Upload SDist
uses: actions/upload-artifact@v4
with:
name: csp-sdist
path: dist/*.tar.gz
#############################
#~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#~~~~~~~|##|~~~~|##|~~~~~~~~#
#~~~~~~~|##|~~~~|##|~~~~~~~~#
#~~~~~~~|##|~~~~|##|~~~~~~~~#
#~~~~~~~|##########|~~~~~~~~#
#~~~~~~~~~~~~~~~|##|~~~~~~~~#
#~~~~~~~~~~~~~~~|##|~~~~~~~~#
#~~~~~~~~~~~~~~~|##|~~~~~~~~#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Stage Four - Test Python #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~#
test:
needs:
- initialize
- build
strategy:
matrix:
os:
- ubuntu-22.04
- macos-12
- macos-14
# - windows-2022
python-version:
- 3.8
- 3.9
- "3.10"
- 3.11
is-full-run:
- ${{ needs.initialize.outputs.FULL_RUN == 'true' }}
exclude:
##############################################
# Things to exclude if not a full matrix run #
##############################################
# mac arm builds support py3.10+
- os: macos-14
python-version: "3.8"
- os: macos-14
python-version: "3.9"
# Exclude windows builds
# - is-full-run: false
# os: windows-2022
# Exclude macOS builds for now
- is-full-run: false
os: macos-12
- is-full-run: false
os: macos-14
# Exclude Python 3.8, 3.10, 3.11 builds
- is-full-run: false
python-version: 3.8
- is-full-run: false
python-version: 3.9
- is-full-run: false
python-version: "3.10"
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: ./.github/actions/setup-python
with:
version: '${{ matrix.python-version }}'
- name: Install python dependencies
run: make requirements
- name: Install test dependencies (Linux)
shell: bash
run: sudo apt-get install graphviz
if: ${{ runner.os == 'Linux' }}
- name: Install test dependencies (Mac)
shell: bash
run: brew install graphviz
if: ${{ runner.os == 'macOS' }}
# Download artifact
- name: Download wheel
uses: actions/download-artifact@v4
with:
name: csp-dist-${{ runner.os }}-${{ runner.arch }}-${{ matrix.python-version }}
- name: Install wheel (Linux)
run: python -m pip install -U *manylinux2014*.whl --target .
if: ${{ runner.os == 'Linux' }}
# Note, on mac we must install the x86 wheel, the arm64 wheel
# would need an arm machine to test
- name: Install wheel (OSX)
run: python -m pip install -U *x86*.whl --target .
if: ${{ runner.os == 'macOS' && matrix.python-version != '3.11' }}
- name: Install wheel (OSX 3.11+)
run: python -m pip install -U *universal*.whl --target .
if: ${{ runner.os == 'macOS' && matrix.python-version == '3.11' }}
- name: Install wheel (windows)
run: python -m pip install -U (Get-ChildItem .\*.whl | Select-Object -Expand FullName) --target .
if: ${{ runner.os == 'Windows' }}
# Run tests
- name: Python Test Steps
run: make test
########################################
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#~~~~~~~~~~~~~~|##########|~~~~~~~~~~~~#
#~~~~~~~~~~~~~~|##|~~~~~~~~~~~~~~~~~~~~#
#~~~~~~~~~~~~~~|##|~~~~~~~~~~~~~~~~~~~~#
#~~~~~~~~~~~~~~|##########|~~~~~~~~~~~~#
#~~~~~~~~~~~~~~~~~~~~~~|##|~~~~~~~~~~~~#
#~~~~~~~~~~~~~~|##|~~~~|##|~~~~~~~~~~~~#
#~~~~~~~~~~~~~~|##########|~~~~~~~~~~~~#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Stage Four - Build / test the SDist #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# test_sdist:
# needs:
# - initialize
# - build_sdist
# strategy:
# matrix:
# os:
# - ubuntu-22.04
# python-version:
# - 3.9
# runs-on: ${{ matrix.os }}
# # if: ${{ needs.initialize.outputs.FULL_RUN == 'true' }}
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# with:
# submodules: recursive
# - name: Set up Python ${{ matrix.python-version }}
# uses: ./.github/actions/setup-python
# with:
# version: '${{ matrix.python-version }}'
# - name: Set up Caches
# uses: ./.github/actions/setup-caches
# with:
# cibuildwheel: 'cp39'
# # Python
# - name: Install python dependencies
# run: make requirements
# # Download sdist
# - uses: actions/download-artifact@v4
# with:
# name: csp-sdist
# path: dist/
# # Install sdist
# - name: Install sdist
# run: python -m pip install -U dist/csp*.tar.gz --target .
# env:
# CCACHE_DIR: /host/home/runner/work/csp/csp/.ccache
# VCPKG_DEFAULT_BINARY_CACHE: /host/home/runner/vcpkg_cache
# # Test sdist
# - name: Run tests against from-scratch sdist build
# run: make test
##########################################################################################################################
#################################
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#~~~~~~~~~|##########|~~~~~~~~~~#
#~~~~~~~~~|##|~~~~~~~~~~~~~~~~~~#
#~~~~~~~~~|##|~~~~~~~~~~~~~~~~~~#
#~~~~~~~~~|##########|~~~~~~~~~~#
#~~~~~~~~~|##|~~~~|##|~~~~~~~~~~#
#~~~~~~~~~|##|~~~~|##|~~~~~~~~~~#
#~~~~~~~~~|##########|~~~~~~~~~~#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Test Dependencies/Regressions #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
test_dependencies:
needs:
- initialize
- build
strategy:
matrix:
os:
- ubuntu-20.04
python-version:
- 3.9
package:
- "sqlalchemy>=2"
- "sqlalchemy<2"
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: ./.github/actions/setup-python
with:
version: '${{ matrix.python-version }}'
- name: Install python dependencies
run: make requirements
- name: Install test dependencies
shell: bash
run: sudo apt-get install graphviz
# Download artifact
- name: Download wheel
uses: actions/download-artifact@v4
with:
name: csp-dist-${{ runner.os }}-${{ runner.arch }}-${{ matrix.python-version }}
- name: Install wheel
run: python -m pip install -U *manylinux2014*.whl --target .
- name: Install package - ${{ matrix.package }}
run: python -m pip install -U "${{ matrix.package }}"
# Run tests
- name: Python Test Steps
run: make test TEST_ARGS="-k TestDBReader"
if: ${{ contains( 'sqlalchemy', matrix.package )}}