Skip to content

TEST: [C++] Add Valgrind suppression file #154

TEST: [C++] Add Valgrind suppression file

TEST: [C++] Add Valgrind suppression file #154

Workflow file for this run

name: Build and Publish
on:
workflow_dispatch:
pull_request:
push:
branches:
- stable
release:
types:
- published
jobs:
build_sdist:
name: Build SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Build SDist
run: pipx run build --sdist
- name: Normalize sdist filename
shell: bash
run: |
shopt -s nullglob
cd dist
for f in *.tar.gz; do
if [[ "$f" =~ ^([a-zA-Z0-9-]+)-([0-9].*)$ ]]; then
name_part="${BASH_REMATCH[1]}"
version_part="${BASH_REMATCH[2]}"
normalized_name="${name_part//-/_}"
new_filename="${normalized_name}-${version_part}"
if [[ "$f" != "$new_filename" ]]; then
echo "Renaming '$f' -> '$new_filename'"
mv "$f" "$new_filename"
fi
fi
done
ls -la .
- name: Check metadata
run: pipx run twine check dist/*
- uses: actions/upload-artifact@v7
with:
name: artifact-sdist
path: dist/*.tar.gz
build_wheels:
name: Wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v6
with:
submodules: true
- uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Cache OpenMP repo
if: matrix.os == 'macos-latest'
id: clone-openmp
uses: actions/cache@v5
with:
path: llvm-project
key: ${{ runner.os }}-openmp
- name: Clone OpenMP repo
if: matrix.os == 'macos-latest' && steps.clone-openmp.outputs.cache-hit != 'true'
run: |
git clone --depth 1 --branch llvmorg-19.1.1 https://github.com/llvm/llvm-project
- name: Build OpenMP
if: matrix.os == 'macos-latest'
shell: bash
run: |
PATH="$HOME/.local/:$PATH"
mv llvm-project/openmp ./openmp
mv llvm-project/cmake ./cmake
rm -rf llvm-project
mkdir openmp_build
cmake -S openmp -B openmp_build \
-DCMAKE_OSX_ARCHITECTURES="arm64" \
-DCMAKE_OSX_DEPLOYMENT_TARGET="12.0" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_INSTALL_PREFIX="$HOME/.local/libomp"
cmake --build openmp_build --target install --config Release
- uses: pypa/cibuildwheel@v3.4.1
env:
CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-* cp313-* cp314-*"
CIBW_ENVIRONMENT: CMAKE_ARGS="-DMMU_ENABLE_ARCH_FLAGS=OFF -DMMU_ENABLE_OPENMP=ON -DMMU_DISABLE_OPENMP=OFF -DMMU_CICD_MODE=ON"
CIBW_ENVIRONMENT_MACOS: PATH="$HOME/.local/:$PATH" MACOSX_DEPLOYMENT_TARGET=12.0 DYLD_LIBRARY_PATH="$HOME/.local/libomp/lib" CMAKE_ARGS="-DMMU_ENABLE_ARCH_FLAGS=OFF -DMMU_VENDOR_OPENMP=ON -DMMU_ENABLE_OPENMP=ON -DMMU_DISABLE_OPENMP=OFF -DMMU_CICD_MODE=ON -DOpenMP_ROOT=$HOME/.local/libomp"
CIBW_ARCHS_MACOS: "arm64"
CIBW_TEST_EXTRAS: test
CIBW_TEST_COMMAND: pytest {project}/tests/api
CIBW_TEST_COMMAND_MACOS: pytest {project}/tests/api && python -c "from mmu import _MMU_MT_SUPPORT; assert _MMU_MT_SUPPORT"
- name: Verify clean directory
run: git diff --exit-code
shell: bash
- name: Upload wheels
uses: actions/upload-artifact@v7
with:
name: artifact-${{ matrix.os }}
path: wheelhouse/*.whl
build_macos_intel:
name: MacOS x86_64 wheels
runs-on: macos-15-intel
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Cache OpenMP repo
id: clone-openmp
uses: actions/cache@v5
with:
path: llvm-project
key: ${{ runner.os }}-openmp
- name: Clone OpenMP repo
if: steps.clone-openmp.outputs.cache-hit != 'true'
run: |
git clone --depth 1 --branch llvmorg-19.1.1 https://github.com/llvm/llvm-project
- name: Build OpenMP
shell: bash
run: |
mv llvm-project/openmp ./openmp
mv llvm-project/cmake ./cmake
rm -rf llvm-project
mkdir openmp_build
cmake -S openmp -B openmp_build \
-DCMAKE_OSX_ARCHITECTURES="x86_64" \
-DCMAKE_OSX_DEPLOYMENT_TARGET="12.0" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_INSTALL_PREFIX="/usr/local"
cmake --build openmp_build --target install --config Release
- uses: pypa/cibuildwheel@v3.4.1
env:
CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-* cp313-* cp314-*"
CIBW_ARCHS: "x86_64"
CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=12.0 CMAKE_ARGS="-DMMU_ENABLE_ARCH_FLAGS=OFF -DMMU_VENDOR_OPENMP=ON -DMMU_ENABLE_OPENMP=ON -DMMU_DISABLE_OPENMP=OFF -DMMU_CICD_MODE=ON -DOpenMP_ROOT=/usr/local"
CIBW_TEST_EXTRAS: test
CIBW_TEST_COMMAND: pytest {project}/tests/api && python -c "from mmu import _MMU_MT_SUPPORT; assert _MMU_MT_SUPPORT"
- name: Verify clean directory
run: git diff --exit-code
shell: bash
- name: Upload wheels
uses: actions/upload-artifact@v7
with:
name: artifact-macos-x86-64
path: wheelhouse/*.whl
publish-to-testpypi:
name: Publish release on TestPyPi
needs: [build_sdist, build_wheels, build_macos_intel]
runs-on: ubuntu-latest
if: github.event_name == 'release'
environment: testrelease
permissions:
id-token: write
steps:
- uses: actions/setup-python@v6
with:
python-version: "3.11"
- uses: actions/download-artifact@v8
with:
pattern: artifact-*
merge-multiple: true
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true
pypi-publish:
name: Publish release on PyPi
needs: [build_sdist, build_wheels, build_macos_intel, publish-to-testpypi]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published' && github.event.prerelease == false
environment: release
permissions:
id-token: write
steps:
- uses: actions/setup-python@v6
with:
python-version: "3.11"
- uses: actions/download-artifact@v8
with:
pattern: artifact-*
merge-multiple: true
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true