Skip to content

Enable /experimental:c11atomics MSVC #41

Enable /experimental:c11atomics MSVC

Enable /experimental:c11atomics MSVC #41

name: Python Wheels tests
on:
push:
tags-ignore:
- '**'
branches:
- '**'
env:
PACKAGE_VERSION: "1.2.3.dev0"
PACKAGE_NAME: qpalm
PYTHON_VERSION: '3.11'
jobs:
build-linux:
runs-on: ubuntu-latest
container: ubuntu:jammy
strategy:
matrix:
config: [RelWithDebInfo, Debug]
env:
HOST: 'x86_64-centos7-linux-gnu'
CMAKE_C_COMPILER_LAUNCHER: ccache
CMAKE_CXX_COMPILER_LAUNCHER: ccache
CCACHE_DIR: /root/.ccache
steps:
# Git clone
- name: Install git
run: apt -y update && apt -y install --no-install-recommends git ca-certificates
- uses: actions/checkout@v3
with:
submodules: recursive
# Tools
- name: Install tools
uses: ./.github/workflows/toolchain
with:
host: ${{ env.HOST }}
python-version: ${{ env.PYTHON_VERSION }}
pypy: ''
# Ccache
- name: Prepare ccache directory
run: mkdir -p "${{ env.CCACHE_DIR }}"
- name: Cache ccache
uses: actions/cache@v3
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ env.HOST }}-${{ matrix.config }}-ccache-${{ github.run_id }}
restore-keys: ${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ env.HOST }}-${{ matrix.config }}-ccache
# Pip install dependencies
- name: Install Python dependencies
run: python${{ env.PYTHON_VERSION }} -m pip install -U pip build
# Build
- name: Build wheel
run: |
host="${{ env.HOST }}"
staging="/opt/$host"
cat > ninja-${{ matrix.config }}.cross.toml <<- EOF
[cmake]
config = ["${{ matrix.config }}"]
generator = "Ninja Multi-Config"
[cmake.options]
CMAKE_FIND_ROOT_PATH = "$staging/pybind11;$staging/eigen-master"
USE_GLOBAL_PYBIND11 = "On"
EOF
python${{ env.PYTHON_VERSION }} -m build -w . \
-C--cross="$PWD/ninja-${{ matrix.config }}.cross.toml" \
-C--cross="$staging/$host.py-build-cmake.cross.toml"
env:
CFLAGS: "-fstack-protector-all -mshstk -fcf-protection=full -D_FORTIFY_SOURCE=${{ matrix.config != 'Debug' && '3' || '0' }} -fdiagnostics-color -static-libgcc"
CXXFLAGS: "-fstack-protector-all -mshstk -fcf-protection=full -D_FORTIFY_SOURCE=${{ matrix.config != 'Debug' && '3' || '0' }} -fdiagnostics-color -static-libgcc -static-libstdc++"
# Upload
- name: Upload Wheels
uses: actions/upload-artifact@v3
with:
name: whl-${{ env.PYTHON_VERSION }}-${{ matrix.config }}-linux-test
retention-days: 1
path: dist/*.whl
test-linux:
needs: [build-linux]
runs-on: ubuntu-latest
container: python:3.11-bullseye
strategy:
matrix:
config: [RelWithDebInfo, Debug]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/download-artifact@v3
with:
name: whl-${{ env.PYTHON_VERSION }}-${{ matrix.config }}-linux-test
path: dist
- name: Install test dependencies
run: |
python3 -m pip install -U pip twine
python3 -m pip install --find-links=dist "${PACKAGE_NAME}[test]==${PACKAGE_VERSION}"
- name: Test (${{ matrix.config }})
run: python3 -m pytest -rP
env:
QPALM_PYTHON_DEBUG: ${{ matrix.config == 'Debug' }}
- name: Install Valgrind
run: |
apt update
apt install -y valgrind --no-install-recommends
- name: Test (Valgrind, ${{ matrix.config }})
run: valgrind --gen-suppressions=all --suppressions=scripts/valgrind/python.supp --error-exitcode=234 python3 -m pytest -rP
env:
QPALM_PYTHON_DEBUG: ${{ matrix.config == 'Debug' }}
- name: Check Wheel metadata
run: python -m twine check dist/*.whl