Skip to content

build(deps): bump actions/setup-python from 5 to 7 #41

build(deps): bump actions/setup-python from 5 to 7

build(deps): bump actions/setup-python from 5 to 7 #41

Workflow file for this run

name: CI
on:
push:
tags-ignore: ["v*"] # a release tag is covered by the Release workflow
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-test:
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-latest, cc: gcc }
- { os: ubuntu-latest, cc: clang }
- { os: macos-latest, cc: clang }
- { os: windows-latest, cc: "" }
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Select compiler
if: matrix.cc != ''
run: echo "CC=${{ matrix.cc }}" >> "$GITHUB_ENV"
- name: Configure
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
- name: Build
run: cmake --build build --config Release
- name: Test
run: ctest --test-dir build -C Release --output-on-failure
- name: Run example (Unix)
if: runner.os != 'Windows'
run: ./build/vol_target_demo
- name: Run example (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: .\build\Release\vol_target_demo.exe
build-test-32bit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install 32-bit toolchain
run: sudo apt-get update && sudo apt-get install -y gcc-multilib
- name: Configure (-m32, size_t is 32 bits; SSE math, no x87 excess precision)
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-m32 -msse2 -mfpmath=sse" -DCMAKE_EXE_LINKER_FLAGS=-m32
- name: Build
run: cmake --build build
- name: Test
run: ctest --test-dir build --output-on-failure
- name: Run example
run: ./build/vol_target_demo
sanitize:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure (ASan + UBSan)
run: >
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug
-DCMAKE_C_FLAGS="-fsanitize=address,undefined -fno-sanitize-recover=all"
-DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address,undefined"
- name: Build
run: cmake --build build
- name: Test
run: ctest --test-dir build --output-on-failure
- name: Run example under sanitizers
run: ./build/vol_target_demo
install-consume:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build and install
run: |
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DMLRISK_BUILD_TESTS=OFF -DMLRISK_BUILD_EXAMPLES=OFF
cmake --build build
cmake --install build --prefix "$PWD/prefix"
- name: Consume via find_package
run: |
mkdir consumer && cd consumer
cat > main.c <<'C'
#include "mlrisk/mlrisk.h"
#include <stdio.h>
int main(void) {
double r[] = {0.01, -0.02, 0.015}, s[3];
mlr_status st = mlr_ewma_vol(r, 3, 0.94, s);
printf("mlrisk %s status %d sigma %.6f\n", MLRISK_VERSION, (int)st, s[2]);
return st == MLR_OK ? 0 : 1;
}
C
cat > CMakeLists.txt <<'CM'
cmake_minimum_required(VERSION 3.21)
project(consumer C)
find_package(mlrisk 3 REQUIRED)
add_executable(consumer main.c)
target_link_libraries(consumer PRIVATE mlrisk::mlrisk)
CM
cmake -S . -B build -DCMAKE_PREFIX_PATH="$GITHUB_WORKSPACE/prefix"
cmake --build build
./build/consumer
- name: Consume via pkg-config
run: |
export PKG_CONFIG_PATH="$PWD/prefix/lib/pkgconfig"
pkg-config --modversion mlrisk
read -ra FLAGS <<< "$(pkg-config --cflags --libs mlrisk)"
cc -std=c11 consumer/main.c "${FLAGS[@]}" -o consumer_pc
./consumer_pc
- name: Public headers compile as C++
run: |
echo '#include "mlrisk/mlrisk.h"' > headers.cpp
c++ -std=c++17 -Wall -Wextra -Werror -fsyntax-only -I prefix/include headers.cpp
reference:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v7
with:
python-version: "3.12"
cache: pip
cache-dependency-path: tests/reference/requirements.txt
- name: Install reference packages
run: pip install -r tests/reference/requirements.txt
- name: Build the example
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DMLRISK_BUILD_TESTS=OFF && cmake --build build
- name: Check the C library against independent references
run: MLRISK_DEMO=build/vol_target_demo python tests/reference/reference_check.py
- name: The GARCH fit reaches the optimum that brute force finds
run: |
python -m pip install .
python tests/reference/garch_multistart_check.py
python-package:
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-latest, python: "3.9" }
- { os: ubuntu-latest, python: "3.13" }
- { os: macos-latest, python: "3.13" }
- { os: windows-latest, python: "3.13" }
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python }}
- name: Build and install the wheel
run: python -m pip install ".[test]"
- name: Test against the installed wheel
run: python -m pytest python/tests -q
- name: A source distribution carries the C it has to compile
if: matrix.os == 'ubuntu-latest'
run: |
python -m pip install build
python -m build --sdist --outdir dist .
cd "$(mktemp -d)"
python -m pip install --force-reinstall "$GITHUB_WORKSPACE"/dist/*.tar.gz
python -c "import walkforward; print(walkforward.__version__)"
- name: The worked example runs and reproduces its numbers
if: matrix.os == 'ubuntu-latest' && matrix.python == '3.13'
working-directory: examples
run: |
python -m pip install nbclient ipykernel matplotlib
jupyter execute spy_walk_forward.ipynb
- name: The package and the library it bundles agree on the version
run: python -c "import walkforward as wf; assert wf.__version__ == wf.c_version(), (wf.__version__, wf.c_version()); print(wf.__version__)"